- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Looks like if you use tasks in one thread and destroyed it after, than next time if you use tasks from other thread you get exception from libiomp5md.dll
Here is code that reproduces it on my system
(Microsoft Windows [Version 6.1.7601],Intel C++ Compiler XE for applications running on IA-32, Version 12.1.0.233 Build 20110811,Microsoft Visual Studio 2010Version 10.0.40219.1 SP1Rel)
[cpp]#include#include int fib ( int n ) { int x,y; if ( n < 2 ) return n; #pragma omp task shared(x) x = fib(n-1); #pragma omp task shared(y) y = fib(n-2); #pragma omp taskwait return x+y; } void fib_fn(int n) { int res; #pragma omp parallel { #pragma omp single res = fib(n); } std::cout << res << std::endl; } int main() { fib_fn(10); for(int i = 0; i < 10; i++) { std::thread th(fib_fn,10); th.join(); } return 0; }[/cpp]
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OpenMP is designed to run from a single thread,principaly the main thread for a console app, but for a Windows app this could be one of the other threads you instantiate.
IOW it is not re-entrant (although within an OpenMP session you can use re-entrant constructs).
Jim Dempsey
IOW it is not re-entrant (although within an OpenMP session you can use re-entrant constructs).
Jim Dempsey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
But everything works fine while using #pragma omp parallel for, only with tasks crash occur.
According to this post
http://software.intel.com/en-us/forums/showpost.php?p=160568
it seems to me that the posted code should work.
According to this post
http://software.intel.com/en-us/forums/showpost.php?p=160568
it seems to me that the posted code should work.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Did you read and understand the other post you referenced?
intmain()
{
fib_fn(10); // will instantiate OpenMP parallel team from main()
for(inti=0;i<10;i++)
{
std::threadth(fib_fn,10); // Instantiates non-OpenMP "main" thread
// ** each thread instantiating seperate "main" thread pool
// ** libiomp5md mayexhibit problems instantiating many thread pools
// ** the above code, on Sandy Bridge would generate11 thread pools each of 8 threads (88 threads)
// ** on IA32 the stack size may be an issue as well as reentrancy issues of libiomp5md.dll
th.join();
}
return0;
}
Jim Dempsey

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