mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-30 16:10:36 +00:00
{cp2k,umpire}: fix cuda builds (#576324)
This commit is contained in:
@@ -36,6 +36,7 @@
|
||||
toml-f,
|
||||
greenx,
|
||||
gmp,
|
||||
addDriverRunpath,
|
||||
enableElpa ? false,
|
||||
elpa,
|
||||
cudaPackages,
|
||||
@@ -168,6 +169,7 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
]
|
||||
++ lib.optionals (gpuBackend == "cuda") [
|
||||
cudaPackages.cuda_nvcc
|
||||
addDriverRunpath
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
@@ -267,6 +269,14 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
mkdir -p $out/share/cp2k
|
||||
cp -r ../data/* $out/share/cp2k
|
||||
|
||||
# Patch RPATH so libcuda.so.1 (NVIDIA driver) is found at runtime.
|
||||
# Must run before wrapProgram, which renames the original ELF binary.
|
||||
${lib.optionalString (gpuBackend == "cuda") ''
|
||||
for i in $out/bin/* $out/lib/*.so*; do
|
||||
addDriverRunpath "$i" || true
|
||||
done
|
||||
''}
|
||||
|
||||
for i in $out/bin/*; do
|
||||
wrapProgram $i \
|
||||
--set-default CP2K_DATA_DIR $out/share/cp2k \
|
||||
|
||||
@@ -80,6 +80,12 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
# can be found across outputs.
|
||||
substituteInPlace cmake/siriusConfig.cmake.in \
|
||||
--replace-fail "NO_DEFAULT_PATH" ""
|
||||
|
||||
# src/CMakeLists.txt uses ''${CMAKE_CUDA_ARCHITECTURES} unquoted in
|
||||
# set_target_properties, which breaks when multiple architectures are
|
||||
# set (semicolon-separated list splits into separate arguments).
|
||||
substituteInPlace src/CMakeLists.txt \
|
||||
--replace-fail 'CUDA_ARCHITECTURES ''${CMAKE_CUDA_ARCHITECTURES}' 'CUDA_ARCHITECTURES "''${CMAKE_CUDA_ARCHITECTURES}"'
|
||||
'';
|
||||
|
||||
outputs = [
|
||||
|
||||
@@ -61,6 +61,9 @@ stdenv.mkDerivation (finalAttrs: {
|
||||
lib.optionals cudaSupport [
|
||||
"-DENABLE_CUDA=ON"
|
||||
(lib.cmakeFeature "CMAKE_CUDA_ARCHITECTURES" cudaPackages.flags.cmakeCudaArchitecturesString)
|
||||
# The bundled camp test resource_aware_pool_tests.cpp uses brace-
|
||||
# initialization syntax that nvcc cannot compile.
|
||||
"-DENABLE_TESTS=OFF"
|
||||
]
|
||||
++ lib.optionals rocmSupport [
|
||||
"-DENABLE_HIP=ON"
|
||||
|
||||
Reference in New Issue
Block a user