It it possible to use openMP pragmas in the CUDA-Files (not in the kernel code)?
I will combine gpu and cpu computation. But nvvc compiler fails with "cannot find Unknown option 'openmp' ", if i am linking the porgram with a openmp option (under linux)
A wayaround is to use openMP-statments only in c/c++ files.
I've just found this
http://www.cse.buffalo.edu/faculty/miller/Courses/CSE710/heavner.pdf
Page 25 says:
With gcc: -#include omp.h
Add the -fopenmp
flag
With nvcc, this should be -Xcompiler -fopenmp
as this needs to be passed directly to gcc -Xcompiler passes flags directly to host compiler
Add -lgomp
flag during the linking stage.
I haven't tried it yet...
I tried writing the parameter in "Additional Compiler Options" but it didn't work.
What I did for Visual Studio 2010 and CUDA 4.2:
In Project Properties -> Configuration Properties -> CUDA C/C++ -> Command Line -> Additional Options: -Xcompiler "/openmp"
This resulted in two -Xcompiler parameters in the resulting build command but did not cause any problems and worked successfully.
The solution for the Visual Studio found from the nvidia-forum:
add the '/openmp'-flag to the Extra C++ Options in cuda build rules. I will try the linux solution later.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.