VS2010 Cuda4RC2: Howto compile OPENMP host code in .cu files? omp pragmas are ignored and a single t

Hi,
I’ve some trouble to get OpenMP running in my current CUDA4RC2 Project. I’m using VS2010 and everything compiles fine and OpenMP is working as expected in all c/cpp files.
Unfortunately the omp pragmas in host code inside .cu files are ignored leading to serialized code.

Therefore I’d like to add some “/openmp” flag somewhere to solve this issue, but the Inet only describes how to use “-Xcompile -fopenmp” for linux systems.

The solution for VS2008 is:
Project Properties > Configuration Properties > CUDA Runtime API > Host > Extra C++ Options
to add /openmp

But VS2010 doesn’t have any “Extra C++ options” Field.

Any Idea?
Thanks, Markus

While I have no idea what openmp is, can’t you just go to project properties -> C++ -> Command line and add /openmp in the “additional” field?

This flag is already set, but the compiler will use the c++ rules for c files (here the openmp pragmas work fine) but not for cu files.
OpenMP is a lightweight API to write multi-threaded code (most machines have multi-core CPUs today). You might want to check it out, as it is easy to learn and can give great benefits.
In my case I want one CPU core to control one GPU (prepare data, launch kernels…) in a multi GPU system. This is the “pre-CUDA4” style to do it.

ah ok, sorry, thought I had the easy fix :p

Pretty new to this all, haven’t even started with CUDA yet :)

This is still unsolved.

Ok, I finally made it…

you need to go to the GPU Computing toolkit folder where the used nvcc.exe resides.
e.g.: C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.0\bin

there is a file “nvcc.pofile” -> open it with oyur favorite editor

add an additional “/openmp” (I included the “”, while not beeing 100% sure if required) right before the $(SPACE) at the end of the INCLUDES Variable.

This sould activate openMP support in .cu files.

Here are some buzzwords that should just help ppl. searching for this issue to find this posting:
VS2010 Visual Studio 2010 openMP omp cuda host code multi-gpu multigpu cu cpp compile nvcc Extra C++ Options VS2008 2008 omp_get_num_threads num_threads

@nvidia: can you fix this or add an option inside VS2010?

Thank you MKasper… for such enlightening help!!
You saved me and my code!!!