diff --git a/pkgs/development/libraries/rocwmma/0000-dont-fetch-googletest.patch b/pkgs/development/libraries/rocwmma/0000-dont-fetch-googletest.patch new file mode 100644 index 0000000000000..7208d20a2127e --- /dev/null +++ b/pkgs/development/libraries/rocwmma/0000-dont-fetch-googletest.patch @@ -0,0 +1,19 @@ +diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt +index 7e0f2c8..db54eab 100644 +--- a/test/CMakeLists.txt ++++ b/test/CMakeLists.txt +@@ -31,14 +31,6 @@ cmake_dependent_option( ROCWMMA_BUILD_BENCHMARK_TESTS "Build benchmarking tests" + cmake_dependent_option( ROCWMMA_BUILD_EXTENDED_TESTS "Build extended test parameter coverage" OFF "ROCWMMA_BUILD_TESTS" OFF ) + + # Test/benchmark requires additional dependencies +-include( FetchContent ) +- +-FetchContent_Declare( +- googletest +- URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip +-) +-FetchContent_MakeAvailable(googletest) +- + include(GoogleTest) + + set(ROCWMMA_TEST_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/pkgs/development/libraries/rocwmma/default.nix b/pkgs/development/libraries/rocwmma/default.nix new file mode 100644 index 0000000000000..9091a56518196 --- /dev/null +++ b/pkgs/development/libraries/rocwmma/default.nix @@ -0,0 +1,157 @@ +{ lib +, stdenv +, fetchFromGitHub +, writeScript +, cmake +, rocm-cmake +, hip +, openmp +, gtest ? null +, rocblas ? null +, texlive ? null +, doxygen ? null +, sphinx ? null +, python3Packages ? null +, buildTests ? false +, buildSamples ? false +, buildDocs ? false +, gpuTargets ? null # gpuTargets = [ "gfx908:xnack-" "gfx90a:xnack-" "gfx90a:xnack+" ... ] +}: + +assert buildTests -> gtest != null; +assert buildTests -> rocblas != null; +assert buildDocs -> texlive != null; +assert buildDocs -> doxygen != null; +assert buildDocs -> sphinx != null; +assert buildDocs -> python3Packages != null; + +# Building tests isn't working for now +# undefined reference to symbol '_ZTIN7testing4TestE' +assert buildTests == false; + +let + latex = lib.optionalAttrs buildDocs (texlive.combine { + inherit (texlive) scheme-small + latexmk + tex-gyre + fncychap + wrapfig + capt-of + framed + needspace + tabulary + varwidth + titlesec; + }); +in stdenv.mkDerivation (finalAttrs: { + pname = "rocwmma"; + repoVersion = "0.8"; + rocmVersion = "5.3.3"; + version = "${finalAttrs.repoVersion}-${finalAttrs.rocmVersion}"; + + outputs = [ + "out" + ] ++ lib.optionals buildTests [ + "test" + ] ++ lib.optionals buildSamples [ + "sample" + ] ++ lib.optionals buildDocs [ + "docs" + ]; + + src = fetchFromGitHub { + owner = "ROCmSoftwarePlatform"; + repo = "rocWMMA"; + rev = "rocm-${finalAttrs.rocmVersion}"; + hash = "sha256-wU3R1XGTy7uFbceUyE0wy+XayicuyJIVfd1ih6pbTN0="; + }; + + patches = lib.optionals buildTests [ + ./0000-dont-fetch-googletest.patch + ]; + + nativeBuildInputs = [ + cmake + rocm-cmake + hip + ]; + + buildInputs = [ + openmp + ] ++ lib.optionals buildTests [ + gtest + rocblas + ] ++ lib.optionals buildDocs [ + latex + doxygen + sphinx + python3Packages.sphinx_rtd_theme + python3Packages.breathe + ]; + + cmakeFlags = [ + "-DCMAKE_CXX_COMPILER=hipcc" + "-DROCWMMA_BUILD_TESTS=${if buildTests then "ON" else "OFF"}" + "-DROCWMMA_BUILD_SAMPLES=${if buildSamples then "ON" else "OFF"}" + # Manually define CMAKE_INSTALL_