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.9k stars 461 forks source link

GPU Build issue #402

Open YouthImagination opened 1 year ago

YouthImagination commented 1 year ago

When I build pbrt-v4 with gpu, I got an error in line 40

40>------ Rebuild All started: Project: pbrt_embedded_ptx_lib, Configuration: Release x64 ------
36>ImfCompressor.cpp
40>Embedding PTX generated from src/pbrt/gpu/optix.cu
36>ImfRleCompressor.cpp
36>D:\Codes\pbrt-v4\src\ext\openexr\OpenEXR\IlmImf\ImfRleCompressor.cpp(1,1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
36>ImfZipCompressor.cpp
36>D:\Codes\pbrt-v4\src\ext\openexr\OpenEXR\IlmImf\ImfZipCompressor.cpp(1,1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
36>ImfPizCompressor.cpp
36>D:\Codes\pbrt-v4\src\ext\openexr\OpenEXR\IlmImf\ImfPizCompressor.cpp(1,1): warning C4819: The file contains a character that cannot be represented in the current code page (936). Save the file in Unicode format to prevent data loss
36>ImfB44Compressor.cpp
36>ImfDwaCompressor.cpp
40>Building Custom Rule D:/Codes/pbrt-v4/CMakeLists.txt
40>optix.cu.ptx_embedded.c
37>Compiling...
36>ImfMisc.cpp
37>testShear.cpp
37>testTinySVD.cpp
36>ImfCompressionAttribute.cpp
36>ImfDoubleAttribute.cpp
37>testVec.cpp
36>ImfConvert.cpp
37>Generating Code...
36>ImfPreviewImage.cpp
36>ImfPreviewImageAttribute.cpp
37>ImathTest.vcxproj -> D:\Codes\pbrt-v4\build\bin\Release\ImathTest.exe
37>Done building project "ImathTest.vcxproj".
36>ImfVersion.cpp
36>ImfChromaticities.cpp
40>LINK : fatal error LNK1181: cannot open input file 'D:\Codes\pbrt-v4\build\optix.cu.dir\Release\optix.cu.lib'
40>Done building project "pbrt_embedded_ptx_lib.vcxproj" -- FAILED.

I find optix.cu generate optix.ptx. AndI already Add Architecture in CMakeLists

if(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)
   set(CMAKE_CUDA_ARCHITECTURES "75")
endif(NOT DEFINED CMAKE_CUDA_ARCHITECTURES)

And CMake-GUI Info

Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
The CXX compiler identification is MSVC 19.29.30148.0
The C compiler identification is MSVC 19.29.30148.0
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working CXX compiler: D:/software/Visual Studio/VS2019/VC/Tools/MSVC/14.29.30133/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:/software/Visual Studio/VS2019/VC/Tools/MSVC/14.29.30133/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:/software/Visual Studio/VS2019/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe
CMake Warning at cmake/FindOpenEXR.cmake:47 (find_package):
  Could not find a configuration file for package "OpenEXR" that is
  compatible with requested version "2.3".

  The following configuration files were considered but not accepted:

    D:/software/vips/lib/cmake/OpenEXR/OpenEXRConfig.cmake, version: 3.1.3

Call Stack (most recent call first):
  src/ext/CMakeLists.txt:60 (find_package)

Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
Could NOT find OpenEXR (missing: ILMBASE_INCLUDE_PATH OPENEXR_IMATH_LIBRARY OPENEXR_ILMIMF_LIBRARY OPENEXR_IEX_LIBRARY OPENEXR_HALF_LIBRARY) (found suitable version "3.1.3", minimum required is "2.3")
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 < 2.8.12 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
Found CUDA: 11.4.120
The CUDA compiler identification is NVIDIA 11.4.120
Detecting CUDA compiler ABI info
Detecting CUDA compiler ABI info - done
Check for working CUDA compiler: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.4/bin/nvcc.exe - skipped
Detecting CUDA compile features
Detecting CUDA compile features - done
checkcuda.cu

  正在创建库 D:\Codes\pbrt-v4\build\checkcuda.lib 和对象 D:\Codes\pbrt-v4\build\checkcuda.exp

Detected CUDA Architecture: sm_75
Configuring done
Generating done

I don't know what the problem is. By the way, I use Cuda 11.4 and Optix 7.5.

pbrt4bounty commented 1 year ago

Hi.. The problem seems that is the newest version of the EXR library:

 The following configuration files were considered but not accepted:

    D:/software/vips/lib/cmake/OpenEXR/OpenEXRConfig.cmake, version: 3.1.3

You need to disable the find_package() and use the included EXR files instead

YouthImagination commented 1 year ago

Thanks to reply. But it doesn't seem to work for me. I specify OpenEXR version and re-cmake.

Selecting Windows SDK version 10.0.22621.0 to target Windows 10.0.19045.
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
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
Found OpenEXR version 2.5.0
CMake Deprecation Warning at src/ext/ptex/CMakeLists.txt:1 (cmake_minimum_required):
  Compatibility with CMake < 2.8.12 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
Found CUDA: 11.4.120
checkcuda.cu

  正在创建库 D:\Codes\pbrt-v4\build\checkcuda.lib 和对象 D:\Codes\pbrt-v4\build\checkcuda.exp

Detected CUDA Architecture: sm_75
Configuring done
Generating done

But I got same error:

10>Ptex_static.vcxproj -> D:\Codes\pbrt-v4\build\src\ext\ptex\src\ptex\Release\Ptex.lib
26>------ Build started: Project: ptxinfo, Configuration: Release x64 ------
27>------ Build started: Project: rtest, Configuration: Release x64 ------
28>------ Build started: Project: wtest, Configuration: Release x64 ------
29>------ Build started: Project: ftest, Configuration: Release x64 ------
30>------ Build started: Project: halftest, Configuration: Release x64 ------
27>Building Custom Rule D:/Codes/pbrt-v4/src/ext/ptex/src/tests/CMakeLists.txt
26>Building Custom Rule D:/Codes/pbrt-v4/src/ext/ptex/src/utils/CMakeLists.txt
29>Building Custom Rule D:/Codes/pbrt-v4/src/ext/ptex/src/tests/CMakeLists.txt
28>Building Custom Rule D:/Codes/pbrt-v4/src/ext/ptex/src/tests/CMakeLists.txt
26>ptxinfo.cpp
28>wtest.cpp
27>rtest.cpp
15>cctest.vcxproj -> D:\Codes\pbrt-v4\build\src\ext\double-conversion\test\cctest\Release\cctest.exe
29>ftest.cpp
28>wtest.vcxproj -> D:\Codes\pbrt-v4\build\src\ext\ptex\src\tests\Release\wtest.exe
27>rtest.vcxproj -> D:\Codes\pbrt-v4\build\src\ext\ptex\src\tests\Release\rtest.exe
17>Generating rgbspectrum_rec2020.cpp
17>Optimizing REC2020 spectra...
30>Building Custom Rule D:/Codes/pbrt-v4/src/ext/ptex/src/tests/CMakeLists.txt
26>ptxinfo.vcxproj -> D:\Codes\pbrt-v4\build\src\ext\ptex\src\utils\Release\ptxinfo.exe
29>ftest.vcxproj -> D:\Codes\pbrt-v4\build\src\ext\ptex\src\tests\Release\ftest.exe
30>halftest.cpp
30>halftest.vcxproj -> D:\Codes\pbrt-v4\build\src\ext\ptex\src\tests\Release\halftest.exe
16>optix.cu
16>Done building project "optix.cu.vcxproj".
31>------ Build started: Project: pbrt_embedded_ptx_lib, Configuration: Release x64 ------
31>Embedding PTX generated from src/pbrt/gpu/optix.cu
31>Building Custom Rule D:/Codes/pbrt-v4/CMakeLists.txt
31>optix.cu.ptx_embedded.c
17>Generating rgbspectrum_aces.cpp
17>Optimizing ACES2065_1 spectra...
31>LINK : fatal error LNK1181: cannot open input file 'D:\Codes\pbrt-v4\build\optix.cu.dir\Release\optix.cu.lib'
31>Done building project "pbrt_embedded_ptx_lib.vcxproj" -- FAILED.

my display card is GTX1660TI, driver version is latest (546.17). Is that problem?

pbrt4bounty commented 1 year ago

What Optix version you use?

YouthImagination commented 1 year ago

Optix 7.5 and Cuda 11.4. I also try Optix 7.3, still not work

pbrt4bounty commented 12 months ago

FYI.. https://github.com/mmp/pbrt-v4/issues/406 Cheers..!

YouthImagination commented 11 months ago

Unfortunately, it doesn't work for me. I re-pull code and re-build all, but I still got same error. I used Cuda 12.1, optix 7.7, openexr 2.5.3 and cmake 3.20.2

16>Done building project "optix.cu.vcxproj".
31>------ Build started: Project: pbrt_embedded_ptx_lib, Configuration: Release x64 ------
31>Embedding PTX generated from src/pbrt/gpu/optix.cu
31>Building Custom Rule D:/Codes/pbrt-v4/CMakeLists.txt
31>optix.cu.ptx_embedded.c
17>Generating rgbspectrum_aces.cpp
17>Optimizing ACES2065_1 spectra...
31>LINK : fatal error LNK1181: cannot open input file 'D:\Codes\pbrt-v4\build\optix.cu.dir\Release\optix.cu.lib'
31>Done building project "pbrt_embedded_ptx_lib.vcxproj" -- FAILED.