eigenexa: fix build error and add test method (#21692)

This commit is contained in:
takanori-ihara 2021-02-22 18:36:44 +09:00 committed by GitHub
parent 4f65f60045
commit 10c9cac498
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 90 additions and 1 deletions

View file

@ -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"

View file

@ -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. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
@ -25,8 +25,10 @@ class Eigenexa(AutotoolsPackage):
depends_on("scalapack") depends_on("scalapack")
patch("fj_compiler.patch", when="%fj") patch("fj_compiler.patch", when="%fj")
patch("gcc_compiler.patch", when="%gcc")
parallel = False parallel = False
force_autoreconf = True
def setup_build_environment(self, env): def setup_build_environment(self, env):
env.set("FC", self.spec["mpi"].mpifc, force=True) env.set("FC", self.spec["mpi"].mpifc, force=True)
@ -47,3 +49,21 @@ def setup_build_environment(self, env):
) )
), ),
) )
@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
)

View file

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

View file

@ -0,0 +1,4 @@
#!/bin/bash
$@ 2>&1 | tee run_test_results.txt
result-check.sh run_test_results.txt