From 6c0872ebdeeadf3d667568457a54ad5fe91feace Mon Sep 17 00:00:00 2001 From: Matt Pharr Date: Thu, 28 Jan 2021 13:32:32 -0800 Subject: [PATCH] Add CI for GPU builds (#103) (Only makes sure everything compiles; doesn't run tests.) --- .github/workflows/{c-cpp.yml => ci-cpu.yml} | 12 +++- .github/workflows/ci-gpu.yml | 75 +++++++++++++++++++++ CMakeLists.txt | 4 +- README.md | 3 +- src/pbrt/gpu/pathintegrator.cpp | 3 - 5 files changed, 90 insertions(+), 7 deletions(-) rename .github/workflows/{c-cpp.yml => ci-cpu.yml} (89%) create mode 100644 .github/workflows/ci-gpu.yml diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/ci-cpu.yml similarity index 89% rename from .github/workflows/c-cpp.yml rename to .github/workflows/ci-cpu.yml index 7ea02adc..02502485 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/ci-cpu.yml @@ -1,6 +1,14 @@ -name: ci +name: cpu-build-and-test -on: [push, pull_request] +on: + push: + paths-ignore: + - '**.md' + - 'images/**' + pull_request: + paths-ignore: + - '**.md' + - 'images/**' jobs: build: diff --git a/.github/workflows/ci-gpu.yml b/.github/workflows/ci-gpu.yml new file mode 100644 index 00000000..f49dbe64 --- /dev/null +++ b/.github/workflows/ci-gpu.yml @@ -0,0 +1,75 @@ +name: gpu-build-only + +on: + push: + paths-ignore: + - '**.md' + - 'images/**' + pull_request: + paths-ignore: + - '**.md' + - 'images/**' + +jobs: + build: + strategy: + fail-fast: false + matrix: + optix: [ optix-7.1.0, optix-7.2.0 ] + cuda: [ '11.0', '11.1', '11.2' ] + + name: GPU Build Only (CUDA ${{ matrix.cuda }}, ${{ matrix.optix }}) + + runs-on: ubuntu-20.04 + + steps: + - name: Checkout pbrt + uses: actions/checkout@v2 + with: + submodules: true + + - name: Checkout rgb2spectrum tables + uses: actions/checkout@v2 + with: + repository: mmp/rgb2spectrum + path: build + + - name: Checkout OptiX headers + uses: actions/checkout@v2 + with: + ssh-key: ${{ secrets.CHECKOUT_KEY }} + repository: mmp/optix-headers + path: optix + + - name: Get cmake + uses: lukka/get-cmake@latest + + - name: Install OpenEXR + run: sudo apt-get -y install libopenexr-dev + + - name: Try to restore CUDA install from cache + id: cache-cuda + uses: actions/cache@v2 + with: + path: /usr/local/cuda-${{ matrix.cuda }} + key: cuda-usr-local-${{ matrix.cuda }} + + - name: Install CUDA + if: steps.cache-cuda.outputs.cache-hit != 'true' + run: | + wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin + sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600 + sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/7fa2af80.pub + sudo add-apt-repository "deb https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/ /" + cuda=`echo ${{ matrix.cuda }} | tr . -` + sudo apt install -y cuda-compiler-${cuda} cuda-libraries-${cuda} cuda-libraries-dev-${cuda} + echo /usr/local/cuda-${{ matrix.cuda }}/bin >> $GITHUB_PATH + + - name: Configure + run: | + cd build + cmake .. -DPBRT_USE_PREGENERATED_RGB_TO_SPECTRUM_TABLES=True -DPBRT_OPTIX7_PATH=../optix/${{ matrix.optix }} -DPBRT_GPU_SHADER_MODEL=sm_80 + + - name: Build + # We need to limit the number of jobs so that it doesn't OOM + run: cmake --build build --parallel 3 --config Release diff --git a/CMakeLists.txt b/CMakeLists.txt index 268672a9..29b01502 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,7 +159,9 @@ if (CMAKE_CUDA_COMPILER) else () enable_language (CUDA) list (APPEND PBRT_DEFINITIONS "PBRT_BUILD_GPU_RENDERER") - list (APPEND PBRT_DEFINITIONS "NVTX") + if (PBRT_NVTX) + list (APPEND PBRT_DEFINITIONS "NVTX") + endif () set (PBRT_CUDA_ENABLED ON) # FIXME diff --git a/README.md b/README.md index 4c16aa77..32c0cfcc 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,8 @@ pbrt, Version 4 (Early Release) =============================== -[](https://github.com/mmp/pbrt-v4/actions) +[](https://github.com/mmp/pbrt-v4/actions) +[](https://github.com/mmp/pbrt-v4/actions) ![Transparent Machines frame, via @beeple](images/teaser-transparent-machines.png) diff --git a/src/pbrt/gpu/pathintegrator.cpp b/src/pbrt/gpu/pathintegrator.cpp index 70b088c7..b07b6caa 100644 --- a/src/pbrt/gpu/pathintegrator.cpp +++ b/src/pbrt/gpu/pathintegrator.cpp @@ -33,7 +33,6 @@ #include #include -#include #include #ifdef NVTX @@ -603,8 +602,6 @@ void GPURender(ParsedScene &scene) { LOG_VERBOSE("Total rendering time: %.3f s", timer.ElapsedSeconds()); - CUDA_CHECK(cudaProfilerStop()); - if (!Options->quiet) { ReportKernelStats();