From f84991b5a885b4f95610ae1e4c34651a8aeb3a4c Mon Sep 17 00:00:00 2001 From: Cory Bloor Date: Wed, 11 May 2022 10:37:22 -0600 Subject: rocfft: add spack build test support (#29957) * rocfft: add spack build test support * Style cleanup for variant specs --- ...2-Fix-clients-fftw3-include-dirs-rocm-4.2.patch | 13 +++++++++++++ ...3-Fix-clients-fftw3-include-dirs-rocm-4.5.patch | 12 ++++++++++++ var/spack/repos/builtin/packages/rocfft/package.py | 22 ++++++++++++++++++---- 3 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 var/spack/repos/builtin/packages/rocfft/0002-Fix-clients-fftw3-include-dirs-rocm-4.2.patch create mode 100644 var/spack/repos/builtin/packages/rocfft/0003-Fix-clients-fftw3-include-dirs-rocm-4.5.patch diff --git a/var/spack/repos/builtin/packages/rocfft/0002-Fix-clients-fftw3-include-dirs-rocm-4.2.patch b/var/spack/repos/builtin/packages/rocfft/0002-Fix-clients-fftw3-include-dirs-rocm-4.2.patch new file mode 100644 index 0000000000..7d7b0574d2 --- /dev/null +++ b/var/spack/repos/builtin/packages/rocfft/0002-Fix-clients-fftw3-include-dirs-rocm-4.2.patch @@ -0,0 +1,13 @@ +diff --git a/clients/tests/CMakeLists.txt b/clients/tests/CMakeLists.txt +index 6f2bfb8..2354f7b 100644 +--- a/clients/tests/CMakeLists.txt ++++ b/clients/tests/CMakeLists.txt +@@ -58,7 +58,7 @@ find_package( FFTW 3.0 REQUIRED MODULE COMPONENTS FLOAT DOUBLE ) + + set( rocfft-test_include_dirs + $ +- $ ++ $ + $ + $ + ) diff --git a/var/spack/repos/builtin/packages/rocfft/0003-Fix-clients-fftw3-include-dirs-rocm-4.5.patch b/var/spack/repos/builtin/packages/rocfft/0003-Fix-clients-fftw3-include-dirs-rocm-4.5.patch new file mode 100644 index 0000000000..aaf44a872a --- /dev/null +++ b/var/spack/repos/builtin/packages/rocfft/0003-Fix-clients-fftw3-include-dirs-rocm-4.5.patch @@ -0,0 +1,12 @@ +diff --git a/clients/CMakeLists.txt b/clients/CMakeLists.txt +index 7f14a55..a62fbd4 100644 +--- a/clients/CMakeLists.txt ++++ b/clients/CMakeLists.txt +@@ -103,6 +103,7 @@ if( BUILD_CLIENTS_TESTS OR BUILD_CLIENTS_SAMPLES ) + # 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() + + # also try to build FFTW if FFTW isn't present diff --git a/var/spack/repos/builtin/packages/rocfft/package.py b/var/spack/repos/builtin/packages/rocfft/package.py index 52952aec77..ec8e69e87f 100644 --- a/var/spack/repos/builtin/packages/rocfft/package.py +++ b/var/spack/repos/builtin/packages/rocfft/package.py @@ -42,9 +42,19 @@ class Rocfft(CMakePackage): variant('amdgpu_target', values=auto_or_any_combination_of(*amdgpu_targets)) variant('amdgpu_target_sram_ecc', values=auto_or_any_combination_of(*amdgpu_targets)) - depends_on('cmake@3:', type='build') - depends_on('python@3:', type='build', when='@5.0.0:') - depends_on('sqlite@3.36:', type='build', when='@5.0.0:') + depends_on('cmake@3.16:', type='build', when='@4.5.0:') + depends_on('cmake@3.5:', type='build') + depends_on('python@3.6:', type='build', when='@5.0.0:') + depends_on('sqlite@3.36:', when='@5.0.0:') + + depends_on('googletest@1.10.0:', type='test') + depends_on('fftw@3.3.8:', type='test') + depends_on('boost@1.64.0: +program_options', type='test') + depends_on('llvm-amdgpu +openmp', type='test') + + def check(self): + exe = join_path(self.build_directory, 'clients', 'staging', 'rocfft-test') + self.run_test(exe, options='--gtest_filter=mix*:adhoc*') for ver in ['3.5.0', '3.7.0', '3.8.0', '3.9.0', '3.10.0', '4.0.0', '4.1.0', '4.2.0', '4.3.0', '4.3.1', '4.5.0', '4.5.2', '5.0.0', @@ -53,12 +63,16 @@ class Rocfft(CMakePackage): depends_on('rocm-cmake@%s:' % ver, type='build', when='@' + ver) patch('0001-Improve-compilation-by-using-sqlite-recipe-for-rocfft.patch', when='@5.0.0:5.0.2') + patch('0002-Fix-clients-fftw3-include-dirs-rocm-4.2.patch', when='@4.2.0:4.3.1') + patch('0003-Fix-clients-fftw3-include-dirs-rocm-4.5.patch', when='@4.5.0:') def setup_build_environment(self, env): env.set('CXX', self.spec['hip'].hipcc) def cmake_args(self): - args = [] + args = [ + self.define('BUILD_CLIENTS_TESTS', self.run_tests), + ] tgt = self.spec.variants['amdgpu_target'] if 'auto' not in tgt: -- cgit v1.2.3-60-g2f50