visual studio 2008 and intel C++ 11.1.038 is combined to develope my parallel programme.
when the #pragma omp task is used, the runtime error "cannot find the 191 in libiomp5md.dll" appears.
I check the option in the project properties. the C/C++->language->openmp support display
"enable openmp2.0 lanuage extensions" . I wonder whereI can find the option "enable openmp3.0 lanuage extensions"
int fib(int n)
int i, j;
#pragma omp task shared(i) firstprivate(n)
#pragma omp task shared(j) firstprivate(n)
#pragma omp taskwait
int main(int argc, char* argv)
int n = 10;
#pragma omp parallel shared(n)
#pragma omp single
printf ("fib(%d) = %d\n", n, fib(n));
I have some comments on your code:
the firstprivate(n) is not necessary. Variables that are private in the enclosing scope of a task constructs are automatically promoted to be firstprivate. In your case, n is a private variable (it is located on the function's call stack, which is private with respect to the parallel region). Hence, n is automatically private.
Other than that, your example looks OK to me. What's the problem with it?
Runtime problem is unrelated to 11.1.038 compiler. Most probably you have some older compiler version which doesn't support OpenMP 3.0 in your path, like some 10.1 compiler. To fix the problem you need to launch Microsoft Visual Studio from environment set for Intel 11.1.038 compiler. E.g. run Intel Compiler 11.1.038 command line environment batch, and then run devenv.exe from this environment.
If you want some more details: when Intel compiler embeds itself into Microsoft Visual Studio it allows the IDE to use its environment during build phase of the project. But it does NOT allow using its environment during run phase. I don't know the reason of such behavior, but the reality is that in order to run OpenMP programs compiled by Intel compiler from inside the Microsoft Visual Studio IDE you need to set Intel compiler environment BEFORE launching the IDE. Thus you will allow using proper Intel compiler environment at application run phase.
Hope this helps.