Build setup without warnings from nvcc on Windows 10/VS2015/CUDA8-9

Hi,

I have a question regarding my build setup, I’m currently working on Ubuntu 16.04 and Windows 10 and use CUDA 9 in both cases, Visual Studio 2015 on Windows and gcc-5 on Linux.
The project setup in both cases is done using cmake and I have the following problem.
On Linux, a complete rebuild takes about 1:30min, just building after changing a kernel takes a few seconds.
On Windows on the other hand, a rebuild takes more than 4 min and building after a kernel takes more than a minute, if not more.

Also, on Linux I only get compiler console output specific to my application, but on Windows I get thousands of warnings aimed at stuff in the cuda libraries, like

c:\program files\nvidia gpu computing toolkit\cuda\v9.0\include\sm_20_intrinsics.h(1490): warning C4514: ‘syncthreads_or’: unreferenced inline function has been removed

1>c:\program files\nvidia gpu computing toolkit\cuda\v9.0\include\sm_60_atomic_functions.h(394): warning C4514: ‘atomicMin_system’: unreferenced inline function has been removed

c:\program files\nvidia gpu computing toolkit\cuda\v9.0\include\thrust\system\cuda\detail\cub\device\dispatch../…/agent/agent_radix_sort_downsweep.cuh(39): warning C4464: relative include path contains ‘…’

to name a few.
Thousands of these warnings.

I guess that I did something wrong with my configuration on Windows and that the extra long build times are linked to these warnings, but I only have found the option to limit the warnings generated by the C++ compiler in Visual Studio, but haven’t found the option for nvcc.

Anyone knows what I can do here? Thanks very much in advance! :)

Start stomping out the warnings? For CMake, you would do something like

if(MSVC)
  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4464")
endif()

That would ignore the path contains .. warning. Some of those warnings seem rather intimidating though. I don’t have a Windows or CUDA installed on it, but maybe start ignoring the warnings that seem benign (like path contains …).

Part of the reason your build takes so much longer is all of the warnings getting spit out. Another part is because its Windows.

(sorry for the double tap, my browser glitched out)

Thanks very much, that helps a lot.
Was just wondering why I get so many warning from the library that don’t have anything to do with my code, and then only get these warnings on Windows, but not Linux.

Thanks again very much :)

You should think of them as “deferred” warnings. Your code is ultimately what triggered it, but the actual warning is in the NVIDIA code. A couple more things that may help reduce the numbers of warnings you get with CMake:

# disables many warnings
list(APPEND CUDA_NVCC_FLAGS "-Wno-deprecated-gpu-targets")

# Sometimes you do not want this next one, but in my experience you generally do
set(CUDA_PROPAGATE_HOST_FLAGS ON)  # Inherit CMAKE_CXX_FLAGS from host compiler

Another thing you can use is explicitly specifying which architectures you care to build. My personal recipe looks like this:

# By using CACHE STRING, this allows users / parent projects to override if they like
# Using `YOURPROJ` as a prefix (shortname for your project) is a good CMake practice,
# it lets you / users / parent projects know where the variable came from
#
# Lists in CMake are delineated with semicolons (;), which is what enables the
# foreach below
set(YOURPROJ_BUILD_CUDA_ARCH "30;32;35;50;52;53" CACHE STRING
    "CUDA Architectures to build, default: 30;32;35;50;52;53")

# Add the compilation trajectories for different architectures.
# See: http://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#nvcc-examples
# I have no specific need for complicated build trajectories.
foreach(arch ${YOURPROJ_BUILD_CUDA_ARCH})
  # virtually real
  list(APPEND CUDA_NVCC_FLAGS "--generate-code arch=compute_${arch},code=sm_${arch}")
  # virtually virtual
  list(APPEND CUDA_NVCC_FLAGS "--generate-code arch=compute_${arch},code=compute_${arch}")
endforeach()

I don’t recall exactly what cuda_add_library does when the architectures are not specified. I think it just generates them all?

I think there are now versions higher than 53 but I haven’t gone through to update my build scripts yet since I only have sm_35 devices available to me :S