diff options
author | Terry Cojean <terry.cojean@kit.edu> | 2021-09-06 14:11:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-06 14:11:35 +0200 |
commit | dd8dc08a9099d23222fc5a4804dc7c2eba8257ae (patch) | |
tree | c70360c18eefd23676f6f44e29ad914e1c8570b5 | |
parent | 3e4b576f83cf85603bf57002004bb54c08d705a0 (diff) | |
download | spack-dd8dc08a9099d23222fc5a4804dc7c2eba8257ae.tar.gz spack-dd8dc08a9099d23222fc5a4804dc7c2eba8257ae.tar.bz2 spack-dd8dc08a9099d23222fc5a4804dc7c2eba8257ae.tar.xz spack-dd8dc08a9099d23222fc5a4804dc7c2eba8257ae.zip |
Ginkgo: add v1.4.0 (#25606)
* Add a patch to skip unavailable smoke tests.
-rw-r--r-- | var/spack/repos/builtin/packages/ginkgo/1.4.0_skip_invalid_smoke_tests.patch | 95 | ||||
-rw-r--r-- | var/spack/repos/builtin/packages/ginkgo/package.py | 17 |
2 files changed, 104 insertions, 8 deletions
diff --git a/var/spack/repos/builtin/packages/ginkgo/1.4.0_skip_invalid_smoke_tests.patch b/var/spack/repos/builtin/packages/ginkgo/1.4.0_skip_invalid_smoke_tests.patch new file mode 100644 index 0000000000..40fdc033fc --- /dev/null +++ b/var/spack/repos/builtin/packages/ginkgo/1.4.0_skip_invalid_smoke_tests.patch @@ -0,0 +1,95 @@ +diff --git a/test/test_install/test_install.cpp b/test/test_install/test_install.cpp +index fb9f479c06..cd2ac76855 100644 +--- a/test/test_install/test_install.cpp ++++ b/test/test_install/test_install.cpp +@@ -35,6 +35,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + #include <chrono> + #include <cmath> ++#include <cstdlib> + #include <fstream> + #include <iostream> + #include <map> +@@ -93,8 +94,7 @@ void check_solver(std::shared_ptr<gko::Executor> exec, + const gko::matrix::Dense<> *b, gko::matrix::Dense<> *x) + { + using Mtx = gko::matrix::Csr<>; +- auto A = +- gko::share(Mtx::create(exec, std::make_shared<Mtx::load_balance>())); ++ auto A = gko::share(Mtx::create(exec, std::make_shared<Mtx::classical>())); + + auto num_iters = 20u; + double reduction_factor = 1e-7; +@@ -117,8 +117,8 @@ void check_solver(std::shared_ptr<gko::Executor> exec, + #if defined(HAS_HIP) || defined(HAS_CUDA) + // If we are on a device, we need to run a reference test to compare against + auto exec_ref = exec->get_master(); +- auto A_ref = gko::share( +- Mtx::create(exec_ref, std::make_shared<Mtx::load_balance>())); ++ auto A_ref = ++ gko::share(Mtx::create(exec_ref, std::make_shared<Mtx::classical>())); + A_ref->read(A_raw); + auto solver_gen_ref = + Solver::build() +@@ -147,13 +147,35 @@ class PolymorphicObjectTest : public gko::PolymorphicObject {}; + int main() + { + #if defined(HAS_CUDA) +- auto exec = gko::CudaExecutor::create(0, gko::ReferenceExecutor::create()); ++ auto extra_info = "(CUDA)"; ++ using exec_type = gko::CudaExecutor; + #elif defined(HAS_HIP) +- auto exec = gko::HipExecutor::create(0, gko::ReferenceExecutor::create()); ++ auto extra_info = "(HIP)"; ++ using exec_type = gko::HipExecutor; + #else +- auto exec = gko::ReferenceExecutor::create(); ++ auto extra_info = "(REFERENCE)"; ++ using exec_type = gko::ReferenceExecutor; + #endif + ++ std::shared_ptr<exec_type> exec; ++ try { ++#if defined(HAS_CUDA) || defined(HAS_HIP) ++ exec = exec_type::create(0, gko::ReferenceExecutor::create()); ++#else ++ exec = exec_type::create(); ++#endif ++ // We also try to to synchronize to ensure we really have an available ++ // device ++ exec->synchronize(); ++ } catch (gko::Error &e) { ++ // Exit gracefully to not trigger CI errors. We only skip the tests in ++ // this setting ++ std::cerr ++ << "test_install" << extra_info ++ << ": a compatible device could not be found. Skipping test.\n"; ++ std::exit(0); ++ } ++ + using vec = gko::matrix::Dense<>; + #if HAS_REFERENCE + auto b = gko::read<vec>(std::ifstream("data/b.mtx"), exec); +@@ -329,7 +351,7 @@ int main() + // core/matrix/csr.hpp + { + using Mtx = gko::matrix::Csr<>; +- auto test = Mtx::create(exec, std::make_shared<Mtx::load_balance>()); ++ auto test = Mtx::create(exec, std::make_shared<Mtx::classical>()); + } + + // core/matrix/dense.hpp +@@ -491,13 +513,6 @@ int main() + .with_criteria(std::move(time), std::move(iteration)) + .on(exec); + } +-#if defined(HAS_CUDA) +- auto extra_info = "(CUDA)"; +-#elif defined(HAS_HIP) +- auto extra_info = "(HIP)"; +-#else +- auto extra_info = "(REFERENCE)"; +-#endif + std::cout << "test_install" << extra_info + << ": the Ginkgo installation was correctly detected " + "and is complete." diff --git a/var/spack/repos/builtin/packages/ginkgo/package.py b/var/spack/repos/builtin/packages/ginkgo/package.py index 49bdfcfcc9..59a3f17c1e 100644 --- a/var/spack/repos/builtin/packages/ginkgo/package.py +++ b/var/spack/repos/builtin/packages/ginkgo/package.py @@ -19,6 +19,7 @@ class Ginkgo(CMakePackage, CudaPackage, ROCmPackage): version('develop', branch='develop') version('master', branch='master') + version('1.4.0', commit='f811917c1def4d0fcd8db3fe5c948ce13409e28e') # v1.4.0 version('1.3.0', commit='4678668c66f634169def81620a85c9a20b7cec78') # v1.3.0 version('1.2.0', commit='b4be2be961fd5db45c3d02b5e004d73550722e31') # v1.2.0 version('1.1.1', commit='08d2c5200d3c78015ac8a4fd488bafe1e4240cf5') # v1.1.1 @@ -52,13 +53,13 @@ class Ginkgo(CMakePackage, CudaPackage, ROCmPackage): # ROCm 4.1.0 breaks platform settings which breaks Ginkgo's HIP support. conflicts("^hip@4.1.0:", when="@:1.3.0") - conflicts("^hip@4.1.0:", when="@master") conflicts("^hipblas@4.1.0:", when="@:1.3.0") - conflicts("^hipblas@4.1.0:", when="@master") conflicts("^hipsparse@4.1.0:", when="@:1.3.0") - conflicts("^hipsparse@4.1.0:", when="@master") conflicts("^rocthrust@4.1.0:", when="@:1.3.0") - conflicts("^rocthrust@4.1.0:", when="@master") + + # Skip smoke tests if compatible hardware isn't found + patch('1.4.0_skip_invalid_smoke_tests.patch', when='@master') + patch('1.4.0_skip_invalid_smoke_tests.patch', when='@1.4.0') def cmake_args(self): # Check that the have the correct C++ standard is available @@ -127,8 +128,8 @@ class Ginkgo(CMakePackage, CudaPackage, ROCmPackage): @run_after('install') def setup_build_tests(self): """Build and install the smoke tests.""" - # For now only develop and next releases support this scheme. - if not self.spec.satisfies('@develop') and not self.spec.satisfies('@1.4.0:'): + # For now only 1.4.0 and later releases support this scheme. + if self.spec.satisfies('@:1.3.0'): return with working_dir(self.build_directory): make("test_install") @@ -138,8 +139,8 @@ class Ginkgo(CMakePackage, CudaPackage, ROCmPackage): def test(self): """Run the smoke tests.""" - # For now only develop and next releases support this scheme. - if not self.spec.satisfies('@develop') and not self.spec.satisfies('@1.4.0:'): + # For now only 1.4.0 and later releases support this scheme. + if self.spec.satisfies('@:1.3.0'): print("SKIPPED: smoke tests not supported with this Ginkgo version.") return files = [('test_install', [r'REFERENCE', |