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.89k stars 457 forks source link

Compiling Error aggregate.cpp with optix7 and NVCC 12.5 and GCC 11.4 in Ubuntu 22.04 #432

Closed penguinflys closed 4 months ago

penguinflys commented 4 months ago

Got error at compiling aggregate.cpp.o, details please check logs.

Device info:

03:04:51 jyuan@jyuan-MS-7D53 build ±|master ✗|→ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2024 NVIDIA Corporation
Built on Thu_Jun__6_02:18:23_PDT_2024
Cuda compilation tools, release 12.5, V12.5.82
Build cuda_12.5.r12.5/compiler.34385749_0
03:05:04 jyuan@jyuan-MS-7D53 build ±|master ✗|→ which nvcc
/usr/local/cuda/bin/nvcc
03:05:09 jyuan@jyuan-MS-7D53 build ±|master ✗|→ which gcc
/usr/bin/gcc
03:05:36 jyuan@jyuan-MS-7D53 build ±|master ✗|→ gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Configure Log with 3 Test Fails HAVE__ALIGNED_MALLOC HAVE_DECLSPEC_NOINLINE and INT64_IS_OWN_TYPE which seem irrelevant:

03:10:23 jyuan@jyuan-MS-7D53 build ±|master ✗|→ cmake ..
-- The CXX compiler identification is GNU 11.4.0
-- The C compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - 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: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Setting build type to 'Release' as none was specified.
-- Found Git: /usr/bin/git (found version "2.34.1") 
-- 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
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
-- Found OpenGL: /usr/lib/x86_64-linux-gnu/libOpenGL.so   
-- The ASM compiler identification is GNU
-- Found assembler: /usr/bin/cc
CMake Warning (dev) at src/ext/libdeflate/CMakeLists.txt:12 (option):
  Policy CMP0077 is not set: option() honors normal variables.  Run "cmake
  --help-policy CMP0077" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  For compatibility with older versions of CMake, option is clearing the
  normal variable 'BUILD_SHARED_LIBS'.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Performing Test DEFLATE_LINT_WALL
-- Performing Test DEFLATE_LINT_WALL - Success
-- Performing Test DEFLATE_LINT_WUNDEF
-- Performing Test DEFLATE_LINT_WUNDEF - Success
-- Performing Test DEFLATE_LINT_PEDANTIC
-- Performing Test DEFLATE_LINT_PEDANTIC - Success
-- Performing Test DEFLATE_LINT_DECLARATION_AFTER_STATEMENT
-- Performing Test DEFLATE_LINT_DECLARATION_AFTER_STATEMENT - Success
-- Performing Test DEFLATE_LINT_MISSING_PROTOTYPES
-- Performing Test DEFLATE_LINT_MISSING_PROTOTYPES - Success
-- Performing Test DEFLATE_LINT_STRICT_PROTOTYPES
-- Performing Test DEFLATE_LINT_STRICT_PROTOTYPES - Success
-- Performing Test DEFLATE_LINT_VLA
-- Performing Test DEFLATE_LINT_VLA - Success
-- Performing Test DEFLATE_LINT_IMPLICIT_FALLTHROUGH
-- Performing Test DEFLATE_LINT_IMPLICIT_FALLTHROUGH - Success
-- Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version "1.2.11") 
-- Could NOT find Imath (missing: Imath_DIR)
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.2") 
-- Found OpenEXR: /usr/include (found suitable version "2.5.7", minimum required is "2.3") 
-- Found OpenEXR version 2.5.7
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.

-- Found Doxygen: /usr/bin/doxygen (found version "1.9.1") found components: doxygen dot 
-- Including X11 support
-- Found X11: /usr/include   
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Unable to find -lprofiler
-- Looking for a CUDA compiler
-- Looking for a CUDA compiler - /usr/local/cuda/bin/nvcc
-- Found CUDA: /usr/local/cuda (found version "12.5") 
-- Found CUDA: 12.5.82
-- The CUDA compiler identification is NVIDIA 12.5.82
-- Detecting CUDA compiler ABI info
-- Detecting CUDA compiler ABI info - done
-- Check for working CUDA compiler: /usr/local/cuda/bin/nvcc - skipped
-- Detecting CUDA compile features
-- Detecting CUDA compile features - done
-- Detected CUDA Architecture: sm_89
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE
-- Performing Test COMPILER_SUPPORTS_MARCH_NATIVE - Success
-- Performing Test HAVE_MMAP
-- Performing Test HAVE_MMAP - Success
-- Performing Test HAS_INTRIN_H
-- Performing Test HAS_INTRIN_H - Failed
-- Performing Test HAVE_DECLSPEC_NOINLINE
-- Performing Test HAVE_DECLSPEC_NOINLINE - Failed
-- Performing Test HAVE_ATTRIBUTE_NOINLINE
-- Performing Test HAVE_ATTRIBUTE_NOINLINE - Success
-- Performing Test HAVE_PRE_POST_BAR_RESTRICT
-- Performing Test HAVE_PRE_POST_BAR_RESTRICT - Success
-- Performing Test HAVE_PRE_BAR_RESTRICT
-- Performing Test HAVE_PRE_BAR_RESTRICT - Success
-- Performing Test HAVE__ALIGNED_MALLOC
-- Performing Test HAVE__ALIGNED_MALLOC - Failed
-- Performing Test HAVE_POSIX_MEMALIGN
-- Performing Test HAVE_POSIX_MEMALIGN - Success
-- Performing Test INT64_IS_OWN_TYPE
-- Performing Test INT64_IS_OWN_TYPE - Failed
-- Configuring done
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.

-- Generating done
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.

-- Build files have been written to: /home/jyuan/jyuan-ws/pbrt-v4/build

compile Error

[ 34%] Building CUDA object CMakeFiles/pbrt_lib.dir/src/pbrt/wavefront/aggregate.cpp.o
In file included from /usr/lib/gcc/x86_64-linux-gnu/11/include/stddef.h:213:
/tmp/tmpxft_0000b334_00000000-6_aggregate.cudafe1.stub.c: In function ‘void __nv_cudaEntityRegisterCallback(void**)’:
/tmp/tmpxft_0000b334_00000000-6_aggregate.cudafe1.stub.c:13:138: error: ‘::cuda’ has not been declared
   13 | static void __nv_cudaEntityRegisterCallback(void **__T1936){__nv_dummy_param_ref(__T1936);__nv_save_fatbinhandle_for_managed_rt(__T1936);__cudaRegisterVariable(__T1936, __shadow_var(__nv_static_41__3eab268b_13_aggregate_cpp_741ff3d4_45886__ZN50_INTERNAL_3eab268b_13_aggregate_cpp_741ff3d4_458864cuda3std6ranges3__45__cpo4swapE,::cuda::std::ranges::__4::__cpo::swap), 0, 1UL, 0, 0);__cudaRegisterVariable(__T1936, __shadow_var(__nv_static_41__3eab268b_13_aggregate_cpp_741ff3d4_45886__ZN50_INTERNAL_3eab268b_13_aggregate_cpp_741ff3d4_458864cuda3std6ranges3__45__cpo9iter_moveE,::cuda::std::ranges::__4::__cpo::iter_move), 0, 1UL, 0, 0);}
      |                                                                                                                                          ^~~~~~~~~~~~~~~~~~~~~~
/tmp/tmpxft_0000b334_00000000-6_aggregate.cudafe1.stub.c:13:382: error: ‘::cuda’ has not been declared
   13 | t(__T1936);__cudaRegisterVariable(__T1936, __shadow_var(__nv_static_41__3eab268b_13_aggregate_cpp_741ff3d4_45886__ZN50_INTERNAL_3eab268b_13_aggregate_cpp_741ff3d4_458864cuda3std6ranges3__45__cpo4swapE,::cuda::std::ranges::__4::__cpo::swap), 0, 1UL, 0, 0);__cudaRegisterVariable(__T1936, __shadow_var(__nv_static_41__3eab268b_13_aggregate_cpp_741ff3d4_45886__ZN50_INTERNAL_3eab268b_13_aggregate_cpp_741ff3d4_458864cuda3std6ranges3__45__cpo9iter_moveE,::cuda::std::ranges::__4::__cpo::iter_move), 0, 1UL, 0, 0);}
      |                                                                                                                                                                                                                                                                ^~~~~~~~~~~~~~~~~~~~~~

make[2]: *** [CMakeFiles/pbrt_lib.dir/build.make:1012: CMakeFiles/pbrt_lib.dir/src/pbrt/wavefront/aggregate.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:465: CMakeFiles/pbrt_lib.dir/all] Error 2
make: *** [Makefile:146: all] Error 2
penguinflys commented 4 months ago

Seems related to #427

penguinflys commented 4 months ago

Dowgraded Cuda to 12.1 as seen from the build test logs https://github.com/mmp/pbrt-v4/actions?query=workflow%3Agpu-build-only

It worked, I guess there are something wrong at aggregate.cpp to call cuda API.