isl-org/Open3D

`stdgpu` target fails the CMake configure step with CUDA 12.4 due to changes in Thrust version header

patrikhuber opened this issue · 1 comments

Checklist

Steps to reproduce the issue

I first cloned Open3D by:

git clone https://github.com/isl-org/Open3D.git
cd Open3D

Then, I build Open3D (on Windows 11 with VS2022, latest MSVC, with CUDA 12.4) with:

mkdir build
cd build
cmake -DBUILD_SHARED_LIBS=OFF -DBUILD_CUDA_MODULE=ON -DBUILD_WEBRTC=OFF ..
# Then Open Visual Studio 2022 and build Open3D (or just the stdgpu target).

Error message

[13/148] Performing configure step for 'ext_stdgpu'
  CMake Error at cmake/Findthrust.cmake:17 (math):
  math cannot parse the expression: "200301 // macro expansion with ##
  requires this to be a single value / 100000": syntax error, unexpected
  exp_DIVIDE (9).
Call Stack (most recent call first):
  src/stdgpu/CMakeLists.txt:7 (find_package)
CMake Error at C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.28/Modules/FindPackageHandleStandardArgs.cmake:230 (message):
    Could NOT find thrust: Found unsuitable version "ERROR.ERROR.ERROR", but
    required is at least "1.9.2" (found C:/Program Files/NVIDIA GPU Computing
    Toolkit/CUDA/v12.4/include)

Open3D, Python and System information

- Operating system: Windows 11 64-bit
- Python version: not applicable
- Open3D version: latest main (8 Apr 2024)
- System architecture: x64
- Is this a remote workstation?: no
- How did you install Open3D?: build from source
- Compiler version (if built from source): Microsoft (R) C/C++ Optimizing Compiler Version 19.39.33523 for x64

Additional information

This error occurs because cmake/Findthrust.cmake extracts the Thrust version from Thrust's header file. In CUDA 12.3 (and presumably earlier), the line in the Thrust header looks like:

#define THRUST_VERSION 200200

And in CUDA 12.4 it is:

#define THRUST_VERSION 200301 // macro expansion with ## requires this to be a single value

Thus, CMake's regexp in cmake/Findthrust.cmake fails as it encounters the unexpected trailing comment on that line.