- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

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

cout << endl;

return 0;

}

Stanley KO

1 Solution

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

It looks like root cause of your problem is related to LP64/ILP64.

If you linked with ILP64 MKL libraries you need to add compiler option -DMKL_ILP64 for C-compilation

Or please try to use LP64 model:

-L$MKLPATH $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -openmp -lpthread

Please seealso thread: http://software.intel.com/en-us/forums/showthread.php?t=76101&o=d&s=lr

Link Copied

5 Replies

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

It looks like root cause of your problem is related to LP64/ILP64.

If you linked with ILP64 MKL libraries you need to add compiler option -DMKL_ILP64 for C-compilation

Or please try to use LP64 model:

-L$MKLPATH $MKLPATH/libmkl_solver_lp64.a -Wl,--start-group -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -Wl,--end-group -openmp -lpthread

Please seealso thread: http://software.intel.com/en-us/forums/showthread.php?t=76101&o=d&s=lr

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Thanks for your reply. I have tried both link in compilation. But the Error now becomes

MKL ERROR: Parameter 8 was incorrect on entry to cblas_dsyrk

I have checked the code and the BLAS manual but found no mistake in the input. Still don't know what's wrong.

Thanks.

Stanley KO

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

I've tried to set lda = 3 and it works. But I am so confused since according to the manual it should not be 3.

lda INTEGER. Specifies the first dimension of a as declared in

the calling (sub)program. When trans = 'N' or 'n', then

lda must be at least max(1,n), otherwise lda must be at

least max(1, k).

And the first dimension of my A is 2. Anyway, thanks for you kind help.

Regards,

Stanley KO

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi,

Well, it's not so simple to use CBLAScorrectly passing LDA etc...

Well, it's not so simple to use CBLAScorrectly passing LDA etc...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

The C interface to MKL has to know how many columns there are in the actual matrix being passed as a 1-D array. In your example, there are 3 columns.

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page