- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am compiling a simple BLAS program which has DGEMV. It works fine when I have no explicit thread control.
However, when I include
mkl_set_dynamic(1);
mkl_set_num_threads(4);
(C code)
just before the DGEMV call. The program doesn't compile and simply spits out "Segmentation Fault"
I have already tried ulimit -s unlimited and KMP_STACKSIZE but no use.
I am compiling using :
icc testing_dgemv.c -Wl,--start-group $MKLROOT/lib/intel64/libmkl_intel_lp64.a $MKLROOT/lib/intel64/libmkl_intel_thread.a $MKLROOT/lib/intel64/libmkl_core.a -Wl,--end-group -openmp -lpthread -lm
I also tried
icc testing_dgesv.c -mkl=parallel
Code :
#include
#include
int main()
{
int i, j,n,n2;
n=1500;
double* m = (double*)malloc( n*n*sizeof(double));
double* x = (double*)malloc( n*sizeof(double));
double* y = (double*)malloc( n*sizeof(double));
for(i=0;i
x = (i+1)*(i+1)*1.00;
y = 0;
for(j=0;j
}
mkl_set_dynamic(1);
mkl_set_num_threads(4);
cblas_dgemv(CblasRowMajor, CblasNoTrans, n, n, 1.0, m, n, x, 1, 0.0, y, 1);
return 0;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In previous postby Vipin there was not right suggestionabout using mkl_set_dynamic().
This function is needed if user needs nested parallelizm and allows or not 'soft' or 'hard' threading in MKL
(enables or disables dynamic adjustment of the number of threads).
See MKL doc.
As to the problem:
Please add all needed for the test header files:
stdlib.h for malloc
mkl.h or mkl_service.h for mkl_set_dynamic and mkl_set_num_thread.
After this correction the tests PASSED on requested 4-threads
OMP: Info #147: KMP_AFFINITY: Internal thread 0 bound to OS proc set {0,12}
OMP: Info #147: KMP_AFFINITY: Internal thread 3 bound to OS proc set {8,20}
OMP: Info #147: KMP_AFFINITY: Internal thread 2 bound to OS proc set {8,20}
OMP: Info #147: KMP_AFFINITY: Internal thread 1 bound to OS proc set {0,12}
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may remove the mkl_set_dynamic(1) which is not required here, since you are already setting the the # of threads to be used by using mkl_set_num_threads(). Also, please include mkl.h.
--Vipin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In previous postby Vipin there was not right suggestionabout using mkl_set_dynamic().
This function is needed if user needs nested parallelizm and allows or not 'soft' or 'hard' threading in MKL
(enables or disables dynamic adjustment of the number of threads).
See MKL doc.
As to the problem:
Please add all needed for the test header files:
stdlib.h for malloc
mkl.h or mkl_service.h for mkl_set_dynamic and mkl_set_num_thread.
After this correction the tests PASSED on requested 4-threads
OMP: Info #147: KMP_AFFINITY: Internal thread 0 bound to OS proc set {0,12}
OMP: Info #147: KMP_AFFINITY: Internal thread 3 bound to OS proc set {8,20}
OMP: Info #147: KMP_AFFINITY: Internal thread 2 bound to OS proc set {8,20}
OMP: Info #147: KMP_AFFINITY: Internal thread 1 bound to OS proc set {0,12}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks !
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Without
So, please add always correct header files and check your test with compiler -Wall option
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page