Thrust openMP fails to compile with CUDA 9 or above

Hi, I am building a simple application that uses thrust and OpenMP for host setup and for some reason I am getting the following errors when I try build with CUDA 9 or above:

/usr/local/cuda-9.2/include/thrust/system/omp/detail/sort.inl(120): error: name followed by "::" must be a class or namespace name

/usr/local/cuda-9.2/include/thrust/system/omp/detail/sort.inl(126): error: identifier "decomp" is undefined

/usr/local/cuda-9.2/include/thrust/system/omp/detail/sort.inl(198): error: name followed by "::" must be a class or namespace name

/usr/local/cuda-9.2/include/thrust/system/omp/detail/sort.inl(204): error: identifier "decomp" is undefined

When I build with CUDA 8.0, however, I don’t get the errors. I also tried compiling a very basic program that just includes device_vector.hpp (though using other thrust headers also fails). Here is the code for it:

#include <thrust/version.h>
#include <thrust/device_vector.h>

int main () {}

I am compiling with the following bash script (where the cuda version is set by CUDA_ROOT):

#!/bin/bash -x

CUDA_ROOT=/usr/local/cuda-8.0
CPP=$CUDA_ROOT/bin/nvcc
LDLIBS='-lm -lcudart -lgomp'
THRUST=$CUDA_ROOT/include
LDFLAGS="-L$CUDA_ROOT/lib64 -L$CUDA_ROOT/lib"
CUDA_FLAGS_COMMON='-gencode arch=compute_35,code=sm_35'

$CPP --compiler-options "-Wfatal-errors" $CUDA_FLAGS_COMMON -I$THRUST -I$CUDA_ROOT/include -Xcompiler -fopenmp -DTHRUST_HOST_SYSTEM=THRUST_HOST_SYSTEM_OMP -DTHRUST_DEVICE_SYSTEM=THRUST_DEVICE_SYSTEM_CUDA $LDLIBS $LDFLAGS -o test test.cu

If I take out the -fopenmp and the THRUST_HOST_SYSTEM_OMP I don’t get the compile errors, but I then can’t build the application I’m trying to build since it uses the function

omp_set_num_threads

I have tried this on Windows with VS and Linux with gcc and both seem to be failing for CUDA 9 or above.

I suggest filing a bug. The instructions are linked at the top of the CUDA programming forum.

In case it helps anyone else - this appears to be fixed in 10.1.