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.
OpenMP is mostly famous for shared memory multiprocessing programming. MPI is mostly famous for message-passing multiprocessing programming. CUDA technology is mostly famous for GPGPU computing and parallelising tasks in Nvidia GPUs.
The OpenMP program (C, C++ or Fortran) with device constructs is fed into the High-Level Optimizer and partitioned into the CPU and GPU parts. The intermediate code is optimized by High-level Optimizer. Note that such optimization benefits both code for CPU as well as GPU.
Enable OpenMPRight-click on your project in Solution Explorer, and select properties. Select C/C++ -> Language, and change OpenMP Support to Yes. Click ok, and make sure your application still compiles and runs.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With