diff options
author | Madoura <madouura@gmail.com> | 2023-10-01 20:05:32 -0500 |
---|---|---|
committer | Madoura <madouura@gmail.com> | 2023-10-09 16:38:51 -0500 |
commit | 575ce47fa4051fbb5c234a10eed923d11257749a (patch) | |
tree | d64f1026c35f2cdc227a220b3381fc03f5a4ea00 /pkgs/development/rocm-modules/5/rocblas | |
parent | 12e7fc6923688a08152ee937d00e272502d2ed63 (diff) |
rocm-related: move all relevant ROCm derivations to rocmPackages
clr: init at 5.7.0 (hipamd, opencl, rocclr merged)
Diffstat (limited to 'pkgs/development/rocm-modules/5/rocblas')
-rw-r--r-- | pkgs/development/rocm-modules/5/rocblas/default.nix | 139 |
1 files changed, 139 insertions, 0 deletions
diff --git a/pkgs/development/rocm-modules/5/rocblas/default.nix b/pkgs/development/rocm-modules/5/rocblas/default.nix new file mode 100644 index 0000000000000..59d23ad121da8 --- /dev/null +++ b/pkgs/development/rocm-modules/5/rocblas/default.nix @@ -0,0 +1,139 @@ +{ lib +, stdenv +, fetchFromGitHub +, rocmUpdateScript +, cmake +, rocm-cmake +, hip +, python3 +, tensile +, msgpack +, libxml2 +, gtest +, gfortran +, openmp +, amd-blis +, python3Packages +, buildTensile ? true +, buildTests ? false +, buildBenchmarks ? false +, tensileLogic ? "asm_full" +, tensileCOVersion ? "V3" +, tensileSepArch ? true +, tensileLazyLib ? true +, tensileLibFormat ? "msgpack" +, gpuTargets ? [ "all" ] +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "rocblas"; + version = "5.7.0"; + + outputs = [ + "out" + ] ++ lib.optionals buildTests [ + "test" + ] ++ lib.optionals buildBenchmarks [ + "benchmark" + ]; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "rocBLAS"; + rev = "rocm-${finalAttrs.version}"; + hash = "sha256-3wKnwvAra8u9xqlC05wUD+gSoBILTVJFU2cIV6xv3Lk="; + }; + + nativeBuildInputs = [ + cmake + rocm-cmake + hip + ]; + + buildInputs = [ + python3 + ] ++ lib.optionals buildTensile [ + msgpack + libxml2 + python3Packages.msgpack + ] ++ lib.optionals buildTests [ + gtest + ] ++ lib.optionals (buildTests || buildBenchmarks) [ + gfortran + openmp + amd-blis + ] ++ lib.optionals (buildTensile || buildTests || buildBenchmarks) [ + python3Packages.pyyaml + ]; + + cmakeFlags = [ + "-DCMAKE_C_COMPILER=hipcc" + "-DCMAKE_CXX_COMPILER=hipcc" + "-Dpython=python3" + "-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" + "-DBUILD_WITH_TENSILE=${if buildTensile then "ON" else "OFF"}" + # Manually define CMAKE_INSTALL_<DIR> + # See: https://github.com/NixOS/nixpkgs/pull/197838 + "-DCMAKE_INSTALL_BINDIR=bin" + "-DCMAKE_INSTALL_LIBDIR=lib" + "-DCMAKE_INSTALL_INCLUDEDIR=include" + ] ++ lib.optionals buildTensile [ + "-DVIRTUALENV_HOME_DIR=/build/source/tensile" + "-DTensile_TEST_LOCAL_PATH=/build/source/tensile" + "-DTensile_ROOT=/build/source/tensile/lib/python${python3.pythonVersion}/site-packages/Tensile" + "-DTensile_LOGIC=${tensileLogic}" + "-DTensile_CODE_OBJECT_VERSION=${tensileCOVersion}" + "-DTensile_SEPARATE_ARCHITECTURES=${if tensileSepArch then "ON" else "OFF"}" + "-DTensile_LAZY_LIBRARY_LOADING=${if tensileLazyLib then "ON" else "OFF"}" + "-DTensile_LIBRARY_FORMAT=${tensileLibFormat}" + ] ++ lib.optionals buildTests [ + "-DBUILD_CLIENTS_TESTS=ON" + ] ++ lib.optionals buildBenchmarks [ + "-DBUILD_CLIENTS_BENCHMARKS=ON" + ] ++ lib.optionals (buildTests || buildBenchmarks) [ + "-DCMAKE_CXX_FLAGS=-I${amd-blis}/include/blis" + ]; + + # Tensile REALLY wants to write to the nix directory if we include it normally + postPatch = lib.optionalString buildTensile '' + cp -a ${tensile} tensile + chmod +w -R tensile + + # Rewrap Tensile + substituteInPlace tensile/bin/{.t*,.T*,*} \ + --replace "${tensile}" "/build/source/tensile" + + substituteInPlace CMakeLists.txt \ + --replace "include(virtualenv)" "" \ + --replace "virtualenv_install(\''${Tensile_TEST_LOCAL_PATH})" "" + ''; + + postInstall = lib.optionalString buildTests '' + mkdir -p $test/bin + cp -a $out/bin/* $test/bin + rm $test/bin/*-bench || true + '' + lib.optionalString buildBenchmarks '' + mkdir -p $benchmark/bin + cp -a $out/bin/* $benchmark/bin + rm $benchmark/bin/*-test || true + '' + lib.optionalString (buildTests || buildBenchmarks ) '' + rm -rf $out/bin + ''; + + passthru.updateScript = rocmUpdateScript { + name = finalAttrs.pname; + owner = finalAttrs.src.owner; + repo = finalAttrs.src.repo; + }; + + requiredSystemFeatures = [ "big-parallel" ]; + + meta = with lib; { + description = "BLAS implementation for ROCm platform"; + homepage = "https://github.com/ROCmSoftwarePlatform/rocBLAS"; + license = with licenses; [ mit ]; + maintainers = teams.rocm.members; + platforms = platforms.linux; + broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version; + }; +}) |