- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think this is an mkl bug:
I don't set OMP_NUM_THREADS
My code uses the omp_set_num_threads()
It seems though that unless OMP_NUM_THREADS is set to something at the beggining of the program it won't honor any future calls to omp_set_num_threads()
Now, if I take out the call to the MKL function, the plain openmp for loop will actually be parallelized well.
[jpuig@altix jpuig]$ export -n OMP_NUM_THREADS
[jpuig@altix jpuig]$ ./a.out
Elapsed time: 1.8064 - 1 threads loop ratio:1
Elapsed time: 1.79981 - 2 threads loop ratio:0.996353
Elapsed time: 1.85461 - 3 threads loop ratio:1.02669
Elapsed time: 1.82016 - 4 threads loop ratio:1.00762
[jpuig@altix jpuig]$ export OMP_NUM_THREADS=4
[jpuig@altix jpuig]$ ./a.out
Elapsed time: 1.84285 - 1 threads loop ratio:1
Elapsed time: 0.929641 - 2 threads loop ratio:0.504457
Elapsed time: 0.62401 - 3 threads loop ratio:0.338611
Elapsed time: 0.476085 - 4 threads loop ratio:0.258341
[jpuig@altix jpuig]$
I don't set OMP_NUM_THREADS
My code uses the omp_set_num_threads()
It seems though that unless OMP_NUM_THREADS is set to something at the beggining of the program it won't honor any future calls to omp_set_num_threads()
Now, if I take out the call to the MKL function, the plain openmp for loop will actually be parallelized well.
[jpuig@altix jpuig]$ export -n OMP_NUM_THREADS
[jpuig@altix jpuig]$ ./a.out
Elapsed time: 1.8064 - 1 threads loop ratio:1
Elapsed time: 1.79981 - 2 threads loop ratio:0.996353
Elapsed time: 1.85461 - 3 threads loop ratio:1.02669
Elapsed time: 1.82016 - 4 threads loop ratio:1.00762
[jpuig@altix jpuig]$ export OMP_NUM_THREADS=4
[jpuig@altix jpuig]$ ./a.out
Elapsed time: 1.84285 - 1 threads loop ratio:1
Elapsed time: 0.929641 - 2 threads loop ratio:0.504457
Elapsed time: 0.62401 - 3 threads loop ratio:0.338611
Elapsed time: 0.476085 - 4 threads loop ratio:0.258341
[jpuig@altix jpuig]$
Link Copied
0 Replies
Reply
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