summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authortakanori-ihara <62980219+takanori-ihara@users.noreply.github.com>2021-02-22 18:36:44 +0900
committerGitHub <noreply@github.com>2021-02-22 10:36:44 +0100
commit10c9cac49870c9576ee54d12e96bcc8d5380e223 (patch)
tree594991e2975d25c7f872bb46d5ff4accce49d5df /var
parent4f65f600459271db29171b0dc378e018256cf110 (diff)
downloadspack-10c9cac49870c9576ee54d12e96bcc8d5380e223.tar.gz
spack-10c9cac49870c9576ee54d12e96bcc8d5380e223.tar.bz2
spack-10c9cac49870c9576ee54d12e96bcc8d5380e223.tar.xz
spack-10c9cac49870c9576ee54d12e96bcc8d5380e223.zip
eigenexa: fix build error and add test method (#21692)
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/eigenexa/gcc_compiler.patch29
-rw-r--r--var/spack/repos/builtin/packages/eigenexa/package.py22
-rw-r--r--var/spack/repos/builtin/packages/eigenexa/test/result-check.sh36
-rw-r--r--var/spack/repos/builtin/packages/eigenexa/test/run-test.sh4
4 files changed, 90 insertions, 1 deletions
diff --git a/var/spack/repos/builtin/packages/eigenexa/gcc_compiler.patch b/var/spack/repos/builtin/packages/eigenexa/gcc_compiler.patch
new file mode 100644
index 0000000000..3c0e0bf983
--- /dev/null
+++ b/var/spack/repos/builtin/packages/eigenexa/gcc_compiler.patch
@@ -0,0 +1,29 @@
+--- a/configure.ac
++++ c/configure.ac
+@@ -440,7 +440,7 @@ else
+ FFLAGS=${I_BASE}" -Ofast "${I_ARCH}
+
+ elif test x"${FC_ACT}" = x"gfortran"; then
+- FFLAGS=${G_BASE}" -O3 "${G_ARCH}
++ FFLAGS=${G_BASE}" -O3 -fopenmp "${G_ARCH}
+
+ elif test x"${FC_ACT}" = x"mpifrtpx"; then
+ FFLAGS=${F_BASE}" -Kfast,ocl,simd,swp "${F_ARCH}
+@@ -465,7 +465,7 @@ else
+ FCFLAGS=${I_BASE}" -Ofast "${I_ARCH}
+
+ elif test x"${FC_ACT}" = x"gfortran"; then
+- FCFLAGS=${G_BASE}" -O3 "${G_ARCH}
++ FCFLAGS=${G_BASE}" -O3 -fopenmp "${G_ARCH}
+
+ elif test x"${FC_ACT}" = x"mpifrtpx"; then
+ FCFLAGS=${F_BASE}" -Kfast,ocl,simd,swp "${F_ARCH}
+@@ -486,7 +486,7 @@ if test x"${FC_ACT}" = x"ifort"; then
+ FFLAGS0=${I_BASE}" -O0 "
+
+ elif test x"${FC_ACT}" = x"gfortran"; then
+- FFLAGS0=${G_BASE}" -O0"
++ FFLAGS0=${G_BASE}" -O0 -fopenmp "
+
+ elif test x"${FC_ACT}" = x"mpifrtpx"; then
+ FFLAGS0="-Kopenmp,openmp_ordered_reduction -Cpp"
diff --git a/var/spack/repos/builtin/packages/eigenexa/package.py b/var/spack/repos/builtin/packages/eigenexa/package.py
index e454ae7af8..265c48b35d 100644
--- a/var/spack/repos/builtin/packages/eigenexa/package.py
+++ b/var/spack/repos/builtin/packages/eigenexa/package.py
@@ -1,4 +1,4 @@
-# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
+# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
@@ -25,8 +25,10 @@ class Eigenexa(AutotoolsPackage):
depends_on("scalapack")
patch("fj_compiler.patch", when="%fj")
+ patch("gcc_compiler.patch", when="%gcc")
parallel = False
+ force_autoreconf = True
def setup_build_environment(self, env):
env.set("FC", self.spec["mpi"].mpifc, force=True)
@@ -47,3 +49,21 @@ class Eigenexa(AutotoolsPackage):
)
),
)
+
+ @run_after('install')
+ def cache_test_sources(self):
+ self.cache_extra_test_sources("benchmark")
+
+ def test(self):
+ test_dir = self.test_suite.current_test_data_dir
+ exe_name = join_path(test_dir, "run-test.sh")
+ mpi_name = self.spec["mpi"].prefix.bin.mpirun
+ test_file = join_path(
+ self.install_test_root, "benchmark", "eigenexa_benchmark"
+ )
+ input_file = join_path(self.install_test_root, "benchmark", "IN")
+ opts = [exe_name, mpi_name, '-n', '1', test_file, '-f', input_file]
+ env["OMP_NUM_THREADS"] = "1"
+ self.run_test(
+ "sh", options=opts, expected="EigenExa Test Passed !", work_dir=test_dir
+ )
diff --git a/var/spack/repos/builtin/packages/eigenexa/test/result-check.sh b/var/spack/repos/builtin/packages/eigenexa/test/result-check.sh
new file mode 100644
index 0000000000..a8a406ec23
--- /dev/null
+++ b/var/spack/repos/builtin/packages/eigenexa/test/result-check.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+
+grep -q "Benchmark completed" $@
+if [ $? -eq 1 ]; then
+ echo "EigenExa Test Failed !"
+ exit 1
+fi
+
+while read line;do
+ case $line in
+ *'Eigenvalue Relative Error'* )
+ tmp=$line
+ read line
+ if [[ "$line" != '|w| is too small, so it is not severe.' ]]; then
+ echo "${tmp}" >> output.txt
+ fi
+ ;;
+ *'Eigenvalue Absolute Error'* )
+ tmp=$line
+ read line
+ if [ "$line" != 'Do not mind it. Condition number is too large.' ] && \
+ [ "$line" != 'Do not mind it. Relative error is small enough' ]; then
+ echo "${tmp}" >> output.txt
+ fi
+ ;;
+ *'Residual Error Test'* | *'Orthogonality Test'* )
+ echo "${line}" >> output.txt ;;
+ esac
+done < $@
+
+grep -q "FAILED" output.txt
+if [ $? -eq 1 ]; then
+ echo "EigenExa Test Passed !"
+elif [ $? -eq 0 ]; then
+ echo "EigenExa Test Failed !"
+fi
diff --git a/var/spack/repos/builtin/packages/eigenexa/test/run-test.sh b/var/spack/repos/builtin/packages/eigenexa/test/run-test.sh
new file mode 100644
index 0000000000..3ec7a520a6
--- /dev/null
+++ b/var/spack/repos/builtin/packages/eigenexa/test/run-test.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+$@ 2>&1 | tee run_test_results.txt
+result-check.sh run_test_results.txt