mmp / pbrt-v4

Source code to pbrt, the ray tracer described in the forthcoming 4th edition of the "Physically Based Rendering: From Theory to Implementation" book.
https://pbrt.org
Apache License 2.0
2.75k stars 407 forks source link

Cannot use GPU version on windows #406

Closed RYQ-22 closed 7 months ago

RYQ-22 commented 7 months ago

The CPU version runs normally, but when the "--gpu" flag is added, the program keeps running indefinitely, and the prediction time is shown as "?". My display card is RTX4070. CUDA version: 12.0 OptiX version: 7.5.0 I don't know what the problem is. I noticed a warning: CUDA_ARCHITECTURES is empty for target 'pbrt_lib', but I'm not sure if this is the cause. And I tried CUDA version 11.6, it also did't work.

CMake-GUI Info:

CMake Deprecation Warning at CMakeLists.txt:2 (cmake_policy):
  The OLD behavior for policy CMP0104 will be removed from a future version
  of CMake.

  The cmake-policies(7) manual explains that the OLD behaviors of all
  policies are deprecated and that a policy should be set to OLD only under
  specific short-term circumstances.  Projects should be ported to the NEW
  behavior and not rely on setting a policy to OLD.

Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.22621.
The CXX compiler identification is MSVC 19.36.32534.0
The C compiler identification is MSVC 19.36.32534.0
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working CXX compiler: D:/Visual Studio/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe - skipped
Detecting CXX compile features
Detecting CXX compile features - done
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Check for working C compiler: D:/Visual Studio/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe - skipped
Detecting C compile features
Detecting C compile features - done
OpenEXR at commit: 5cfb5dab6dfada731586b0281bdb15ee75e26782
OpenVDB at commit: 414bed84c2fc22e188eac7b611aa85c7edd7a5a9
Ptex at commit: 4cd8e9a6db2b06e478dfbbd8c26eb6df97f84483
double-conversion at commit: cc1f75a114aca8d2af69f73a5a959aecbab0e87a
filesystem at commit: c5f9de30142453eb3c6fe991e82dfc2583373116
glfw at commit: 4cb36872a5fe448c205d0b46f0e8c8b57530cfe0
libdeflate at commit: 1fd0bea6ca2073c68493632dafc4b1ddda1bcbc3
lodepng at commit: 8c6a9e30576f07bf470ad6f09458a2dcd7a6a84a
qoi at commit: 028c75fd26e5e0758c7c711216c00404994c1ad3
stb at commit: af1a5bc352164740c1cc1354942b1c6b72eacb8a
utf8proc at commit: 2484e2ed5e1d9c19edcccf392a7d9920ad90dfaf
zlib at commit: 54d591eabf9fe0e84c725638f8d5d8d202a093fa
The ASM compiler identification is MSVC
Found assembler: D:/Visual Studio/VC/Tools/MSVC/14.36.32532/bin/Hostx64/x64/cl.exe
Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 
CMake Deprecation Warning at src/ext/zlib/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

Could NOT find Imath (missing: Imath_DIR)
Could NOT find IlmBase (missing: IlmBase_DIR)
Could NOT find OpenEXR (missing: OpenEXR_DIR)
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
Could NOT find OpenEXR: Found unsuitable version "1.6.1", but required is at least "2.3" (found ILMBASE_INCLUDE_PATH-NOTFOUND)
OpenEXR not found; building it from scratch.
Configure ILMBASE Version: 2.5.3 Lib API: 25.0.2
-- WARNING pkg-config generation disabled
Configure OpenEXR Version: 2.5.3 Lib API: 25.0.2
clang-format not found.
CMake Deprecation Warning at src/ext/ptex/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at src/ext/double-conversion/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

CMake Deprecation Warning at src/ext/utf8proc/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 3.5 will be removed from a future version of
  CMake.

  Update the VERSION argument <min> value or use a ...<max> suffix to tell
  CMake that the project does not need compatibility with older versions.

Including Win32 support
Unable to find -lprofiler
CMake Warning (dev) at CMakeLists.txt:167 (find_package):
  Policy CMP0146 is not set: The FindCUDA module is removed.  Run "cmake
  --help-policy CMP0146" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

This warning is for project developers.  Use -Wno-dev to suppress it.

Found CUDA: 12.0.76
The CUDA compiler identification is NVIDIA 12.0.76
Detecting CUDA compiler ABI info
Detecting CUDA compiler ABI info - done
Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.0/bin/nvcc.exe - skipped
Detecting CUDA compile features
Detecting CUDA compile features - done
checkcuda.cu

tmpxft_0000cb94_00000000-10_checkcuda.cudafe1.cpp

  正在创建库 C:\Users\11862\Desktop\vs_code\ACG\pbrt-v4\build\checkcuda.lib 和对象 C:\Users\11862\Desktop\vs_code\ACG\pbrt-v4\build\checkcuda.exp

Detected CUDA Architecture: sm_89
Configuring done (9.8s)
CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
  empty CUDA_ARCHITECTURES not allowed.  Run "cmake --help-policy CMP0104"
  for policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  CUDA_ARCHITECTURES is empty for target "optix.cu".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
  empty CUDA_ARCHITECTURES not allowed.  Run "cmake --help-policy CMP0104"
  for policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  CUDA_ARCHITECTURES is empty for target "optix.cu".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
  empty CUDA_ARCHITECTURES not allowed.  Run "cmake --help-policy CMP0104"
  for policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  CUDA_ARCHITECTURES is empty for target "optix.cu".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
  empty CUDA_ARCHITECTURES not allowed.  Run "cmake --help-policy CMP0104"
  for policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  CUDA_ARCHITECTURES is empty for target "optix.cu".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
  empty CUDA_ARCHITECTURES not allowed.  Run "cmake --help-policy CMP0104"
  for policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  CUDA_ARCHITECTURES is empty for target "pbrt_lib".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
  empty CUDA_ARCHITECTURES not allowed.  Run "cmake --help-policy CMP0104"
  for policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  CUDA_ARCHITECTURES is empty for target "pbrt_lib".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
  empty CUDA_ARCHITECTURES not allowed.  Run "cmake --help-policy CMP0104"
  for policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  CUDA_ARCHITECTURES is empty for target "pbrt_lib".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
  empty CUDA_ARCHITECTURES not allowed.  Run "cmake --help-policy CMP0104"
  for policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  CUDA_ARCHITECTURES is empty for target "pbrt_lib".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
  empty CUDA_ARCHITECTURES not allowed.  Run "cmake --help-policy CMP0104"
  for policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  CUDA_ARCHITECTURES is empty for target "pbrt_lib".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
  empty CUDA_ARCHITECTURES not allowed.  Run "cmake --help-policy CMP0104"
  for policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  CUDA_ARCHITECTURES is empty for target "pbrt_lib".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
  empty CUDA_ARCHITECTURES not allowed.  Run "cmake --help-policy CMP0104"
  for policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  CUDA_ARCHITECTURES is empty for target "pbrt_lib".
This warning is for project developers.  Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt:
  Policy CMP0104 is not set: CMAKE_CUDA_ARCHITECTURES now detected for NVCC,
  empty CUDA_ARCHITECTURES not allowed.  Run "cmake --help-policy CMP0104"
  for policy details.  Use the cmake_policy command to set the policy and
  suppress this warning.

  CUDA_ARCHITECTURES is empty for target "pbrt_lib".
This warning is for project developers.  Use -Wno-dev to suppress it.

Generating done (0.4s)
pbrt4bounty commented 7 months ago

Hi.. this issue is likey the same that this one: https://github.com/mmp/pbrt-v4/issues/402 Try to use a good combination of Optix + CUDA. Here work nicely with CUDA 12.1 + Optix 7.7 Cheers..!

RYQ-22 commented 7 months ago

Hi.. this issue is likey the same that this one: #402 Try to use a good combination of Optix + CUDA. Here work nicely with CUDA 12.1 + Optix 7.7 Cheers..!

I switched to CUDA 12.1 + Optix 7.7, and it is up and running now. The GPU version runs more than 10 times faster than the CPU version (4.7s vs 48.7s). Thanks a lot for helping!