mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-11-13 09:17:07 +03:00
rocm-related: fixup for ROCm 5.7.0
blender: fixup for ROCm 5.7.0 opensycl: fixup for ROCm 5.7.0 magma: fixup for ROCm 5.7.0 torch: fixup for ROCm 5.7.0 cp2k: fixup for ROCm 5.7.0 sirius: fixup for ROCm 5.7.0 spfft: fixup for ROCm 5.7.0 spla: fixup for ROCm 5.7.0
This commit is contained in:
parent
6f39d63688
commit
e6f88a9a82
@ -6,7 +6,7 @@
|
||||
, zlib, zstd, fftw, opensubdiv, freetype, jemalloc, ocl-icd, addOpenGLRunpath
|
||||
, jackaudioSupport ? false, libjack2
|
||||
, cudaSupport ? config.cudaSupport, cudaPackages ? { }
|
||||
, hipSupport ? false, hip # comes with a significantly larger closure size
|
||||
, hipSupport ? false, rocmPackages # comes with a significantly larger closure size
|
||||
, colladaSupport ? true, opencollada
|
||||
, spaceNavSupport ? stdenv.isLinux, libspnav
|
||||
, makeWrapper
|
||||
@ -103,8 +103,8 @@ stdenv.mkDerivation (finalAttrs: rec {
|
||||
substituteInPlace extern/clew/src/clew.c --replace '"libOpenCL.so"' '"${ocl-icd}/lib/libOpenCL.so"'
|
||||
'') +
|
||||
(lib.optionalString hipSupport ''
|
||||
substituteInPlace extern/hipew/src/hipew.c --replace '"/opt/rocm/hip/lib/libamdhip64.so"' '"${hip}/lib/libamdhip64.so"'
|
||||
substituteInPlace extern/hipew/src/hipew.c --replace '"opt/rocm/hip/bin"' '"${hip}/bin"'
|
||||
substituteInPlace extern/hipew/src/hipew.c --replace '"/opt/rocm/hip/lib/libamdhip64.so"' '"${rocmPackages.clr}/lib/libamdhip64.so"'
|
||||
substituteInPlace extern/hipew/src/hipew.c --replace '"opt/rocm/hip/bin"' '"${rocmPackages.clr}/bin"'
|
||||
'');
|
||||
|
||||
cmakeFlags =
|
||||
|
@ -37,11 +37,7 @@
|
||||
# and for Nvidia see https://github.com/cp2k/cp2k/blob/master/INSTALL.md#2i-cuda-optional-improved-performance-on-gpu-systems
|
||||
, gpuVersion ? "Mi100"
|
||||
, gpuArch ? "gfx908"
|
||||
, rocm-core
|
||||
, hip
|
||||
, hipblas
|
||||
, hipfft
|
||||
, rocblas
|
||||
, rocmPackages
|
||||
}:
|
||||
|
||||
assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ];
|
||||
@ -86,7 +82,13 @@ stdenv.mkDerivation rec {
|
||||
]
|
||||
++ lib.optional enableElpa elpa
|
||||
++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit
|
||||
++ lib.optional (gpuBackend == "rocm") [hip rocm-core hipblas hipfft rocblas]
|
||||
++ lib.optional (gpuBackend == "rocm") [
|
||||
rocmPackages.clr
|
||||
rocmPackages.rocm-core
|
||||
rocmPackages.hipblas
|
||||
rocmPackages.hipfft
|
||||
rocmPackages.rocblas
|
||||
]
|
||||
;
|
||||
|
||||
propagatedBuildInputs = [ mpi ];
|
||||
@ -126,7 +128,7 @@ stdenv.mkDerivation rec {
|
||||
${lib.strings.optionalString (gpuBackend == "rocm") ''
|
||||
GPUVER = ${gpuVersion}
|
||||
OFFLOAD_CC = hipcc
|
||||
OFFLOAD_FLAGS = -fopenmp -m64 -pthread -fPIC -D__GRID_HIP -O2 --offload-arch=${gpuArch} --rocm-path=${rocm-core}
|
||||
OFFLOAD_FLAGS = -fopenmp -m64 -pthread -fPIC -D__GRID_HIP -O2 --offload-arch=${gpuArch} --rocm-path=${rocmPackages.rocm-core}
|
||||
OFFLOAD_TARGET = hip
|
||||
CXX = mpicxx
|
||||
CXXFLAGS = -std=c++11 -fopenmp -D__HIP_PLATFORM_AMD__
|
||||
|
@ -23,8 +23,7 @@
|
||||
, llvmPackages
|
||||
, gpuBackend ? "none"
|
||||
, cudaPackages
|
||||
, hip
|
||||
, rocblas
|
||||
, rocmPackages
|
||||
}:
|
||||
|
||||
assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ];
|
||||
@ -67,8 +66,10 @@ stdenv.mkDerivation rec {
|
||||
libvdwxc
|
||||
]
|
||||
++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit
|
||||
++ lib.optionals (gpuBackend == "rocm") [ hip rocblas ]
|
||||
++ lib.optional stdenv.isDarwin llvmPackages.openmp
|
||||
++ lib.optionals (gpuBackend == "rocm") [
|
||||
rocmPackages.clr
|
||||
rocmPackages.rocblas
|
||||
] ++ lib.optional stdenv.isDarwin llvmPackages.openmp
|
||||
;
|
||||
|
||||
propagatedBuildInputs = [ mpi ];
|
||||
@ -87,7 +88,7 @@ stdenv.mkDerivation rec {
|
||||
]
|
||||
++ lib.optionals (gpuBackend == "rocm") [
|
||||
"-DUSE_ROCM=ON"
|
||||
"-DHIP_ROOT_DIR=${hip}"
|
||||
"-DHIP_ROOT_DIR=${rocmPackages.clr}"
|
||||
];
|
||||
|
||||
doCheck = true;
|
||||
|
@ -8,9 +8,7 @@
|
||||
, llvmPackages
|
||||
, gpuBackend ? "none"
|
||||
, cudaPackages
|
||||
, hip
|
||||
, rocfft
|
||||
, hipfft
|
||||
, rocmPackages
|
||||
}:
|
||||
|
||||
assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ];
|
||||
@ -35,8 +33,11 @@ stdenv.mkDerivation rec {
|
||||
fftw
|
||||
]
|
||||
++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit
|
||||
++ lib.optionals (gpuBackend == "rocm") [ hip rocfft hipfft ]
|
||||
++ lib.optional stdenv.isDarwin llvmPackages.openmp
|
||||
++ lib.optionals (gpuBackend == "rocm") [
|
||||
rocmPackages.clr
|
||||
rocmPackages.rocfft
|
||||
rocmPackages.hipfft
|
||||
] ++ lib.optional stdenv.isDarwin llvmPackages.openmp
|
||||
;
|
||||
|
||||
propagatedBuildInputs = [ mpi ];
|
||||
@ -53,7 +54,7 @@ stdenv.mkDerivation rec {
|
||||
++ lib.optional (gpuBackend == "cuda") "-DSPFFT_GPU_BACKEND=CUDA"
|
||||
++ lib.optionals (gpuBackend == "rocm") [
|
||||
"-DSPFFT_GPU_BACKEND=ROCM"
|
||||
"-DHIP_ROOT_DIR=${hip}"
|
||||
"-DHIP_ROOT_DIR=${rocmPackages.clr}"
|
||||
];
|
||||
|
||||
|
||||
|
@ -8,8 +8,7 @@
|
||||
, llvmPackages
|
||||
, gpuBackend ? "none"
|
||||
, cudaPackages
|
||||
, hip
|
||||
, rocblas
|
||||
, rocmPackages
|
||||
}:
|
||||
|
||||
assert builtins.elem gpuBackend [ "none" "cuda" "rocm" ];
|
||||
@ -39,8 +38,10 @@ stdenv.mkDerivation rec {
|
||||
blas
|
||||
]
|
||||
++ lib.optional (gpuBackend == "cuda") cudaPackages.cudatoolkit
|
||||
++ lib.optionals (gpuBackend == "rocm") [ hip rocblas rocblas ]
|
||||
++ lib.optional stdenv.isDarwin llvmPackages.openmp
|
||||
++ lib.optionals (gpuBackend == "rocm") [
|
||||
rocmPackages.clr
|
||||
rocmPackages.rocblas
|
||||
] ++ lib.optional stdenv.isDarwin llvmPackages.openmp
|
||||
;
|
||||
|
||||
propagatedBuildInputs = [ mpi ];
|
||||
|
@ -2,15 +2,13 @@
|
||||
, fetchFromGitHub
|
||||
, llvmPackages_15
|
||||
, lld_15
|
||||
, rocm-device-libs
|
||||
, python3
|
||||
, rocm-runtime
|
||||
, cmake
|
||||
, boost
|
||||
, libxml2
|
||||
, libffi
|
||||
, makeWrapper
|
||||
, hip
|
||||
, rocmPackages
|
||||
, rocmSupport ? false
|
||||
}:
|
||||
let
|
||||
@ -40,8 +38,8 @@ stdenv.mkDerivation rec {
|
||||
llvmPackages_15.libclang.dev
|
||||
llvmPackages_15.llvm
|
||||
] ++ lib.optionals rocmSupport [
|
||||
hip
|
||||
rocm-runtime
|
||||
rocmPackages.clr
|
||||
rocmPackages.rocm-runtime
|
||||
];
|
||||
|
||||
# opensycl makes use of clangs internal headers. Its cmake does not successfully discover them automatically on nixos, so we supply the path manually
|
||||
@ -55,7 +53,7 @@ stdenv.mkDerivation rec {
|
||||
--add-flags "-L${llvmPackages_15.openmp}/lib" \
|
||||
--add-flags "-I${llvmPackages_15.openmp.dev}/include" \
|
||||
'' + lib.optionalString rocmSupport ''
|
||||
--add-flags "--rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode"
|
||||
--add-flags "--rocm-device-lib-path=${rocmPackages.rocm-device-libs}/amdgcn/bitcode"
|
||||
'';
|
||||
|
||||
meta = with lib; {
|
||||
|
@ -18,15 +18,12 @@
|
||||
, gfortran
|
||||
, cudaCapabilities ? cudaPackages.cudaFlags.cudaCapabilities
|
||||
, gpuTargets ? [ ] # Non-CUDA targets, that is HIP
|
||||
, hip
|
||||
, hipblas
|
||||
, hipsparse
|
||||
, rocmPackages
|
||||
, lapack
|
||||
, lib
|
||||
, libpthreadstubs
|
||||
, magmaRelease
|
||||
, ninja
|
||||
, openmp
|
||||
, rocmSupport ? false
|
||||
, static ? false
|
||||
, stdenv
|
||||
@ -47,7 +44,7 @@ let
|
||||
# NOTE: The hip.gpuTargets are prefixed with "gfx" instead of "sm" like cudaFlags.realArches.
|
||||
# For some reason, Magma's CMakeLists.txt file does not handle the "gfx" prefix, so we must
|
||||
# remove it.
|
||||
rocmArches = lists.map (x: strings.removePrefix "gfx" x) hip.gpuTargets;
|
||||
rocmArches = lists.map (x: strings.removePrefix "gfx" x) rocmPackages.clr.gpuTargets;
|
||||
supportedRocmArches = lists.intersectLists rocmArches supportedGpuTargets;
|
||||
unsupportedRocmArches = lists.subtractLists supportedRocmArches rocmArches;
|
||||
|
||||
@ -125,10 +122,10 @@ stdenv.mkDerivation {
|
||||
] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.8") [
|
||||
cuda_profiler_api.dev # <cuda_profiler_api.h>
|
||||
]) ++ lists.optionals rocmSupport [
|
||||
hip
|
||||
hipblas
|
||||
hipsparse
|
||||
openmp
|
||||
rocmPackages.clr
|
||||
rocmPackages.hipblas
|
||||
rocmPackages.hipsparse
|
||||
rocmPackages.llvm.openmp
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
@ -142,8 +139,8 @@ stdenv.mkDerivation {
|
||||
"-DCMAKE_CXX_COMPILER=${backendStdenv.cc}/bin/c++"
|
||||
"-DMAGMA_ENABLE_CUDA=ON"
|
||||
] ++ lists.optionals rocmSupport [
|
||||
"-DCMAKE_C_COMPILER=${hip}/bin/hipcc"
|
||||
"-DCMAKE_CXX_COMPILER=${hip}/bin/hipcc"
|
||||
"-DCMAKE_C_COMPILER=${rocmPackages.clr}/bin/hipcc"
|
||||
"-DCMAKE_CXX_COMPILER=${rocmPackages.clr}/bin/hipcc"
|
||||
"-DMAGMA_ENABLE_HIP=ON"
|
||||
];
|
||||
|
||||
|
@ -43,11 +43,7 @@
|
||||
|
||||
# ROCm dependencies
|
||||
rocmSupport ? false,
|
||||
gpuTargets ? [ ],
|
||||
openmp, rocm-core, hip, rccl, miopen, miopengemm, rocrand, rocblas,
|
||||
rocfft, rocsparse, hipsparse, rocthrust, rocprim, hipcub, roctracer,
|
||||
rocsolver, hipfft, hipsolver, hipblas, rocminfo, rocm-thunk, rocm-comgr,
|
||||
rocm-device-libs, rocm-runtime, rocm-opencl-runtime, hipify
|
||||
gpuTargets ? [ ], rocmPackages
|
||||
}:
|
||||
|
||||
let
|
||||
@ -89,7 +85,7 @@ let
|
||||
else if cudaSupport then
|
||||
gpuArchWarner supportedCudaCapabilities unsupportedCudaCapabilities
|
||||
else if rocmSupport then
|
||||
hip.gpuTargets
|
||||
rocmPackages.clr.gpuTargets
|
||||
else
|
||||
throw "No GPU targets specified"
|
||||
);
|
||||
@ -97,12 +93,13 @@ let
|
||||
rocmtoolkit_joined = symlinkJoin {
|
||||
name = "rocm-merged";
|
||||
|
||||
paths = [
|
||||
rocm-core hip rccl miopen miopengemm rocrand rocblas
|
||||
rocfft rocsparse hipsparse rocthrust rocprim hipcub
|
||||
roctracer rocfft rocsolver hipfft hipsolver hipblas
|
||||
paths = with rocmPackages; [
|
||||
rocm-core clr rccl miopen miopengemm rocrand rocblas
|
||||
rocsparse hipsparse rocthrust rocprim hipcub
|
||||
roctracer # Unfree at the moment due to hsa-amd-aqlprofile hard dependency in rocprofiler
|
||||
rocfft rocsolver hipfft hipsolver hipblas
|
||||
rocminfo rocm-thunk rocm-comgr rocm-device-libs
|
||||
rocm-runtime rocm-opencl-runtime hipify
|
||||
rocm-runtime clr.icd hipify
|
||||
];
|
||||
};
|
||||
|
||||
@ -170,7 +167,7 @@ in buildPythonPackage rec {
|
||||
# Strangely, this is never set in cmake
|
||||
substituteInPlace cmake/public/LoadHIP.cmake \
|
||||
--replace "set(ROCM_PATH \$ENV{ROCM_PATH})" \
|
||||
"set(ROCM_PATH \$ENV{ROCM_PATH})''\nset(ROCM_VERSION ${lib.concatStrings (lib.intersperse "0" (lib.splitString "." hip.version))})"
|
||||
"set(ROCM_PATH \$ENV{ROCM_PATH})''\nset(ROCM_VERSION ${lib.concatStrings (lib.intersperse "0" (lib.splitString "." rocmPackages.clr.version))})"
|
||||
''
|
||||
# Detection of NCCL version doesn't work particularly well when using the static binary.
|
||||
+ lib.optionalString cudaSupport ''
|
||||
@ -323,7 +320,7 @@ in buildPythonPackage rec {
|
||||
] ++ lists.optionals (strings.versionAtLeast cudaVersion "11.8") [
|
||||
cuda_profiler_api.dev # <cuda_profiler_api.h>
|
||||
])
|
||||
++ lib.optionals rocmSupport [ openmp ]
|
||||
++ lib.optionals rocmSupport [ rocmPackages.llvm.openmp ]
|
||||
++ lib.optionals (cudaSupport || rocmSupport) [ magma ]
|
||||
++ lib.optionals stdenv.isLinux [ numactl ]
|
||||
++ lib.optionals stdenv.isDarwin [ Accelerate CoreServices libobjc ];
|
||||
|
@ -30690,7 +30690,6 @@ with pkgs;
|
||||
# LLVM 11 crashes when compiling GHOST_SystemCocoa.mm
|
||||
stdenv = if stdenv.isDarwin then llvmPackages_10.stdenv else stdenv;
|
||||
inherit (darwin.apple_sdk.frameworks) Cocoa CoreGraphics ForceFeedback OpenAL OpenGL;
|
||||
inherit (rocmPackages) hip;
|
||||
};
|
||||
|
||||
blender-with-packages = callPackage ../applications/misc/blender/wrapper.nix { };
|
||||
@ -39262,10 +39261,7 @@ with pkgs;
|
||||
|
||||
lie = callPackage ../applications/science/math/LiE { };
|
||||
|
||||
inherit (callPackage ../development/libraries/science/math/magma {
|
||||
inherit (rocmPackages.llvm) openmp;
|
||||
inherit (rocmPackages) hip hipblas hipsparse;
|
||||
}) magma magma_2_7_2 magma_2_6_2;
|
||||
inherit (callPackage ../development/libraries/science/math/magma { }) magma magma_2_7_2 magma_2_6_2;
|
||||
|
||||
magma-cuda = magma.override {
|
||||
cudaSupport = true;
|
||||
@ -39276,8 +39272,7 @@ with pkgs;
|
||||
static = true;
|
||||
};
|
||||
|
||||
# TODO:AMD won't compile with anything newer than 2.6.2 -- it fails at the linking stage.
|
||||
magma-hip = magma_2_6_2.override {
|
||||
magma-hip = magma.override {
|
||||
cudaSupport = false;
|
||||
rocmSupport = true;
|
||||
};
|
||||
|
@ -13904,7 +13904,6 @@ self: super: with self; {
|
||||
else pkgs.magma;
|
||||
inherit (pkgs.darwin.apple_sdk.frameworks) Accelerate CoreServices;
|
||||
inherit (pkgs.darwin) libobjc;
|
||||
inherit (pkgs.rocmPackages.llvm) openmp;
|
||||
};
|
||||
|
||||
torch-bin = callPackage ../development/python-modules/torch/bin.nix {
|
||||
|
Loading…
Reference in New Issue
Block a user