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

CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1. #32

Closed
Ballzy0706 opened this issue Aug 5, 2022 · 7 comments

Comments

@Ballzy0706
Copy link

Many thanks to the author for his contribution to this work,
But I'm having some difficulty implementing, which is following:

Using C:\Users\shower\AppData\Local\torch_extensions\torch_extensions\Cache\py39_cu116 as PyTorch extensions root...
Detected CUDA files, patching ldflags
Emitting ninja build file C:\Users\shower\AppData\Local\torch_extensions\torch_extensions\Cache\py39_cu116\adam_upd_cuda\build.ninja...
Building extension module adam_upd_cuda...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
Traceback (most recent call last):

File ~\anaconda3\lib\site-packages\torch\utils\cpp_extension.py:1808 in _run_ninja_build
subprocess.run(

File ~\anaconda3\lib\subprocess.py:528 in run
raise CalledProcessError(retcode, process.args,

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 D:\DirectVoxGO-main\run.py:13 in
from lib import utils, dvgo, dcvgo, dmpigo

File D:\DirectVoxGO-main\lib\utils.py:11 in
from .masked_adam import MaskedAdam

File D:\DirectVoxGO-main\lib\masked_adam.py:8 in
adam_upd_cuda = load(

File ~\anaconda3\lib\site-packages\torch\utils\cpp_extension.py:1202 in load
return _jit_compile(

File ~\anaconda3\lib\site-packages\torch\utils\cpp_extension.py:1425 in _jit_compile
_write_ninja_file_and_build_library(

File ~\anaconda3\lib\site-packages\torch\utils\cpp_extension.py:1537 in _write_ninja_file_and_build_library
_run_ninja_build(

File ~\anaconda3\lib\site-packages\torch\utils\cpp_extension.py:1824 in _run_ninja_build
raise RuntimeError(message) from e

RuntimeError: Error building extension 'adam_upd_cuda'

I have tried many methods including looking for the source of extension_cpp.py or updating and modifying the version of vs and so on, but I can't solve it, I hope to get your help to achieve this work, and I have no experience in compiling so I can‘t sure where the problem is.

Additionally, my environment is Windows11, torch 1.12.0, cuda 11.6 , vs2017 and python 3.9.
Hope this extra configuration information will help you find the problem in my work better, thanks again.

@Harper714
Copy link

@Ballzy0706

Hi, I met the same question. Have you addressed this issue?

@Ballzy0706
Copy link
Author

Sure.

I found that the .cpp file in this article is more demanding for my environment, just cuda==11.3 and visual studio==2019 can meet the running requirements.

And the question comes from the version of cuda code, eg. (the function "Template" in .cu file is changed across different version of cuda and gc++ that provided by visual studio).

You can just adjust your env version same as mine, if you just want to run the code in your windows.

hope the answer could help you.

@Ballzy0706
Copy link
Author

@Ballzy0706

Hi, I met the same question. Have you addressed this issue?

@Harper714 Please feel free to reply if you still have problem.

@Harper714
Copy link

Many thanks for your answer.

I found my error occurs only when remote debugging using pycharm, but success when directly running the code. I guess the problem is that pycharm cannot properly use g++ to compile?

@Ballzy0706
Copy link
Author

Many thanks for your answer.

I found my error occurs only when remote debugging using pycharm, but success when directly running the code. I guess the problem is that pycharm cannot properly use g++ to compile?

Happy to hear that.

The reason about your description, I could not locate your problem exactly. I guess that the problem with pycharm may be related to the environment variables you set, which are different from the env when you run the code directly.

@Harper714
Copy link

Yes, I guess so. I will try again~

@Ailon-Island
Copy link

I met the same problem but I didn't have the priviliage to upgrade g++ and CUDA.

Instead, I solve it by adding extra_cflags=["-std=c++14"], extra_cuda_cflags=["-std=c++14"] in every call of torch.utils.cpp_extension.load.

Besides, I also changes PyTorch's source code a bit according to this blog. That is, in .../site-package/torch/include/torch/csrc/api/include/torch/nn/cloneable.h, line 46, 58, 70,

copy->parameters_.size() == parameters_.size()

copy->buffers_.size() == buffers_.size()

copy->children_.size() == children_.size()

are modified into

copy->parameters_.size() == this -> parameters_.size()

copy->buffers_.size() == this -> buffers_.size()

copy->children_.size() == this -> children_.size()

This is not quite an elegant solution.

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