Trouble/Others

tinycudann 설치 시 No CUDA runtime is found 문제

침닦는수건 2024. 5. 7. 18:10
반응형

https://github.com/NVlabs/tiny-cuda-nn

 

GitHub - NVlabs/tiny-cuda-nn: Lightning fast C++/CUDA neural network framework

Lightning fast C++/CUDA neural network framework. Contribute to NVlabs/tiny-cuda-nn development by creating an account on GitHub.

github.com

 

요즘 NeRF 시리즈 논문들에서 자주 다루는 library, tinycudann 설치할 때 잡음이 많다.

 

기본적으로 gpu에 맞는 nvidia driver를 설치해두어야 할 것, 또 이에 맞는 CUDA를 설치해둘 것.

 

이건 만족했다는 전에 하에 진행해도 다음과 같은 오류가 생길 수 있다.

 

pip를 이용한 설치 과정에서 주로 등장한다.

Collecting git+https://github.com/NVlabs/tiny-cuda-nn/#subdirectory=bindings/torch
  Cloning https://github.com/NVlabs/tiny-cuda-nn/ to /tmp/pip-req-build-_3uulq5x
  Running command git clone --filter=blob:none --quiet https://github.com/NVlabs/tiny-cuda-nn/ /tmp/pip-req-build-_3uulq5x
  Resolved https://github.com/NVlabs/tiny-cuda-nn/ to commit 2ec562e853e6f482b5d09168705205f46358fb39
  Running command git submodule update --init --recursive -q
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      No CUDA runtime is found, using CUDA_HOME='/usr/local/cuda'
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-req-build-_3uulq5x/bindings/torch/setup.py", line 51, in <module>
          raise EnvironmentError("Unknown compute capability. Specify the target compute capabilities in the TCNN_CUDA_ARCHITECTURES environment variable or install PyTorch with the CUDA backend to detect it automatically.")
      OSError: Unknown compute capability. Specify the target compute capabilities in the TCNN_CUDA_ARCHITECTURES environment variable or install PyTorch with the CUDA backend to detect it automatically.
      Building PyTorch extension for tiny-cuda-nn version 1.7
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

 

해결법

핵심은 위 안내문 중 TCNN_CUDA_ARCHITECTURE를 명시하라는 부분이다.

 

자세히는 모르겠지만 설치되어 있는 Pytorch로 하여금 원래는 자동으로 TCNN_CUDA_ARCHITECTURE가 무엇인지 잡아내야 하는데 이를 못 잡았기 때문에 나는 에러다.

 

TCNN_CUDA_ARCHITECTURES=86

 

위와 같이 터미널에서 명시해주면 끝!

 

Dockerfile일 경우에도 간단하다.

ENV TCNN_CUDA_ARCHITCTURES=86

 

반응형