Unable to build vtkAcceleratorsVTKm with CUDA using VTK Release on Visual Studio 2015 / Windows 10

I am getting the following output/error in Visual Studio 2015 when trying to build the vtkAcceleratorsVTKm project generated by cmake:

90> D:\VTK_build\Accelerators\Vtkm>“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin\nvcc.exe” -ccbin “C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\x86_amd64” -x cu -I"D:\VTK_build\Accelerators\Vtkm" -I"D:\VTK\Accelerators\Vtkm" -I"D:\VTK_build\Common\Core" -I"D:\VTK\Common\Core" -I"D:\VTK_build\Utilities\KWIML" -I"D:\VTK\Utilities\KWIML" -I"D:\VTK_build\Utilities\KWSys" -I"D:\VTK\Utilities\KWSys" -I"D:\VTK_build\ThirdParty\utf8" -I"D:\VTK\ThirdParty\utf8" -I"D:\VTK_build\Common\DataModel" -I"D:\VTK\Common\DataModel" -I"D:\VTK_build\Common\Math" -I"D:\VTK\Common\Math" -I"D:\VTK_build\Common\Misc" -I"D:\VTK\Common\Misc" -I"D:\VTK_build\Common\System" -I"D:\VTK\Common\System" -I"D:\VTK_build\Common\Transforms" -I"D:\VTK\Common\Transforms" -I"D:\VTK_build\Common\ExecutionModel" -I"D:\VTK\Common\ExecutionModel" -I"D:\VTK_build\Filters\General" -I"D:\VTK\Filters\General" -I"D:\VTK_build\Common\ComputationalGeometry" -I"D:\VTK\Common\ComputationalGeometry" -I"D:\VTK_build\Filters\Core" -I"D:\VTK\Filters\Core" -I"D:\VTK_build\Filters\Geometry" -I"D:\VTK\Filters\Geometry" -I"D:\VTK_build\Imaging\Core" -I"D:\VTK\Imaging\Core" -I"D:\VTK_build\ThirdParty\vtkm" -I"D:\VTK\ThirdParty\vtkm" -I"D:\VTK\ThirdParty\vtkm\vtk-m" -I"D:\VTK_build\ThirdParty\vtkm\vtk-m\include" -I"D:\VTK\ThirdParty\vtkm\vtk-m\vtkm\thirdparty\diy" -I"D:\VTK_build\ThirdParty\vtkm\vtk-m\vtkm\thirdparty\diy" -I"D:\VTK\ThirdParty\vtkm\vtk-m\vtkm\thirdparty\taotuple" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\bin…\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0\include" --keep-dir x64\Release -maxrregcount=0 --machine 64 --compile -Xnvlink -w -Xcudafe --diag_suppress=extra_semicolon -wd4702 -wd4512 -wd4510 --expt-relaxed-constexpr -Xcompiler="/EHsc -Ob2 /bigobj" -D_WINDOWS -DNDEBUG -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -DVTK_IN_VTK -D"CMAKE_INTDIR=“Release”" -DvtkAcceleratorsVTKm_EXPORTS -DWIN32 -D_WINDOWS -DNDEBUG -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -DVTK_IN_VTK -D"CMAKE_INTDIR=“Release”" -DvtkAcceleratorsVTKm_EXPORTS -D_WINDLL -D_MBCS -Xcompiler “/EHsc /W3 /nologo /O2 /FS /Zi /MD /GR” -o vtkAcceleratorsVTKm.dir\Release\vtkmAverageToCells.obj “D:\VTK\Accelerators\Vtkm\vtkmAverageToCells.cu” -clean
85>Execution of the MSBuild task completed.
90> nvcc fatal : Unknown option ‘wd4702’

Does anyone know how to fix this?


@RobertMaynard Looks like we’re applying MSVC options to CUDA files as well. Should they be turned into source file properties instead of target defines?

The msvc flags should be wrapped in -XCompiler, generally through using a generator expression.


if(TARGET vtkm::cuda)
    target_compile_options(<target> INTERFACE $<$<COMPILE_LANGUAGE:CUDA>:-Xcompiler=-wd4512,-wd4510>)

$<COMPILE_LANGUAGE> support for VS gated behind CMake 3.11. Do we care about that?

VTK-m will error out if using MSVC Generator and you don’t have 3.11. So VTK can use the same logic

@ben.boeckel Did you get a fix into VTK for this?

Wasn’t aware you were expecting me to do it. MR is here: https://gitlab.kitware.com/vtk/vtk/merge_requests/5154

The latest commits, seem to have fixed the previous problem. But now, when I try to configure the project with cmake (3.14.0), I get the following error:

CMake Error at Accelerators/Vtkm/CMakeLists.txt:118 (get_property):
      INTERFACE_LIBRARY targets may only have whitelisted properties. The
      property "VTKm_CUDA_Architecture_Flags" is not allowed.

@RobertMaynard Is there something else to do if/when vtkm::cuda is an interface target? Why would it be INTERFACE?

@Shan @ben.boeckel

So in VTK-m master the vtkm::cuda target was converted over to be an interface target instead of an imported target. This was done to fix issues we had with getting the Visual Studio CUDA integration to work properly ( spaces in path issue ).

Currently VTK is using a version of VTK-m that doesn’t have these changes, but if you build VTK with VTK-m master you will need to update the Accelerators/Vtkm/CMakeLists.txt to pull the INTERFACE_CUDA_Architecture_Flags target property.

I have the same issue on VTK master, using ArchLinux.

@mwestphal The issue with INTERFACE_CUDA_Architecture_Flags? Is your vtk-m submodule up to date?

It wasn’t, sorry about the noise.