Commit e32b31c7 authored by Robbie Buxton's avatar Robbie Buxton
Browse files

python3Packages.torch: ensure torch compile can find and use compilers from nix

parent cedf7187
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@
  MPISupport ? false,
  mpi,
  buildDocs ? false,
  targetPackages,

  # tests.cudaAvailable:
  callPackage,
@@ -365,6 +366,12 @@ buildPythonPackage rec {
    substituteInPlace torch/csrc/profiler/unwind/unwind.cpp \
      --replace-fail 'addr2line_binary_ = "addr2line"' 'addr2line_binary_ = "${lib.getExe' binutils "addr2line"}"'
  ''
  # Ensures torch compile can find and use compilers from nix.
  + ''
    substituteInPlace torch/_inductor/config.py \
      --replace-fail '"clang++" if sys.platform == "darwin" else "g++"' \
      '"${lib.getExe' targetPackages.stdenv.cc "${targetPackages.stdenv.cc.targetPrefix}c++"}"'
  ''
  + lib.optionalString rocmSupport ''
    # https://github.com/facebookincubator/gloo/pull/297
    substituteInPlace third_party/gloo/cmake/Hipify.cmake \