UoB-HPC / BabelStream

STREAM, for lots of devices written in many programming models
Other
323 stars 110 forks source link

support NVC++ CUDA compiler #142

Closed jeffhammond closed 1 year ago

jeffhammond commented 2 years ago

NVC++ supports CUDA, although it is not 100% compatible with NVCC due to C++ legalese.

The following is the required source code change for Thrust. I assume the one for CUDA is similar.

There also need to be CMake changes, to add the -cuda flag and recognize -DCMAKE_CUDA_COMPILER=nvc++.

index 3a57ab0..f15a392 100644
--- a/src/thrust/ThrustStream.cu
+++ b/src/thrust/ThrustStream.cu
@@ -145,7 +145,7 @@ T ThrustStream<T>::dot()
 #if THRUST_DEVICE_SYSTEM == THRUST_DEVICE_SYSTEM_CUDA || \
     (defined(THRUST_DEVICE_SYSTEM_HIP) && THRUST_DEVICE_SYSTEM_HIP == THRUST_DEVICE_SYSTEM)

-#ifdef __NVCC__
+#if defined(__NVCC__) || defined(__NVCOMPILER_CUDA__)
 #define IMPL_FN__(fn) cuda ## fn
 #define IMPL_TYPE__(tpe) cuda ## tpe
 #elif defined(__HIP_PLATFORM_HCC__)