rocmPackages.mivisionx: init at 5.7.0
This commit is contained in:
parent
4fa5f7334a
commit
56c11dd1fd
2 changed files with 191 additions and 0 deletions
|
@ -1,9 +1,14 @@
|
|||
{ callPackage
|
||||
, recurseIntoAttrs
|
||||
, fetchFromGitHub
|
||||
, cudaPackages
|
||||
, python3Packages
|
||||
, elfutils
|
||||
, boost179
|
||||
, opencv
|
||||
, ffmpeg_4
|
||||
, libjpeg_turbo
|
||||
, rapidjson-unstable
|
||||
}:
|
||||
|
||||
let
|
||||
|
@ -291,4 +296,45 @@ in rec {
|
|||
useOpenCL = false;
|
||||
useCPU = true;
|
||||
};
|
||||
|
||||
mivisionx = callPackage ./mivisionx {
|
||||
inherit rocmUpdateScript rocm-cmake rocm-device-libs clr rpp rocblas miopengemm miopen migraphx half rocm-docs-core;
|
||||
inherit (llvm) clang openmp;
|
||||
opencv = opencv.override { enablePython = true; };
|
||||
ffmpeg = ffmpeg_4;
|
||||
rapidjson = rapidjson-unstable;
|
||||
stdenv = llvm.rocmClangStdenv;
|
||||
|
||||
# Unfortunately, rocAL needs a custom libjpeg-turbo until further notice
|
||||
# See: https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX/issues/1051
|
||||
libjpeg_turbo = libjpeg_turbo.overrideAttrs {
|
||||
version = "2.0.6.1";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "rrawther";
|
||||
repo = "libjpeg-turbo";
|
||||
rev = "640d7ee1917fcd3b6a5271aa6cf4576bccc7c5fb";
|
||||
sha256 = "sha256-T52whJ7nZi8jerJaZtYInC2YDN0QM+9tUDqiNr6IsNY=";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
mivisionx-hip = mivisionx.override {
|
||||
rpp = rpp-hip;
|
||||
useOpenCL = false;
|
||||
useCPU = false;
|
||||
};
|
||||
|
||||
mivisionx-opencl = mivisionx.override {
|
||||
rpp = rpp-opencl;
|
||||
miopen = miopen-opencl;
|
||||
useOpenCL = true;
|
||||
useCPU = false;
|
||||
};
|
||||
|
||||
mivisionx-cpu = mivisionx.override {
|
||||
rpp = rpp-cpu;
|
||||
useOpenCL = false;
|
||||
useCPU = true;
|
||||
};
|
||||
}
|
||||
|
|
145
pkgs/development/rocm-modules/5/mivisionx/default.nix
Normal file
145
pkgs/development/rocm-modules/5/mivisionx/default.nix
Normal file
|
@ -0,0 +1,145 @@
|
|||
{ lib
|
||||
, stdenv
|
||||
, fetchFromGitHub
|
||||
, rocmUpdateScript
|
||||
, cmake
|
||||
, rocm-cmake
|
||||
, rocm-device-libs
|
||||
, clr
|
||||
, pkg-config
|
||||
, rpp
|
||||
, rocblas
|
||||
, miopengemm
|
||||
, miopen
|
||||
, migraphx
|
||||
, clang
|
||||
, openmp
|
||||
, protobuf
|
||||
, qtcreator
|
||||
, opencv
|
||||
, ffmpeg
|
||||
, boost
|
||||
, libjpeg_turbo
|
||||
, half
|
||||
, lmdb
|
||||
, rapidjson
|
||||
, rocm-docs-core
|
||||
, python3Packages
|
||||
, useOpenCL ? false
|
||||
, useCPU ? false
|
||||
, buildDocs ? false # Needs internet
|
||||
, gpuTargets ? [ ]
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation (finalAttrs: {
|
||||
pname = "mivisionx-" + (
|
||||
if (!useOpenCL && !useCPU) then "hip"
|
||||
else if (!useOpenCL && !useCPU) then "opencl"
|
||||
else "cpu"
|
||||
);
|
||||
|
||||
version = "5.7.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "GPUOpen-ProfessionalCompute-Libraries";
|
||||
repo = "MIVisionX";
|
||||
rev = "rocm-${finalAttrs.version}";
|
||||
hash = "sha256-Z7UIqJWuSD+/FoZ1VIbITp4R/bwaqFCQqsL8CRW73Ek=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
rocm-cmake
|
||||
clr
|
||||
pkg-config
|
||||
] ++ lib.optionals buildDocs [
|
||||
rocm-docs-core
|
||||
python3Packages.python
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
miopengemm
|
||||
miopen
|
||||
migraphx
|
||||
rpp
|
||||
rocblas
|
||||
openmp
|
||||
half
|
||||
protobuf
|
||||
qtcreator
|
||||
opencv
|
||||
ffmpeg
|
||||
boost
|
||||
libjpeg_turbo
|
||||
lmdb
|
||||
rapidjson
|
||||
python3Packages.pybind11
|
||||
python3Packages.numpy
|
||||
python3Packages.torchWithRocm
|
||||
];
|
||||
|
||||
cmakeFlags = [
|
||||
"-DROCM_PATH=${clr}"
|
||||
"-DAMDRPP_PATH=${rpp}"
|
||||
# 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"
|
||||
"-DCMAKE_INSTALL_PREFIX_PYTHON=lib"
|
||||
# "-DAMD_FP16_SUPPORT=ON" `error: typedef redefinition with different types ('__half' vs 'half_float::half')`
|
||||
] ++ lib.optionals (gpuTargets != [ ]) [
|
||||
"-DAMDGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
|
||||
] ++ lib.optionals (!useOpenCL && !useCPU) [
|
||||
"-DBACKEND=HIP"
|
||||
] ++ lib.optionals (useOpenCL && !useCPU) [
|
||||
"-DBACKEND=OCL"
|
||||
] ++ lib.optionals useCPU [
|
||||
"-DBACKEND=CPU"
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# We need to not use hipcc and define the CXXFLAGS manually due to `undefined hidden symbol: tensorflow:: ...`
|
||||
export CXXFLAGS+="--rocm-path=${clr} --rocm-device-lib-path=${rocm-device-libs}/amdgcn/bitcode"
|
||||
patchShebangs rocAL/rocAL_pybind/examples
|
||||
|
||||
# Properly find miopengemm and miopen
|
||||
substituteInPlace amd_openvx_extensions/CMakeLists.txt \
|
||||
--replace "miopengemm PATHS \''${ROCM_PATH} QUIET" "miopengemm PATHS ${miopengemm} QUIET" \
|
||||
--replace "miopen PATHS \''${ROCM_PATH} QUIET" "miopen PATHS ${miopen} QUIET" \
|
||||
--replace "\''${ROCM_PATH}/include/miopen/config.h" "${miopen}/include/miopen/config.h"
|
||||
|
||||
# Properly find turbojpeg
|
||||
substituteInPlace amd_openvx/cmake/FindTurboJpeg.cmake \
|
||||
--replace "\''${TURBO_JPEG_PATH}/include" "${libjpeg_turbo.dev}/include" \
|
||||
--replace "\''${TURBO_JPEG_PATH}/lib" "${libjpeg_turbo.out}/lib"
|
||||
|
||||
# Fix bad paths
|
||||
substituteInPlace rocAL/rocAL/rocAL_hip/CMakeLists.txt amd_openvx_extensions/amd_nn/nn_hip/CMakeLists.txt amd_openvx/openvx/hipvx/CMakeLists.txt \
|
||||
--replace "COMPILER_FOR_HIP \''${ROCM_PATH}/llvm/bin/clang++" "COMPILER_FOR_HIP ${clang}/bin/clang++"
|
||||
'';
|
||||
|
||||
postBuild = lib.optionalString buildDocs ''
|
||||
python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en ../docs _build/html
|
||||
'';
|
||||
|
||||
postInstall = lib.optionalString (!useOpenCL && !useCPU) ''
|
||||
patchelf $out/lib/rocal_pybind*.so --shrink-rpath --allowed-rpath-prefixes "$NIX_STORE"
|
||||
chmod +x $out/lib/rocal_pybind*.so
|
||||
'';
|
||||
|
||||
passthru.updateScript = rocmUpdateScript {
|
||||
name = finalAttrs.pname;
|
||||
owner = finalAttrs.src.owner;
|
||||
repo = finalAttrs.src.repo;
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
description = "Set of comprehensive computer vision and machine intelligence libraries, utilities, and applications";
|
||||
homepage = "https://github.com/GPUOpen-ProfessionalCompute-Libraries/MIVisionX";
|
||||
license = with licenses; [ mit ];
|
||||
maintainers = teams.rocm.members;
|
||||
platforms = platforms.linux;
|
||||
broken = versions.minor finalAttrs.version != versions.minor stdenv.cc.version;
|
||||
};
|
||||
})
|
Loading…
Reference in a new issue