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
This commit is contained in:
Sreenivasa Murthy Kolam 2024-03-28 07:39:29 +05:30 committed by GitHub
parent b9cbd15674
commit 6c3fed351f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 52 additions and 4 deletions

View File

@ -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}
)

View File

@ -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 @@ def check(self):
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 @@ def check(self):
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)