Dear all,
I am trying to implement a BLAS routine dsyrk with the following code. It was compiled successfully. But whenever I excute the output file, a Segmentation fault appears. I've checked the code from time to time and found no error. Please help. Thanks a lot.
The compilation line:
$ icpc syrk.cpp -L/libmkl_solver_ilp64.a -Wl,--start-group
-lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -openmp
-lpthread -o syrk.out
The source code:
#include
extern "C"
{
#include "mkl.h"
}
using namespace std;
/********C := alpha * A'A + beta * C*********/
int main()
{
/* 2x3 matrix A
3 7 2
4 1 9
*/
const CBLAS_ORDER order = CblasRowMajor;
const CBLAS_TRANSPOSE trans = CblasTrans;
const CBLAS_UPLO uplo = CblasUpper;
const int N = 3; // the order of the matrix C
const int K = 2; // when trans = 'T', K is the number of rows of A
const double alpha = 1.0;
const double a[6] = {3.0, 7.0, 2.0, 4.0, 1.0, 9.0};
const int lda = 2; // the first dimension of A
const double beta = 0.0;
double c[9] = {0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0} ;
const int ldc = 3;
cblas_dsyrk(order, uplo, trans, N, K, alpha, a, lda, beta, c, ldc);
for( int i = 0; i < 9; i++ )
cout << c << " ";
cout << endl;
return 0;
}
Stanley KO