summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSreenivasa Murthy Kolam <sreenivasamurthy.kolam@amd.com>2024-03-28 07:39:29 +0530
committerGitHub <noreply@github.com>2024-03-27 21:09:29 -0500
commit6c3fed351f7432f09c4d8b5217f33220f197dfcd (patch)
tree949deccb82adb21b8ee7296106edf21054dc64de
parentb9cbd156745d45a2e8ec1f9900f4d135f140c767 (diff)
downloadspack-6c3fed351f7432f09c4d8b5217f33220f197dfcd.tar.gz
spack-6c3fed351f7432f09c4d8b5217f33220f197dfcd.tar.bz2
spack-6c3fed351f7432f09c4d8b5217f33220f197dfcd.tar.xz
spack-6c3fed351f7432f09c4d8b5217f33220f197dfcd.zip
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
-rw-r--r--var/spack/repos/builtin/packages/rocfft/0005-Fix-clients-tests-include-rocrand-fftw-include-dir-rocm-6.0.0.patch39
-rw-r--r--var/spack/repos/builtin/packages/rocfft/package.py17
2 files changed, 52 insertions, 4 deletions
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
+ $<BUILD_INTERFACE:${Boost_INCLUDE_DIRS}>
++ $<BUILD_INTERFACE:${rocrand_INCLUDE_DIRS}>
+ $<BUILD_INTERFACE:${FFTW_INCLUDES}>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/misc/include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../library/src/include>
+@@ -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)