eladrich / pixel2style2pixel

Official Implementation for "Encoding in Style: a StyleGAN Encoder for Image-to-Image Translation" (CVPR 2021) presenting the pixel2style2pixel (pSp) framework
https://eladrich.github.io/pixel2style2pixel/
MIT License
3.19k stars 570 forks source link

nvcc fatal : Unsupported gpu architecture 'compute_75' #107

Closed kvpratama closed 3 years ago

kvpratama commented 3 years ago

After creating conda environment using psp_env.yml. I tried to run the inference_playground.ipynb. But get this error:

from models.psp import pSp

Traceback (most recent call last):
  File "/home/.conda/envs/psp_env/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1515, in _run_ninja_build
    env=env)
  File "/home/.conda/envs/psp_env/lib/python3.6/subprocess.py", line 418, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/data/gan/pixel2style2pixel/models/psp.py", line 9, in <module>
    from models.encoders import psp_encoders
  File "/home/data/gan/pixel2style2pixel/models/encoders/psp_encoders.py", line 8, in <module>
    from models.stylegan2.model import EqualLinear
  File "/home/data/gan/pixel2style2pixel/models/stylegan2/model.py", line 7, in <module>
    from models.stylegan2.op import FusedLeakyReLU, fused_leaky_relu, upfirdn2d
  File "/home/data/gan/pixel2style2pixel/models/stylegan2/op/__init__.py", line 1, in <module>
    from .fused_act import FusedLeakyReLU, fused_leaky_relu
  File "/home/data/gan/pixel2style2pixel/models/stylegan2/op/fused_act.py", line 13, in <module>
    os.path.join(module_path, 'fused_bias_act_kernel.cu'),
  File "/home/.conda/envs/psp_env/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 974, in load
    keep_intermediates=keep_intermediates)
  File "/home/.conda/envs/psp_env/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1179, in _jit_compile
    with_cuda=with_cuda)
  File "/home/.conda/envs/psp_env/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1279, in _write_ninja_file_and_build_library
    error_prefix="Error building extension '{}'".format(name))
  File "/home/.conda/envs/psp_env/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1529, in _run_ninja_build
    raise RuntimeError(message)
RuntimeError: Error building extension 'fused': [1/2] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/.conda/envs/psp_env/lib/python3.6/site-packages/torch/include -isystem /home/.conda/envs/psp_env/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/.conda/envs/psp_env/lib/python3.6/site-packages/torch/include/TH -isystem /home/.conda/envs/psp_env/lib/python3.6/site-packages/torch/include/THC -isystem /home/.conda/envs/psp_env/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_75,code=sm_75 --compiler-options '-fPIC' -std=c++14 -c /home/data/gan/pixel2style2pixel/models/stylegan2/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o 
FAILED: fused_bias_act_kernel.cuda.o 
/usr/bin/nvcc -DTORCH_EXTENSION_NAME=fused -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/.conda/envs/psp_env/lib/python3.6/site-packages/torch/include -isystem /home/.conda/envs/psp_env/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/.conda/envs/psp_env/lib/python3.6/site-packages/torch/include/TH -isystem /home/.conda/envs/psp_env/lib/python3.6/site-packages/torch/include/THC -isystem /home/.conda/envs/psp_env/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_75,code=sm_75 --compiler-options '-fPIC' -std=c++14 -c /home/data/gan/pixel2style2pixel/models/stylegan2/op/fused_bias_act_kernel.cu -o fused_bias_act_kernel.cuda.o 
nvcc fatal   : Unsupported gpu architecture 'compute_75'
ninja: build stopped: subcommand failed.

I am using ubuntu 18 with Titan RTX. Please help.

Thank you

yuval-alaluf commented 3 years ago

This seems to be an issue related to incompatable CUDA versions. There are several other issues in this repo related to this. Please take a look at them. Also, when posting an issue related to the environment, please mention the CUDA version as this is usually the source of the issue.

kvpratama commented 3 years ago

Thank you @yuval-alaluf

Steps that solve my problem:

  1. upgrading CUDA from 9.1 to 10.1 following the tutorial on this page
  2. update ~/.bashrc as suggested in this comment
  3. I also encountered fatal error: cublas_v2.h: No such file or directory and solved it by following this comment

Hope this will help someone with a similar problem.