2011-12-01 11:45:09 +00:00
|
|
|
#!/bin/bash -l
|
2011-12-01 11:48:09 +00:00
|
|
|
#
|
|
|
|
# Simple script testing all available compiler modules on cray:
|
|
|
|
# Check if C++ compiler is working.
|
|
|
|
#
|
|
|
|
# Chrsitoph Niethammer <niethammer@hlrs.de> (C) 2011
|
|
|
|
#
|
2011-12-01 11:45:09 +00:00
|
|
|
|
|
|
|
compilers="pgi gcc cray"
|
|
|
|
|
|
|
|
compiler_version_cmd() {
|
|
|
|
case $1 in
|
|
|
|
cray|gcc)
|
|
|
|
cmd="CC --version"
|
|
|
|
;;
|
|
|
|
pgi)
|
|
|
|
cmd="CC -V"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Unknown compiler $1"
|
|
|
|
esac
|
|
|
|
echo $cmd
|
|
|
|
$cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
compiler_check_stdexcept() {
|
|
|
|
cmd="CC stdexcept.cpp"
|
|
|
|
echo $cmd
|
|
|
|
$cmd
|
|
|
|
}
|
|
|
|
|
|
|
|
swap_env() {
|
|
|
|
currentPrgEnv=$(module li 2>&1 | awk '/PrgEnv/{print $2}')
|
|
|
|
if [ "$1" == gcc ] ; then
|
|
|
|
newPrgEnv="gnu"
|
|
|
|
else
|
|
|
|
newPrgEnv=$1
|
|
|
|
fi
|
|
|
|
module swap $currentPrgEnv PrgEnv-$newPrgEnv
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pwd
|
|
|
|
|
|
|
|
for compiler in $compilers; do
|
|
|
|
for version in $(module av $compiler -l 2>&1 | awk "/^$compiler/{print \$1}" | awk -F'/' '{print $2}'); do
|
|
|
|
echo "--------------------------------------------------"
|
|
|
|
echo "testing $compiler/$version ..."
|
|
|
|
echo "--------------------------------------------------"
|
|
|
|
swap_env $compiler
|
|
|
|
module swap $compiler $compiler/$version
|
|
|
|
compiler_version_cmd $compiler
|
|
|
|
compiler_check_stdexcept $compiler
|
|
|
|
echo "--------------------------------------------------"
|
|
|
|
done
|
|
|
|
echo "--------------------------------------------------"
|
|
|
|
echo ""
|
|
|
|
done 2>&1 | tee compiler-test.log
|