diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 71042f72..77c762de 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,9 +24,9 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, windows-2019] - python-version: ['3.6', '3.7', '3.8', '3.9'] - optix-version: [70, 71, 72] + os: [ubuntu-22.04, windows-2019] + python-version: ['3.6', '3.7', '3.8', '3.9'] # #, '3.10' + optix-version: [70, 71, 72] # include: # Includes the value for matrix.container when the OS is Ubuntu, to use manylinux complaint CentOS version. # For Windows, matrix.container remains undefined and the build runs on the host VM instead of within a container. @@ -166,14 +166,24 @@ jobs: with: python-version: ${{ matrix.python-version }} + #$CUDA_PACKAGES="nvcc_11.7 cudart_11.7 visual_studio_integration" - name: Windows Dependencies (CUDA) if: runner.os == 'Windows' shell: powershell run: | - $CUDA_VERSION_FULL = "10.2.89" - $CUDA_REPO_PKG_REMOTE = "http://developer.download.nvidia.com/compute/cuda/10.2/Prod/network_installers/cuda_10.2.89_win10_network.exe" - $CUDA_REPO_PKG_LOCAL = "cuda_10.2.89_win10_network.exe" - $CUDA_PACKAGES = "nvcc_10.2 cudart_10.2" + $CUDA_VERSION_FULL="11.7.0" + $CUDA_REPO_PKG_REMOTE="http://developer.download.nvidia.com/compute/cuda/11.7.0/network_installers/cuda_11.7.0_windows_network.exe" + $CUDA_REPO_PKG_LOCAL="cuda_11.7.0_windows_network.exe" + + echo "printing CUDA_REPO_PKG_REMOTE" + echo %CUDA_REPO_PKG_REMOTE% + echo $CUDA_REPO_PKG_REMOTE% + echo "printing CUDA_REPO_PKG_LOCAL" + echo %CUDA_REPO_PKG_LOCAL% + echo $CUDA_REPO_PKG_LOCAL + echo "printing CUDA_PACKAGES" + echo %CUDA_PACKAGES% + echo $CUDA_PACKAGES # Download the cuda network installer Invoke-WebRequest $CUDA_REPO_PKG_REMOTE -OutFile $CUDA_REPO_PKG_LOCAL | Out-Null # Invoke silent install of CUDA (via network installer) @@ -183,11 +193,16 @@ jobs: if: runner.os == 'Windows' env: OPTIX_VERSION: ${{ matrix.optix-version }} + CUDACXX: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/bin/nvcc.exe + CUDA_PATH: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/ + CudaToolkitDir: C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/ run: | pip install --upgrade setuptools setuptools_scm wheel numpy==1.19.5 mkdir build cd build - cmake ../ -DCMAKE_CUDA_COMPILER="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2/bin/nvcc.exe" -DCUDA_TOOLKIT_ROOT_DIR="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v10.2" -DPYTHON_VERSION="${{matrix.python-version}}" + echo "printing CUDACXX" + echo $CUDACXX + cmake ../ -DPYTHON_VERSION="${{matrix.python-version}}" -DCMAKE_CUDA_COMPILER="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.7/bin/nvcc.exe" cmake --build . --config Release --target install cd .. cd install diff --git a/CMakeLists.txt b/CMakeLists.txt index 6b86d441..2a6322ff 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,11 +3,22 @@ # ┌──────────────────────────────────────────────────────────────────┐ # │ Projects Settings │ # └──────────────────────────────────────────────────────────────────┘ -cmake_minimum_required (VERSION 3.13) -cmake_policy( VERSION 3.13...3.14 ) -project(NVISII CXX C) +cmake_minimum_required (VERSION 3.17) + +MESSAGE(WARN CUDACXX is $ENV{CUDACXX} ) +MESSAGE(WARN CUDA_PATH is $ENV{CUDA_PATH} ) +MESSAGE(WARN CUDAHOSTCXX is $ENV{CUDAHOSTCXX} ) +MESSAGE(WARN CUDAARCHS is $ENV{CUDAARCHS} ) +MESSAGE(WARN CUDAToolkit_ROOT is $ENV{CUDAToolkit_ROOT}) + +project(NVISII CXX C CUDA) + +MESSAGE(now we are past line 10) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) -set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") +# set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") +set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/externals/owl/owl/cmake") + # Force 64 bit builds if(CMAKE_SIZEOF_VOID_P EQUAL 4) @@ -94,7 +105,7 @@ set(MY_DEFINITION # └──────────────────────────────────────────────────────────────────┘ # Build options go here... Things like "Build Tests", or "Generate documentation"... -option(NVCC_VERBOSE "verbose cuda -> ptx -> embedded build" OFF) +# option(NVCC_VERBOSE "verbose cuda -> ptx -> embedded build" OFF) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") # Enable c++11 and hide symbols which shouldn't be visible @@ -281,16 +292,16 @@ set(IMGUI_SRC # include_directories(${TBB_INCLUDE_DIR}) # cuda -if (${CUDA_TOOLKIT_ROOT_DIR}) -message(INFO " CUDA_TOOLKIT_DIR set to ${CUDA_TOOLKIT_ROOT_DIR}") -endif() +# if (${CUDA_TOOLKIT_ROOT_DIR}) +# message(INFO " CUDA_TOOLKIT_DIR set to ${CUDA_TOOLKIT_ROOT_DIR}") +# endif() -find_package(CUDA REQUIRED) -include_directories(${CUDA_TOOLKIT_INCLUDE}) -find_program(BIN2C bin2c - HINTS - ${CUDA_TOOLKIT_ROOT_DIR}/bin/ - /usr/local/cuda/bin) +# find_package(CUDA REQUIRED) +# include_directories(${CUDA_TOOLKIT_INCLUDE}) +# find_program(BIN2C bin2c +# HINTS +# ${CUDA_TOOLKIT_ROOT_DIR}/bin/ +# /usr/local/cuda/bin) # optix 7 include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/include/nvisii/utilities/sutil/) @@ -320,14 +331,17 @@ endif() # owl #set(SET_UP_CONFIGURATIONS_DONE 1) -#set(OWL_BUILD_SAMPLES OFF CACHE STRING "" FORCE) -#set(OWL_BUILD_ADVANCED_TESTS OFF CACHE STRING "" FORCE) +set(OptiX_INSTALL_DIR ${CMAKE_CURRENT_SOURCE_DIR}/externals/owl/owl/) +set(OWL_BUILD_SAMPLES OFF CACHE STRING "" FORCE) +set(OWL_BUILD_ADVANCED_TESTS OFF CACHE STRING "" FORCE) add_subdirectory(externals/owl EXCLUDE_FROM_ALL) +include(embed_ptx) + #include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/externals/owl/) #include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/externals/owl/owl/include) -list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/externals/owl/owl/cmake) -include_directories(${OWL_INCLUDES}) -include(configure_cuda) +# list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/externals/owl/owl/cmake) +# include_directories(${OWL_INCLUDES}) +# include(configure_cuda) # add libraries to a list for linking set( @@ -340,6 +354,8 @@ set( #owl ${OWL_LIBRARIES} assimp + OptiX::OptiX + owl::owl ) set ( @@ -391,23 +407,23 @@ endif() # # └──────────────────────────────────────────────────────────────────┘ # For compiling cuda kernels and embedding them as ptx -if (NVCC_VERBOSE) -set (NVCC_VERBOSE_FLAG --verbose) -endif() - -macro(cuda_compile_and_embed output_var cuda_file) - set(var_name ${output_var}) - cuda_compile_ptx(ptx_files ${cuda_file} OPTIONS --generate-line-info -use_fast_math -Xcudafe --diag_suppress=esa_on_defaulted_function_ignored --keep ${NVCC_VERBOSE_FLAG}) - list(GET ptx_files 0 ptx_file) - set(embedded_file ${ptx_file}_embedded.c) - add_custom_command( - OUTPUT ${embedded_file} - COMMAND ${BIN2C} -c --padd 0 --type char --name ${var_name} ${ptx_file} > ${embedded_file} - DEPENDS ${ptx_file} - COMMENT "compiling (and embedding ptx from) ${cuda_file}" - ) - set(${output_var} ${embedded_file}) -endmacro() +# if (NVCC_VERBOSE) +# set (NVCC_VERBOSE_FLAG --verbose) +# endif() + +# macro(cuda_compile_and_embed output_var cuda_file) +# set(var_name ${output_var}) +# cuda_compile_ptx(ptx_files ${cuda_file} OPTIONS --generate-line-info -use_fast_math -Xcudafe --diag_suppress=esa_on_defaulted_function_ignored --keep ${NVCC_VERBOSE_FLAG}) +# list(GET ptx_files 0 ptx_file) +# set(embedded_file ${ptx_file}_embedded.c) +# add_custom_command( +# OUTPUT ${embedded_file} +# COMMAND ${BIN2C} -c --padd 0 --type char --name ${var_name} ${ptx_file} > ${embedded_file} +# DEPENDS ${ptx_file} +# COMMENT "compiling (and embedding ptx from) ${cuda_file}" +# ) +# set(${output_var} ${embedded_file}) +# endmacro() # ┌──────────────────────────────────────────────────────────────────┐ # │ Add source files │ @@ -431,12 +447,32 @@ set(HDR ${HDR} ${Externals_HDR}) # │ CUDA PTX │ # └──────────────────────────────────────────────────────────────────┘ # OPTIONS -Xcudafe --diag_suppress=esa_on_defaulted_function_ignored -cuda_compile_and_embed(ptxCode ${SRC_CU}) +# compile_and_embed(ptxCode ${SRC_CU}) + +embed_ptx( + OUTPUT_TARGET + deviceCode_ptx + EMBEDDED_SYMBOL_NAMES + deviceCode_ptx + PTX_LINK_LIBRARIES + owl::owl + SOURCES + ${SRC_CU} +) +set ( + LIBRARIES + ${LIBRARIES} + deviceCode_ptx +) # ┌──────────────────────────────────────────────────────────────────┐ # │ NVISII Library │ # └──────────────────────────────────────────────────────────────────┘ -cuda_add_library(nvisii_lib STATIC ${SRC} ${HDR} ${ptxCode} OPTIONS --expt-relaxed-constexpr -Xcudafe --diag_suppress=esa_on_defaulted_function_ignored) +add_library(nvisii_lib STATIC ${SRC} ${HDR} ${ptxCode} +# OPTIONS --expt-relaxed-constexpr -Xcudafe --diag_suppress=esa_on_defaulted_function_ignored +) +set_property(TARGET nvisii_lib PROPERTY CUDA_ARCHITECTURES OFF) + set_target_properties(nvisii_lib PROPERTIES POSITION_INDEPENDENT_CODE ON) target_link_libraries(nvisii_lib ${LIBRARIES}) set_target_properties(nvisii_lib PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS true) @@ -502,4 +538,4 @@ if(hasParent) set(OWL_VIEWER_LIBRARIES ${OWL_VIEWER_LIBRARIES} PARENT_SCOPE) set(OWL_HAVE_TBB ${OWL_HAVE_TBB} PARENT_SCOPE) set(OWL_CXX_FLAGS ${OWL_CXX_FLAGS} PARENT_SCOPE) -endif() \ No newline at end of file +endif() diff --git a/README.md b/README.md index ccf6cc04..5040dd92 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,7 @@ For more information see our [ICLR workshop 2021 paper](https://arxiv.org/abs/21 [Documentation](https://nvisii.com) and [quick tutorial](https://youtu.be/vg7FN7YDUy0). +