Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPU rendering not working with MSCV Version 14.40 and newer #429

Open
Wil-Lee opened this issue Jun 20, 2024 · 2 comments
Open

GPU rendering not working with MSCV Version 14.40 and newer #429

Wil-Lee opened this issue Jun 20, 2024 · 2 comments

Comments

@Wil-Lee
Copy link

Wil-Lee commented Jun 20, 2024

It seems like MSVC >=14.40 breaks the framework somehow, so that the GPU rendering is not working anymore.
MSCV >= 14.40 only supports CUDA 12.4+.
Trying to render the killeroo-simple scene (pbrt tests scenes) results in an error: Wavefront rendering failed at sample 0. Debug with "--debugstart 0".
Trying to build the framework with Cuda 12.5 results in a compile error like in #427.

I asked three other developers to try executing the GPU renderer.

  1. RTX 4000 Series, Cuda 12.3, Optix 8.0.0, MSVC 14.38 -> renders without any problems.
  2. GTX 1060, Cuda 12.4, Optix 8.0.0, MSVC 14.39 -> renders without any problems.
  3. RTX 3000 Series, Cuda 12.4, Optix 8.0.0, MSVC 14.40 -> renderer crashes at first sample
  4. RTX 2080, Cuda 12.4, Opitx 8.0.0, MSVC 14.40 -> renderer crashes at first sample (my system)
  5. RTX 2080, Cuda 12.5, Opitx 8.0.0, MSVC 14.40 -> compiler crashes only when cuda was detected

I tried MSVC 14.29 and the gpu renderer works (most of the time, still some crashes).

A workaround for this with Visual Studio 2022 and Windows 10:

  1. Open Visual Studio Installer
  2. Click "Change"-Button
  3. Click on "Components"
  4. Look for MSVC v143 - VS 2022 C++ x64/x86-Buildtools (v14.39 -17.9) and install it
  5. Open CMD and cd to: <Your Visual Studio installation Path>\Microsoft Visual Studio\2022\<your edition>\VC\Auxiliary\Build
  6. execute: vcvarall.bat x64 -vcvars_ver=14.39
    to set the standard compiler version for Visual Studio
  7. Reinstall Cuda 12.4 (I guess you can somehow reconfig Visual Studio so that CUDA gets detected, but this is the easiest way at least for me)
  8. Rebuild the project with cmake

Everything should be working with that.

@shocker-0x15
Copy link

Thanks for sharing the workaround!

For anyone who don't want to reinstall the CUDA (I have 12.4.1 and 12.5.1 for example), I have succeeded to properly compile the projects with specifying cuda=12.4 as -T option to the CMake.

Specifically, I did the following steps after the step 6 in the original post:

  1. Configure the CMake with cuda=12.4 for -T option. (I use cmake-gui.exe (3.29.3))
    screenshot
  2. Set the variable for OptiX path to C:\ProgramData\NVIDIA Corporation\OptiX SDK 8.0.0.
  3. Reconfigure the CMake.
    You'll see something like The CUDA compiler identification is NVIDIA 12.4.131.
  4. Generate and open the solution, then build.

I guess that there is a way to skip even the step 6 in the original post by specifying the buildtool version of MSVC, but I couldn't for some reason (Possibly there is a bug around this).

@RoopeHaavisto
Copy link

RoopeHaavisto commented Dec 13, 2024

Got the GPU build working with newer cuda versions by replacing all of

#ifdef PBRT_IS_WINDOWS
#if (__CUDA_ARCH__ < 700)
#define PBRT_USE_LEGACY_CUDA_ATOMICS
#endif
#else
#if (__CUDA_ARCH__ < 600)
#define PBRT_USE_LEGACY_CUDA_ATOMICS
#endif
#endif // PBRT_IS_WINDOWS
#ifndef PBRT_USE_LEGACY_CUDA_ATOMICS
#include <cuda/atomic>
#endif

with

#include <cuda/atomic>

Thus this solves build error in #427 at least when __CUDA_ARCH__ >= 700 however with newer build tools rendering still gives black screen (with 14.39 renders correctly).

NVIDIA Quadro RTX 3000 - cuda 12.6 - optix 8.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants