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

Compile issue on Ubuntu 20.4 and Windows 10 with RTX3090, cuda 11.1 and Optix 7.1 #56

Closed
richardmgoodin opened this issue Oct 7, 2020 · 16 comments

Comments

@richardmgoodin
Copy link

I've just upgraded to an RTX 3090. This required updating to CUDA 11.1 so nvcc would recognize sm86. I'm now getting a build failure under both Ubuntu and Windows 10.

Ubuntu Cmake:
cmake -S . -B ./build -D CUDA_TOOLKIT_ROOT_DIR=/usr/local/cuda -D PBRT_OPTIX7_PATH=/home/goodin/NVIDIA-OptiX-SDK-7.1.0-linux64-x86_64/

Windows Cmake:
$ cmake -S . -B ./build -D CUDA_TOOLKIT_ROOT_DIR="c:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.1" -D PBRT_OPTIX7_PATH="c:/ProgramData/NVIDIA Corporation/Optix SDK 7.1.0"

Ubuntu compile error:
[ 21%] Built target pbrt_lib
make[2]: *** No rule to make target 'CMakeFiles/optix.cu.dir/src/pbrt/gpu/optix.ptx', needed by 'src/pbrt/gpu/optix.cu.ptx_embedded.c'. Stop.
make[1]: *** [CMakeFiles/Makefile2:802: CMakeFiles/pbrt_embedded_ptx_lib.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

Windows compile error (a whole bunch of these errors):
2>C:\cygwin64\home\goodin\pbrt-v4\build>"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\bin\nvcc.exe" -gencode=arch=compute_86,code="sm_86,compute_86" --use-local-env -ccbin "C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64" -x cu -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include" -I"C:\cygwin64\home\goodin\pbrt-v4\src" -I"C:\cygwin64\home\goodin\pbrt-v4\build" -I"C:\cygwin64\home\goodin\pbrt-v4\src\ext\openvdb\nanovdb" -I"C:\ProgramData\NVIDIA Corporation\OptiX SDK 7.1.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.1\include" --keep-dir x64\Release -maxrregcount=128 --machine 64 -ptx -cudart static -Xcudafe --diag_suppress=partial_override -Xcudafe --diag_suppress=virtual_function_decl_hidden -Xcudafe --diag_suppress=integer_sign_change -Xcudafe --diag_suppress=declared_but_not_referenced -Xcudafe --diag_suppress=implicit_return_from_non_void_function --expt-relaxed-constexpr --extended-lambda -Xnvlink -suppress-stack-size-warning --std=c++17 -lineinfo -O3 -Xcudafe=--display_error_number -Xcudafe=--diag_suppress=3089 --define-macro=NDEBUG --define-macro=PBRT_IS_MSVC --define-macro=PBRT_IS_WINDOWS --define-macro=NOMINMAX --define-macro=PBRT_BUILD_GPU_RENDERER --define-macro=NVTX --define-macro=PBRT_HAS_INTRIN_H --define-macro=PBRT_NOINLINE=__declspec(noinline) --define-macro=PBRT_HAVE__ALIGNED_MALLOC -Xcompiler="/EHsc -Ob2" -o optix.cu.dir\Release\optix.ptx "C:\cygwin64\home\goodin\pbrt-v4\src\pbrt\gpu\optix.cu"

4>C:\cygwin64\home\goodin\pbrt-v4\src\ext\openexr\OpenEXR\IlmImf\ImfBoxAttribute.cpp(53,17): error C2491: 'Imf_2_5::TypedAttribute<Imath_2_5::Box2i>::staticTypeName': definition of dllimport function not allowed

mmp added a commit that referenced this issue Oct 7, 2020
This reverts commit a685e02, which seems
to have caused issue #56 (the Ubuntu part at least.)
@mmp
Copy link
Owner

mmp commented Oct 7, 2020

I see the ubuntu one as well (pretty much the same set up here locally). It eventually build if you run make a few times in a row, the issue seems to be one of a missing dependency.

This seems to have been caused by ec742b2, so I've just reverted that for now--I haven't been able to see what the issue is, given mediocre cmake skills over her. (cc @pierremoreau, since it'd be nice to have that in there otherwise.) Please let me know if it builds for you with top of tree now.

@mmp
Copy link
Owner

mmp commented Oct 7, 2020

For the windows part, are you using MSVC2017? If so, I think this is the same as the (yet unresolved) issue #44.

@richardmgoodin
Copy link
Author

richardmgoodin commented Oct 7, 2020 via email

@mmp
Copy link
Owner

mmp commented Oct 7, 2020

I saw nothing in your output that indicated which version you are using. I asked about 2017 because the symptoms are the same as an issue that had seemed to be VS2017 only.

@richardmgoodin
Copy link
Author

Under ubuntu I can now build top of tree. Killeroos-gold 8.9s.

@richardmgoodin
Copy link
Author

As to the Windows build I saw issue #44 but it appeared to be resolved by going to VS2019. I'm definitely running VS2019.

@pierremoreau
Copy link
Contributor

Mmh, I wonder if instead of depending on the file itself, it would work better if the dependency was on the library, i.e. changing this line from DEPENDS $<TARGET_OBJECTS:${lib_name}> to DEPENDS "${lib_name}".

@pierremoreau
Copy link
Contributor

I'm still working on it, but #57 seems to be building fine with Visual Studio 2019 and the built-in CMake support; the only issue I'm having are those "definition of dllimport function not allowed" messages from the dependencies though they go away if you re-run CMake and build again, and seem to happen on the current master.

I'll try to test it on Linux later today.

@pierremoreau
Copy link
Contributor

#57 is building just fine with both Ninja and Make on Linux for me, so hopefully it does for you as well.

@richardmgoodin
Copy link
Author

richardmgoodin commented Oct 9, 2020 via email

@pierremoreau
Copy link
Contributor

Could you please try with the branch in #57 (since I'm assuming that by top of tree, you mean master)? It won't fix the Windows build, but I would like some additional feedback that it does not break Linux builds.

@richardmgoodin
Copy link
Author

richardmgoodin commented Oct 9, 2020 via email

@pierremoreau
Copy link
Contributor

With #57, I am referring to the changes suggested in that MR which is some version of master + an additional commit. You can check it out by doing (assuming origin is the name of the remote for this repository)

git fetch origin pull/57/head:BRANCHNAME && git switch BRANCHNAME

which will create a new branch named BRANCHNAME with the content of the MR.

@richardmgoodin
Copy link
Author

richardmgoodin commented Oct 9, 2020 via email

@pierremoreau
Copy link
Contributor

Awesome, thank you for testing!

For Windows, the workaround I found was to force-save one of the CMakeLists.txt files to force CMake to re-run, and then it would build just fine. But obviously that is not a great solution.

@mmp
Copy link
Owner

mmp commented Oct 9, 2020

...and now that MR is merged, so I'll go ahead and close this. Thanks, @pierremoreau!

@mmp mmp closed this as completed Oct 9, 2020
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