NVIDIA / gvdb-voxels

Sparse volume compute and rendering on NVIDIA GPUs
Other
672 stars 144 forks source link

Build errors with latest version of GVDB #116

Closed TricksterByte closed 3 years ago

TricksterByte commented 3 years ago

Hey, Neil (or anyone else who can help me with this) -

So, a while back (think around Sep - Oct 2020) I downloaded GVDB and was able to build it and its samples successfully after circumventing some issues with paths to cuda.lib and whatnot (so definitely sometime before dbd4f6e).

Today, I downloaded the latest version but can't get it up and running. Using CUDA Toolkit 11.2 & OptiX SDK 6.5.0 (relevant, I guess, as I was trying to build gFluidSurface).

I've tried generating the project with both CMake 3.19 (which warned me regarding CMAKE_CUDA_ARCHITECTURES now being detected and empty CUDA_ARCHITECTURES not being allowed) and, although (from what I've gathered) there's default behavior to handle those situations, I also tried CMake 3.17. Both generate the project successfully (they're able to find all dependencies) but neither project builds.

I did update Visual Studio to v16.9.3 recently, so I wonder if that might be the cause of my problems? Previous to that I was running, at most, v16.7.x.

In general, from browsing the projects' properties, they seem to be configured properly, so I can't exaclty pinpoint the cause of any of the errors. I apology first-hand for the huge wall of text:

C:\dev\gvdb-voxels\source\gvdb_library\kernels\cuda_gvdb_raycast.cuh(286): error : calling a __host__ function("__ceilf") from a __device__ function("raySurfaceTrilinearBrick") is not allowed

C:\dev\gvdb-voxels\source\gvdb_library\kernels\cuda_gvdb_raycast.cuh(286): error : identifier "__ceilf" is undefined in device code

C:\dev\gvdb-voxels\source\gvdb_library\kernels\cuda_gvdb_raycast.cuh(395): error : calling a __host__ function("__ceilf") from a __device__ function("rayLevelSetBrick") is not allowed

C:\dev\gvdb-voxels\source\gvdb_library\kernels\cuda_gvdb_raycast.cuh(395): error : identifier "__ceilf" is undefined in device code

C:\dev\gvdb-voxels\source\gvdb_library\kernels\cuda_gvdb_raycast.cuh(490): error : calling a __host__ function("__ceilf") from a __device__ function("rayDeepBrick") is not allowed

C:\dev\gvdb-voxels\source\gvdb_library\kernels\cuda_gvdb_raycast.cuh(490): error : identifier "__ceilf" is undefined in device code

C:\dev\gvdb-voxels\source\gvdb_library\kernels\cuda_gvdb_particles.cuh(324): error : calling a __host__ function("__ceilf") from a __global__ function("gvdbFindActivBricks") is not allowed

C:\dev\gvdb-voxels\source\gvdb_library\kernels\cuda_gvdb_particles.cuh(324): error : identifier "__ceilf" is undefined in device code

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\cmath(68): error : calling a __host__ function("__ceilf") from a __global__ function("gvdbFindActivBricks") is not allowed

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\cmath(68): error : identifier "__ceilf" is undefined in device code

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\cmath(68): error : calling a __host__ function("__ceilf") from a __global__ function("gvdbFindActivBricks") is not allowed

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\cmath(68): error : identifier "__ceilf" is undefined in device code

C:\dev\gvdb-voxels\source\gvdb_library\kernels\cuda_gvdb_particles.cuh(375): error : calling a __host__ function("__ceilf") from a __global__ function("gvdbCalcBrickId") is not allowed

C:\dev\gvdb-voxels\source\gvdb_library\kernels\cuda_gvdb_particles.cuh(375): error : identifier "__ceilf" is undefined in device code

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\cmath(68): error : calling a __host__ function("__ceilf") from a __global__ function("gvdbCalcBrickId") is not allowed

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\cmath(68): error : identifier "__ceilf" is undefined in device code

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\cmath(68): error : calling a __host__ function("__ceilf") from a __global__ function("gvdbCalcBrickId") is not allowed

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\cmath(68): error : identifier "__ceilf" is undefined in device code

C:\dev\gvdb-voxels\source\gvdb_library\kernels\cuda_gvdb_particles.cuh(402): error : calling a __host__ function("__ceilf") from a __global__ function("gvdbCalcIncreBrickId") is not allowed

C:\dev\gvdb-voxels\source\gvdb_library\kernels\cuda_gvdb_particles.cuh(402): error : identifier "__ceilf" is undefined in device code

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\cmath(68): error : calling a __host__ function("__ceilf") from a __global__ function("gvdbCalcIncreBrickId") is not allowed

C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\include\cmath(68): error : identifier "__ceilf" is undefined in device code

These are just some of them as well. Most files seem to be missing links one way or another. I'm at a loss on what to do so I would appreciate any kind of help! Thanks in advance.

NBickford-NV commented 3 years ago

Hi TricksterByte! This is interesting - my guess is that it's coming from our use of ceil in https://github.com/NVIDIA/gvdb-voxels/blob/63a7220a659f1ef95cdac3c50022074990e7ab07/source/gvdb_library/kernels/cuda_gvdb_particles.cuh#L78, but I'm not sure why this is causing errors. Changing ceil to ceilf should fix it, though! Looking at recent posts about ceilf, this seems to be a MSVC and CUDA 11.2 thing (see https://trac.ffmpeg.org/ticket/9150), but I bet https://github.com/microsoft/STL/commit/26bbe2ad50cd7003b8220cfec2bff16dbc032ca8#diff-3fa97ceb95d524432661f01d4b34509c6d261a2f7f45ddcf26f79f55b3eec88aR63 might also have something to do with it (switching ceil to `ceilfinstead ofceilf`, which would go to the CUDA function). I'll follow up with a fix and as to why this is.

NBickford-NV commented 3 years ago

OK, looks like this is an issue with MSVC toolset v14.28 (issue was not in v14.27) combined with CUDA, and we're already working with Microsoft on this! Forcing --msvc_toolset=14.27 in the build command should work around it with the current version, and I'll have a workaround (replacing instances of ceil with ceilf) in GVDB soon.

NBickford-NV commented 3 years ago

OK, should be fixed in https://github.com/NVIDIA/gvdb-voxels/commit/8e338faad40cea466dc03df1b8b555a34bd645b9 now. Thanks for the report!

TricksterByte commented 3 years ago

OK, looks like this is an issue with MSVC toolset v14.28 (issue was not in v14.27) combined with CUDA, and we're already working with Microsoft on this! Forcing --msvc_toolset=14.27 in the build command should work around it with the current version, and I'll have a workaround (replacing instances of ceil with ceilf) in GVDB soon.

Aah, thank you! I did get it to work by forcing that specific toolset.

TricksterByte commented 3 years ago

And again, thank you for the quick fix! Much appreciated!