- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When attempting to use the cblas_dgemm() function, I am experiencing a segmentation fault. The segfault occurs only when running the code on a Linux machine (works on a Windows machine).
The code is set up as follows:
#define ML_ROWS_A 5
#define ML_COLS_B 7
#define ML_COLS_A 6
double a_d[ML_ROWS_A*ML_COLS_A], b_d[ML_COLS_A*ML_COLS_B], c_d[ML_ROWS_A*ML_COLS_B];
const double alpha = 1.0;
const double beta = 1.0;
int m = ML_ROWS_A;
int n = ML_COLS_B;
int k = ML_COLS_A;
cblas_dgemm( CblasRowMajor, CblasNoTrans, CblasNoTrans, m, n, k, alpha, a_d, k, b_d, n, beta, c_d, n );
If I add the calls:
int n_alloc;
mkl_mem_stat(&n_alloc);
Before calling cblas_dgemm(), the function works correctly (though no memory has been allocated through mkl calls). Similarly, if I instead allocate memory through an mkl call (such as mkl_calloc) before calling cblass_dgemm() the function works correctly (even though I do not actually pass the allocated memory to the function call). Can anyone explain why the segfault is occurring and why calling certain mkl functions before cblass_dgemm remedies the issue?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Sesto,
do you have a small code for the problem? from the code,
int m = ML_ROWS_A;
int n = ML_COLS_B;
int n = ML_COLS_A;
Seem you haven't lda =K defined and "n" was written two times?
Best Regards,
Ying
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ying H,
That was just a typo when posting the question. I edited the original post to reflect this.
Thank You,
Dominic
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dominic,
We are investigating this issue. It would be helpful if you can send us a sample code, not just a code snippet, so that we can recreate the issue?
Thank you,
Khang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dominic,
The code snippet you provided didn't give any error.
As I have mentioned in the previous post, can you send us your entire code where you saw the error?
Thanks,
Khang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dominic,
I forgot to mention that the dimensions you provided are too small to cause any seg fault.
Khang
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Attached is an Eclipse project that demonstrates the segfault occurring when run on Linux 6.6. The call to cblas_dgemm functions correctly if it is the only test called. The call to cblas_sgemm also works correctly if it is the only test called. If the test that calls cblas_sgemm is called before cblas_dgemm, a segfault occurs.
Eclipse Details:
Eclipse IDE for C/C++ Developers
Version: Oxygen.3 Release (4.7.3)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I extracted the *. and cpp code and checked how this works on my local RH7 system with latest available version of mkl - 2018.3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We built with GNU, not ICC. Additionally we are using the 2017 version of MKL, not the 2018 version.
Thank You
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i don't expect building by icc or gcc will affect, but i will check this later and let you know
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Some additional environment information:
Compiler: gcc 4.8.5
OS: CentOS Linux v7.4
We used the 2017 version of the MKL Library
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
we recommend you to evaluate the latest mkl 2018.3 ( take this binaries from this site - https://software.intel.com/en-us/performance-libraries ) and check if the problem is still exists with this update too.

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