- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to set MKL_NUM_THREADS dynamically in my programm. MKL user manual tells me to use mkl_set_num_threads(), but this function always crash my program. I find another function in MKL header file, MKL_Set_Num_Threads(). When I use the latter one instead, it is OK.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You are right. I noticed this issue; there is mismatch between header file and documentation. I will work with MKL development team to correct it.
Thanks,
Naveen Gv
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I need to set MKL_NUM_THREADS dynamically in my programm. MKL user manual tells me to use mkl_set_num_threads(), but this function always crash my program. I find another function in MKL header file, MKL_Set_Num_Threads(). When I use the latter one instead, it is OK.
Hi!
Please use #include "mkl.h" in your code. It's obligatory operator if you would like to use mkl_set_num_threads.
Here are a few lines from MKL documentation:
#include mkl.h // Mandatory to make these definitions work!
mkl_set_num_threads(num); // Equivalent to omp_set_num_threads( int )
return_code = mkl_domain_set_num_threads( num, MKL_FFT );
. . . . .
-Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
Please use #include "mkl.h" in your code. It's obligatory operator if you would like to use mkl_set_num_threads.
Here are a few lines from MKL documentation:
#include mkl.h // Mandatory to make these definitions work!
mkl_set_num_threads(num); // Equivalent to omp_set_num_threads( int )
return_code = mkl_domain_set_num_threads( num, MKL_FFT );
. . . . .
-Vladimir
I know it is OK to include "mkl.h", this is because "mkl_service.h" typedefine mk_set_num_threads as MKL_Set_Num_Threads. But both mkl_set_num_threads() and MKL_Set_Num_Threads() are available in MKL dll or so. It is not make sense to me mkl_set_num_threads() function will crash my application.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I know it is OK to include "mkl.h", this is because "mkl_service.h" typedefine mk_set_num_threads as MKL_Set_Num_Threads. But both mkl_set_num_threads() and MKL_Set_Num_Threads() are available in MKL dll or so. It is not make sense to me mkl_set_num_threads() function will crash my application.
Ok, I see.
Due to MKL support C and Fortran (which have a different styles for parameters passing), we provide the separate entries for C and Fortran users. So mkl_set_num_threads() is for Fortran users and MKL_Set_Num_Threads() is for C-users.
You are trying to make a call to the Fortran function from C using C-interface.
-Vladimir

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