Giter Club home page Giter Club logo

Comments (7)

tsrxq avatar tsrxq commented on July 30, 2024 1
  1. My branch got heavily messed up, synchronising with master fixed issue.
  2. Switching to gcc/g++ helps. It turned out gcc/g++ is advised in tutorial

Closing it, thanks for help!

from extension-cpp.

tsrxq avatar tsrxq commented on July 30, 2024

Last error can be fixed by importing torch first:

import torch 
import lltm_cpp

from extension-cpp.

goldsborough avatar goldsborough commented on July 30, 2024
  1. 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
  2. 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.
  3. This is described in the tutorial, once it gets published.

from extension-cpp.

rusty1s avatar rusty1s commented on July 30, 2024

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.

apaszke avatar apaszke commented on July 30, 2024

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.

goldsborough avatar goldsborough commented on July 30, 2024

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.

rusty1s avatar rusty1s commented on July 30, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.