- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When using OpenMP I can get the thread num by using:
omp_get_thread_num()
However when using it with MKL the, the command doesn't work. Is there ano MKL command which replaces this?
Thank you,
Raphael
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a simple example how I use it: ... #if ( defined ( _RTPRAGMAOMP_PARALLEL ) ) #pragma omp parallel #endif { RTinumber iId = OmpGetThreadId(); #ifdef _RTMATRIXSETCORE_DIAGNOSTICS CrtPrintf( RTU("ThreadID=%2ld\n"), ( RTINT )iId ); #endif RTiterator i; // VR: Vectorized for( i = iStart[iId]; i < iEnd[iId]; i += 1 ) { ptR = ptA + ptB; } CrtSfence(); } ... Note: OmpGetThreadId is a macro wrapper for omp_get_thread_num function.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>...However when using it with MKL the, the command doesn't work...
OpenMP function omp_get_thread_num() should work in a parallel region(s) and it doesn't matter if MKL is used or not used. Could you post a piece of codes for review?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here is a simple example how I use it: ... #if ( defined ( _RTPRAGMAOMP_PARALLEL ) ) #pragma omp parallel #endif { RTinumber iId = OmpGetThreadId(); #ifdef _RTMATRIXSETCORE_DIAGNOSTICS CrtPrintf( RTU("ThreadID=%2ld\n"), ( RTINT )iId ); #endif RTiterator i; // VR: Vectorized for( i = iStart[iId]; i < iEnd[iId]; i += 1 ) { ptR = ptA + ptB; } CrtSfence(); } ... Note: OmpGetThreadId is a macro wrapper for omp_get_thread_num function.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You may try to use verbose mode to take the OpenMP thread number of the calling thread. pls see MKL User's Guide for details.
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