From 6c3fed351f7432f09c4d8b5217f33220f197dfcd Mon Sep 17 00:00:00 2001 From: Sreenivasa Murthy Kolam Date: Thu, 28 Mar 2024 07:39:29 +0530 Subject: Fix build failure when run-tests is enabled for rocfft (#42424) * initial commit to fix the error when running run tests for rocfft * apply patch from 5.7.0 onwards * add description for the patch that is added --- ...clude-rocrand-fftw-include-dir-rocm-6.0.0.patch | 39 ++++++++++++++++++++++ var/spack/repos/builtin/packages/rocfft/package.py | 17 +++++++--- 2 files changed, 52 insertions(+), 4 deletions(-) create mode 100644 var/spack/repos/builtin/packages/rocfft/0005-Fix-clients-tests-include-rocrand-fftw-include-dir-rocm-6.0.0.patch diff --git a/var/spack/repos/builtin/packages/rocfft/0005-Fix-clients-tests-include-rocrand-fftw-include-dir-rocm-6.0.0.patch b/var/spack/repos/builtin/packages/rocfft/0005-Fix-clients-tests-include-rocrand-fftw-include-dir-rocm-6.0.0.patch new file mode 100644 index 0000000000..8144fb8d29 --- /dev/null +++ b/var/spack/repos/builtin/packages/rocfft/0005-Fix-clients-tests-include-rocrand-fftw-include-dir-rocm-6.0.0.patch @@ -0,0 +1,39 @@ +diff --git a/clients/tests/CMakeLists.txt b/clients/tests/CMakeLists.txt +index d0b95b4..0339daa 100644 +--- a/clients/tests/CMakeLists.txt ++++ b/clients/tests/CMakeLists.txt +@@ -64,6 +64,10 @@ if( NOT hiprand_FOUND ) + find_package( hiprand REQUIRED ) + endif() + ++if( NOT rocrand_FOUND ) ++ find_package( rocrand REQUIRED ) ++endif() ++ + include( ROCMInstallTargets ) + + set( rocfft-test_source +@@ -109,6 +113,7 @@ option( BUILD_FFTW "Download and build FFTW" OFF ) + # look for installed FFTW if we weren't asked to build it + if( NOT BUILD_FFTW ) + find_package( FFTW 3.0 MODULE COMPONENTS FLOAT DOUBLE ) ++ set( FFTW_INCLUDES ${FFTW_INCLUDE_DIRS} ) + endif() + + include( ExternalProject ) +@@ -174,6 +179,7 @@ endif() + + set( rocfft-test_include_dirs + $ ++ $ + $ + $ + $ +@@ -216,6 +222,7 @@ target_link_libraries( rocfft-test + hip::device + roc::rocfft + hip::hiprand ++ roc::rocrand + ${rocfft-test_link_libs} + ) + diff --git a/var/spack/repos/builtin/packages/rocfft/package.py b/var/spack/repos/builtin/packages/rocfft/package.py index efec5bac21..f31d7c64b5 100644 --- a/var/spack/repos/builtin/packages/rocfft/package.py +++ b/var/spack/repos/builtin/packages/rocfft/package.py @@ -63,10 +63,7 @@ class Rocfft(CMakePackage): depends_on("boost@1.64.0: +program_options", type="test") depends_on("rocm-openmp-extras", type="test") depends_on("hiprand", type="test") - - def check(self): - exe = join_path(self.build_directory, "clients", "staging", "rocfft-test") - self.run_test(exe, options="--gtest_filter=mix*:adhoc*") + depends_on("rocrand", type="test") for ver in [ "5.1.0", @@ -94,6 +91,12 @@ class Rocfft(CMakePackage): patch("0003-Fix-clients-fftw3-include-dirs-rocm-4.5.patch", when="@:5.1") # Patch to add install prefix header location for sqlite for 5.4 patch("0004-fix-missing-sqlite-include-paths.patch", when="@5.4.0:5.5") + # Patch to fix the build issue when --test=root is enabled + # This adds the include headers from the rocrand and fftw in the cmakelists.txt + # issue is seen from 5.7.0 onwards + patch( + "0005-Fix-clients-tests-include-rocrand-fftw-include-dir-rocm-6.0.0.patch", when="@5.7.0:" + ) # Set LD_LIBRARY_PATH for executing the binaries from build directoryfix missing type # https://github.com/ROCm/rocFFT/pull/449) @@ -106,6 +109,12 @@ class Rocfft(CMakePackage): def setup_build_environment(self, env): env.set("CXX", self.spec["hip"].hipcc) + @run_after("build") + @on_package_attributes(run_tests=True) + def check_build(self): + exe = Executable(join_path(self.build_directory, "clients", "staging", "rocfft-test")) + exe("--gtest_filter=mix*:adhoc*") + @classmethod def determine_version(cls, lib): match = re.search(r"lib\S*\.so\.\d+\.\d+\.(\d)(\d\d)(\d\d)", lib) -- cgit v1.2.3-70-g09d2