Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at domenkozar-patch-1 93 lines 2.4 kB view raw
1{ lib 2, stdenv 3, fetchFromGitHub 4, unstableGitUpdater 5, cmake 6, rocm-cmake 7, hip 8, openmp 9, gtest 10, buildTests ? false 11, buildExamples ? false 12, gpuTargets ? [ ] # gpuTargets = [ "gfx803" "gfx900" "gfx1030" ... ] 13}: 14 15stdenv.mkDerivation (finalAttrs: { 16 pname = "composable_kernel"; 17 version = "unstable-2022-12-08"; 18 19 outputs = [ 20 "out" 21 ] ++ lib.optionals buildTests [ 22 "test" 23 ] ++ lib.optionals buildExamples [ 24 "example" 25 ]; 26 27 # There is now a release, but it's cpu-only it seems to be for a very specific purpose 28 # Thus, we're sticking with the develop branch for now... 29 src = fetchFromGitHub { 30 owner = "ROCmSoftwarePlatform"; 31 repo = "composable_kernel"; 32 rev = "d58b7f5155b44c8b608f3edc6a6eab314493ec1a"; 33 hash = "sha256-4nzyaWhPnY/0TygcoJAqVzdgfXOkf+o/BE2V9N+Bm7Q="; 34 }; 35 36 nativeBuildInputs = [ 37 cmake 38 rocm-cmake 39 hip 40 ]; 41 42 buildInputs = [ 43 openmp 44 ] ++ lib.optionals buildTests [ 45 gtest 46 ]; 47 48 cmakeFlags = [ 49 "-DCMAKE_C_COMPILER=hipcc" 50 "-DCMAKE_CXX_COMPILER=hipcc" 51 ] ++ lib.optionals (gpuTargets != [ ]) [ 52 "-DGPU_TARGETS=${lib.concatStringsSep ";" gpuTargets}" 53 ]; 54 55 # No flags to build selectively it seems... 56 postPatch = '' 57 substituteInPlace test/CMakeLists.txt \ 58 --replace "include(googletest)" "" 59 60 substituteInPlace CMakeLists.txt \ 61 --replace "enable_testing()" "" 62 '' + lib.optionalString (!buildTests) '' 63 substituteInPlace CMakeLists.txt \ 64 --replace "add_subdirectory(test)" "" 65 '' + lib.optionalString (!buildExamples) '' 66 substituteInPlace CMakeLists.txt \ 67 --replace "add_subdirectory(example)" "" 68 ''; 69 70 postInstall = '' 71 mkdir -p $out/bin 72 mv bin/ckProfiler $out/bin 73 '' + lib.optionalString buildTests '' 74 mkdir -p $test/bin 75 mv bin/test_* $test/bin 76 '' + lib.optionalString buildExamples '' 77 mkdir -p $example/bin 78 mv bin/example_* $example/bin 79 ''; 80 81 passthru.updateScript = unstableGitUpdater { }; 82 83 meta = with lib; { 84 description = "Performance portable programming model for machine learning tensor operators"; 85 homepage = "https://github.com/ROCmSoftwarePlatform/composable_kernel"; 86 license = with licenses; [ mit ]; 87 maintainers = teams.rocm.members; 88 # Several tests seem to either not compile or have a race condition 89 # Undefined reference to symbol '_ZTIN7testing4TestE' 90 # Try removing this next update 91 broken = buildTests; 92 }; 93})