Add cxxdev output to torch-bin - #116
Conversation
This output propagates C++ dependencies.
e4ba3f3 to
af33406
Compare
| rm -rf $out/nix-support | ||
|
|
||
| # Variables that we want to pass through to downstream derivations. | ||
| mkdir -p $out/nix-support | ||
| echo 'export ROCM_PATH="${placeholder "out"}"' >> $out/nix-support/setup-hook | ||
| echo 'export ROCM_SOURCE_DIR="${placeholder "out"}"' >> $out/nix-support/setup-hook | ||
| echo 'export CMAKE_CXX_FLAGS="-I${placeholder "out"}/include -I${placeholder "out"}/include/rocblas"' >> $out/nix-support/setup-hook | ||
| ''; |
There was a problem hiding this comment.
is out generated internally by symlinkJoin to provide the output of linked rocm packages ?
There was a problem hiding this comment.
Yep! out is the standard output.
| aotriton | ||
| clr | ||
| comgr | ||
| hipblas | ||
| hipblas-common-devel | ||
| hipblaslt | ||
| hipfft | ||
| hipify-clang | ||
| hiprand | ||
| hipsolver | ||
| hipsparse | ||
| hipsparselt | ||
| hsa-rocr | ||
| miopen-hip | ||
| rccl | ||
| rocblas | ||
| rocm-core | ||
| rocm-device-libs | ||
| rocm-hip-runtime | ||
| rocm-smi-lib | ||
| rocminfo | ||
| rocrand | ||
| rocsolver | ||
| rocsparse | ||
| roctracer |
There was a problem hiding this comment.
These are already built and cached right ?
| # Remove all ROCm libraries, we want to link against Nix packages. | ||
| # This keeps the outputs lean and requires downstream to specify | ||
| # dependencies. | ||
| rm -rf $out/${python.sitePackages}/torch/lib/{libamd*,libaotriton*,libdrm*,libelf*,libgomp*,libhip*,libhsa*,libMIOpen*,libnuma*,librccl*,libroc*,libtinfo*}.so | ||
| rm -rf $out/${python.sitePackages}/torch/lib/{rocblas,hipblaslt,hipsparselt} |
There was a problem hiding this comment.
Amazing that removing the libs don't break anything ! but how are we linking to the nix provided deps here ?
There was a problem hiding this comment.
autoPatchelfHook does it automatically for us:
We only have to make sure that the dependencies are visible through buildInputs.
| cudaPropagateToOutput = "cxxdev"; | ||
| rocmPropagateToOutput = "cxxdev"; | ||
|
|
There was a problem hiding this comment.
there are part of the buildPythonPackage attributes ?
There was a problem hiding this comment.
Any buildPythonPackage/mkDerivation attribute that is not used by buildPythonPackage/mkDerivation is exposed as an environment variable in the build environment. These then get picked up by the CUDA/ROCm setup hooks:
| outputs = [ | ||
| "out" # output standard python package | ||
| "cxxdev" # propagated deps for the cmake consumers of torch |
There was a problem hiding this comment.
how does nix know which ouptut is which here, I mean why does out contain the standard package, and cxxdev the other deps ?
There was a problem hiding this comment.
By default everything goes to out. The other outputs you can move files to manually, e.g. by doing something like
mv $out/somefile $cxxdev/
But here we rely on the CUDA/ROCm setup hooks to put stuff in the cxxdev output.
There was a problem hiding this comment.
Sounds good! thanks for the insights
This output propagates C++ dependencies in a similar way as the from-source Torch derivations.