Comments (7)
- My branch got heavily messed up, synchronising with master fixed issue.
- Switching to gcc/g++ helps. It turned out gcc/g++ is advised in tutorial
Closing it, thanks for help!
from extension-cpp.
Last error can be fixed by importing torch first:
import torch
import lltm_cpp
from extension-cpp.
- Where does the first error come from/appear? I'm not sure how
torch.cuda
cannot be present. It's a subpackage of the torch package and is always present - I have successfully built these extensions on macOS with system clang and with gcc-7, so I cannot reproduce your compiler errors. It seems like an issue with your gcc.
- This is described in the tutorial, once it gets published.
from extension-cpp.
Sorry for bothering you again and for reopening this ticket.
I tried to get CUDAExtension
to run on macOS and ran into some trouble, so maybe you can help me (it seems that you are also on a mac?).
You wrote in your tutorial:
On MacOS, you will have to download GCC (e.g. brew install gcc will give you GCC 7 at the time of this writing). In the worst case, you can build PyTorch from source with your compiler and then build the extension with that same compiler.
Compiling PyTorch with clang
and clang++
works fine, however it fails when using gcc-7
and g++-7
, and prints the following error message:
nvcc fatal: GNU C/C++ compiler is no longer supported as a host compiler on Mac OS X.
After browsing the internet, these error messages make sense to me, as it seems that nvcc
does not support gcc
/g++
.
In addition, using clang
/clang++
or gcc-7
/g++-7
to compile the CUDAExtension
do not work either.
Using clang
/clang++
, I get the error:
fatal error: 'atomic' file not found
Using gcc-7
/g++-7
, I get the error:
/usr/local/cuda/include/crt/math_functions.h(9457): error: namespace "__gnu_cxx" has no member "__promote_2"
Any idea on how to solve this problem?
from extension-cpp.
For the first error, you simply can't use gcc-7
to compile PyTorch on Mac, because the CUDA toolkit on mac doesn't support it as a compiler.
The second one looks like a bug, cc @goldsborough.
from extension-cpp.
Yeah we actually build PyTorch with clang on Mac, so my tutorial is wrong here. But for the issue, we actually apparently don't support CUDA on Mac, so all bets are off for this unfortunately :/
from extension-cpp.
Just wanted to let you know that I fixed the problem. The actual problem is not within PyTorch and CUDA on macOS, but with distutils (cudamat/cudamat#39).
I noticed that the nvcc
call works fine when I type it manually into the console, but fails when calling via spawn
. I fixed the problem by replacing
def spawn(self, cmd):
spawn(cmd, dry_run=self.dry_run)
with
def spawn(self, cmd):
subprocess.call(cmd)
in python3.6/distutils/ccompiler.py
. If you know of a more elegant fix, please let me know.
from extension-cpp.
Related Issues (20)
- www.facebook.com/rozi.khatun.961
- This repo can not compile using Pytorch 1.6.0 HOT 1
- This repo can not compile using Pytorch 1.6.0 HOT 1
- A question about backward propagation speed in cpp extension in tutorial
- Error when building cpp extension HOT 1
- AttributeError: module 'depthwise' has no attribute 'forward'
- cuda does not install HOT 17
- How does the layer of C++ extensions translate to TorchScript or onnx? HOT 1
- Cannot Unpack, Too Many Items
- How to debug in cuda-pytorch env?
- Writing a custom C++ extension with variants for both CPU and GPU? HOT 2
- Custom CUDA operator only work well on cuda:0 HOT 3
- How can I access data in cuda kernel like in pytorch?
- error LNK2001 undefined reference to `__cudaRegisterLinkedBinary
- Relation between at::Half and __half
- Deprecation warning
- Scikit-build-core / scikit-build support for binding
- `TORCH_LIBRARY` and `m.def` Not Working as Documented
- [feature request] Instruction on how to setup compile-env for Windows
- JIT-compiling the extension results in non-functional Python module.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extension-cpp.