- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi people,
I am struggling with the threading of SGEMM in MKL called from C++. I am working on a rather big software that is parallelized with OpenMP. In one of the functions, I first set up matrices A (14000,1300) and B (1300,14000) within an OpenMP loop, and then want to calculate the product.
#pragma openmp parallel for
for (.....){ fill A,B }
C=prod(A,B);
prod() is supposed to call SGEMM. I also tried cblas_sgemm directly. In both cases, SGEMM is executed on one thread only, even though in other parts of the code, MKL calls to LAPACK are threaded. Any idea of why it switches to serial here?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Bjoern,
pls try to set mkl_set_num_threads( #num of cores on your system ) before C=prod(A,B).
What would you see in then case?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Gennady,
turns out it was not a problem with MKL but with cmake caused linking of both GSL and MKL cblas, and the overloaded prod() took SGEMM from GSL...
I have another question regarding parallelization: Currently I have a construction:
#pragma omp parallel for
for ( int i =0 , i < mtot; i++) {
B = ub::prod(A, B[ i ]);
}
Is it advisable to do this? Will every OMP thread try to execute a threaded prod()? Then I assume that means threads getting into conflict. In my case, A is 2700x2700 and each B 2700x2300 matrix.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page