BlinkDL / RWKV-LM

RWKV is an RNN with transformer-level LLM performance. It can be directly trained like a GPT (parallelizable). So it's combining the best of RNN and transformer - great performance, fast inference, saves VRAM, fast training, "infinite" ctx_len, and free sentence embedding.
Apache License 2.0
12.05k stars 827 forks source link

nvcc fatal : Unknown option '-Xptxas -O3' #166

Closed poffertje closed 11 months ago

poffertje commented 1 year ago
(RKWN) C:\Users\lmps\Github\RWKV-LM\RWKV-v4>python train.py
loading utf-8 data... ../data/enwik8
building token list... data has 99621832 tokens, 6064 unique.

RWKV_HEAD_QK_DIM 0

Using C:\Users\lmps\AppData\Local\torch_extensions\torch_extensions\Cache\py310_cu117 as PyTorch extensions root...
Detected CUDA files, patching ldflags
Emitting ninja build file C:\Users\lmps\AppData\Local\torch_extensions\torch_extensions\Cache\py310_cu117\wkv\build.ninja...
Building extension module wkv...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/2] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin\nvcc --generate-dependencies-with-compile --dependency-output wkv_cuda.cuda.o.d -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=wkv -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\lmps\.conda\envs\RKWN\lib\site-packages\torch\include -IC:\Users\lmps\.conda\envs\RKWN\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\lmps\.conda\envs\RKWN\lib\site-packages\torch\include\TH -IC:\Users\lmps\.conda\envs\RKWN\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include" -IC:\Users\lmps\.conda\envs\RKWN\Include -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_61,code=compute_61 -gencode=arch=compute_61,code=sm_61 -res-usage --use_fast_math -O3 "-Xptxas -O3" -DTmax=1024 -c C:\Users\lmps\Github\RWKV-LM\RWKV-v4\cuda\wkv_cuda.cu -o wkv_cuda.cuda.o
FAILED: wkv_cuda.cuda.o
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\bin\nvcc --generate-dependencies-with-compile --dependency-output wkv_cuda.cuda.o.d -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -DTORCH_EXTENSION_NAME=wkv -DTORCH_API_INCLUDE_EXTENSION_H -IC:\Users\lmps\.conda\envs\RKWN\lib\site-packages\torch\include -IC:\Users\lmps\.conda\envs\RKWN\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\lmps\.conda\envs\RKWN\lib\site-packages\torch\include\TH -IC:\Users\lmps\.conda\envs\RKWN\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.7\include" -IC:\Users\lmps\.conda\envs\RKWN\Include -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_61,code=compute_61 -gencode=arch=compute_61,code=sm_61 -res-usage --use_fast_math -O3 "-Xptxas -O3" -DTmax=1024 -c C:\Users\lmps\Github\RWKV-LM\RWKV-v4\cuda\wkv_cuda.cu -o wkv_cuda.cuda.o
nvcc fatal   : Unknown option '-Xptxas -O3'
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "C:\Users\lmps\.conda\envs\RKWN\lib\site-packages\torch\utils\cpp_extension.py", line 1900, in _run_ninja_build
    subprocess.run(
  File "C:\Users\lmps\.conda\envs\RKWN\lib\subprocess.py", line 526, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\lmps\Github\RWKV-LM\RWKV-v4\train.py", line 191, in <module>
    from src.trainer import Trainer, TrainerConfig
  File "C:\Users\lmps\Github\RWKV-LM\RWKV-v4\src\trainer.py", line 44, in <module>
    from src.model import GPT, GPTConfig
  File "C:\Users\lmps\Github\RWKV-LM\RWKV-v4\src\model.py", line 44, in <module>
    wkv_cuda = load(name="wkv", sources=["cuda/wkv_op.cpp", "cuda/wkv_cuda.cu"],
  File "C:\Users\lmps\.conda\envs\RKWN\lib\site-packages\torch\utils\cpp_extension.py", line 1284, in load
    return _jit_compile(
  File "C:\Users\lmps\.conda\envs\RKWN\lib\site-packages\torch\utils\cpp_extension.py", line 1508, in _jit_compile
    _write_ninja_file_and_build_library(
  File "C:\Users\lmps\.conda\envs\RKWN\lib\site-packages\torch\utils\cpp_extension.py", line 1623, in _write_ninja_file_and_build_library
    _run_ninja_build(
  File "C:\Users\lmps\.conda\envs\RKWN\lib\site-packages\torch\utils\cpp_extension.py", line 1916, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error building extension 'wkv'

(RKWN) C:\Users\lmps\Github\RWKV-LM\RWKV-v4>
poffertje commented 1 year ago

Could anyone tell me why I get this error?

BlinkDL commented 11 months ago

you can remove '-Xptxas -O3' in model.py if you are using win10