nixpkgs/pkgs/development/libraries/composable_kernel/default.nix
Madoura 78c7e665d4
rocm-related: move asserts to broken
composable_kernel: move asserts to broken

rocblas: move asserts to broken

rocthrust: move asserts to broken

rocwmma: move asserts to broken
2022-11-28 05:31:00 -06:00

90 lines
2.3 KiB
Nix

{ lib
, stdenv
, fetchFromGitHub
, cmake
, rocm-cmake
, hip
, openmp
, gtest
, buildTests ? false
, buildExamples ? false
, gpuTargets ? [ ] # gpuTargets = [ "gfx803" "gfx900" "gfx1030" ... ]
}:
stdenv.mkDerivation (finalAttrs: {
pname = "composable_kernel";
version = "unstable-2022-11-19";
outputs = [
"out"
] ++ lib.optionals buildTests [
"test"
] ++ lib.optionals buildExamples [
"example"
];
# There is now a release, but it's cpu-only it seems to be for a very specific purpose
# Thus, we're sticking with the develop branch for now...
src = fetchFromGitHub {
owner = "ROCmSoftwarePlatform";
repo = "composable_kernel";
rev = "43a889b72e3faabf04c16ff410d387ce28486c3e";
hash = "sha256-DDRrWKec/RcOhW3CrN0gl9NZsp0Bjnja7HAiTcEh7qg=";
};
nativeBuildInputs = [
cmake
rocm-cmake
hip
];
buildInputs = [
openmp
] ++ lib.optionals buildTests [
gtest
];
cmakeFlags = [
"-DCMAKE_C_COMPILER=hipcc"
"-DCMAKE_CXX_COMPILER=hipcc"
] ++ lib.optionals (gpuTargets != [ ]) [
"-DGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}"
];
# No flags to build selectively it seems...
postPatch = ''
substituteInPlace test/CMakeLists.txt \
--replace "include(googletest)" ""
substituteInPlace CMakeLists.txt \
--replace "enable_testing()" ""
'' + lib.optionalString (!buildTests) ''
substituteInPlace CMakeLists.txt \
--replace "add_subdirectory(test)" ""
'' + lib.optionalString (!buildExamples) ''
substituteInPlace CMakeLists.txt \
--replace "add_subdirectory(example)" ""
'';
postInstall = ''
mkdir -p $out/bin
mv bin/ckProfiler $out/bin
'' + lib.optionalString buildTests ''
mkdir -p $test/bin
mv bin/test_* $test/bin
'' + lib.optionalString buildExamples ''
mkdir -p $example/bin
mv bin/example_* $example/bin
'';
meta = with lib; {
description = "Performance portable programming model for machine learning tensor operators";
homepage = "https://github.com/ROCmSoftwarePlatform/composable_kernel";
license = with licenses; [ mit ];
maintainers = teams.rocm.members;
# Several tests seem to either not compile or have a race condition
# Undefined reference to symbol '_ZTIN7testing4TestE'
# Try removing this next update
broken = buildTests;
};
})