Skip to content
Snippets Groups Projects
Commit 25e0acf4 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Merge branch 'script_devel' into 'master'

Configuration log

See merge request giacomo.mulas/np_tmcode!97
parents 3c2b3d5e b46c4f7c
No related branches found
No related tags found
No related merge requests found
build/autom4te.cache
build/config.*
build/configure.log
build/cluster/*
build/error.log
build/inclusion/*
......
......@@ -174,6 +174,7 @@ do
dbg_feature=$(echo $arg | cut -d '=' -f2)
if [ "x$dbg_feature" = "x" ]; then
echo "ERROR: no debug feature specified!"
echo "ERROR: no debug feature specified!" >>configure.log
exit 1
else
if [ "x$DEBUGFLAGS" = "x" ]; then
......@@ -190,6 +191,7 @@ do
opt_level=$(echo $arg | cut -d '=' -f2)
if [ $opt_level -lt 0 -o $opt_level -gt 3 ]; then
echo "ERROR: invalid optimization level $opt_level"
echo "ERROR: invalid optimization level $opt_level" >>configure.log
exit 1
fi
FC_OPT=$opt_level
......@@ -218,6 +220,7 @@ do
HDF5_HOME=$(echo $arg | cut -d '=' -f2)
if [ "x${HDF5_HOME}" = "x" ]; then
echo "ERROR: option --with-hdf5 requires a valid HDF5 path."
echo "ERROR: option --with-hdf5 requires a valid HDF5 path." >>configure.log
exit 1
fi
elif [ "x$cut_arg" = "x--with-include" ]; then
......@@ -245,41 +248,56 @@ do
MAGMA_INVERT_FLAGS=" -DUSE_ZGESV_RBT"
else
echo "ERROR: unrecognized --enable-magma-invert option \"$MAGMA_INVERT_CHOICE\""
echo "ERROR: unrecognized --enable-magma-invert option \"$MAGMA_INVERT_CHOICE\"" >>configure.log
exit 1
fi
else
echo "ERROR: unrecognized argument \"$arg\""
echo "ERROR: unrecognized argument \"$arg\"" >>configure.log
exit 1
fi
done
# End of argument parsing section
# Configuration logic
echo "NPtm_code configuration"
echo "NPtm_code configuration" > configure.log
echo -n "" > error.log
# Check for AR
echo -n "configure: checking for ar... "
echo -n "configure: checking for ar... " >>configure.log
if [ "x$AR" = "x" ]; then
AR=$(which ar)
if [ "x$AR" = "x" ]; then
AR="ar"
fi
$AR --version > /dev/null 2>>error.log
fi
which $AR >/dev/null 2>>error.log
result=$?
if [ "x$result" = "x0" ]; then
echo "$AR"
else
if [ "x$result" != "x0" ]; then
echo "none"
echo "none" >>configure.log
if [ "x$LIBMODE" = "xstatic" ]; then
echo "ERROR: ar not found!"
echo "ERROR: $AR not found!"
echo "ERROR: $AR not found!" >>configure.log
exit 2
fi
else
echo $AR
echo $AR >>configure.log
fi
# Check FORTRAN compiler (if required)
if [ "x$FC" = "x" ]; then
echo -n "configure: checking for FORTRAN compiler... "
echo -n "configure: checking for FORTRAN compiler... " >>configure.log
FC=$(guess_fc)
echo $FC
echo $FC >>configure.log
fi
if [ "x$FC" = "xnone" ]; then
if [ "x$BUILDFORTRAN" = "xyes" ]; then
echo "ERROR: FORTRAN compilation was requested, but no FORTRAN compiler found."
echo "ERROR: FORTRAN compilation was requested, but no FORTRAN compiler found." >>configure.log
exit 2
else
BUILDFORTRAN=""
......@@ -289,6 +307,7 @@ else
BUILDFORTRAN="yes"
fi
echo -n "configure: checking whether $FC supports -ggdb... "
echo -n "configure: checking whether $FC supports -ggdb... " >>configure.log
cat > test_fortran.f <<EOF
PROGRAM CONF_TEST_FORTRAN
I=2
......@@ -299,34 +318,44 @@ EOF
result=$?
if [ "x$result" = "x0" ]; then
echo "yes"
echo "yes" >>configure.log
rm test_fortran.f test_fortran
else
echo "no"
echo "no" >>configure.log
rm test_fortran.f
FC_DBG=""
fi
echo -n "configure: checking whether $FC supports legacy... "
echo -n "configure: checking whether $FC supports legacy... " >>configure.log
result=$(test_legacy_fortran $FC)
if [ "x$result" = "x0" ]; then
FCFLAGS="-O${FC_OPT}${FC_DBG} -std=legacy"
echo "yes"
echo "yes" >>configure.log
else
FCFLAGS="-O$FC_OPT${FC_DBG}"
echo "no"
echo "WARNING: FORTRAN compiler does not support legacy flag."
echo "no" >>configure.log
echo "WARNING: FORTRAN compiler does not support legacy flag." >>configure.log
fi
fi # End of FORTRAN compiler check
# Check C++ compiler (mandatory)
if [ "x$CXX" = "x" ]; then
echo -n "configure: checking for C++ compiler... "
echo -n "configure: checking for C++ compiler... " >>configure.log
CXX=$(guess_cxx)
echo $CXX
echo $CXX >>configure.log
else
echo "configure: using $CXX as C++ compiler."
echo "configure: using $CXX as C++ compiler." >>configure.log
fi
if [ "x$CXX" = "xnone" ]; then
echo "ERROR: no C++ compiler found!"
echo "ERROR: no C++ compiler found!" >>configure.log
exit 2
fi
CLANGFLAGS=""
......@@ -336,6 +365,7 @@ if [ "x$result" = "x0" ]; then
CLANGFLAGS=" -stdlib=libstdc++"
fi
echo -n "configure: checking wether $CXX works... "
echo -n "configure: checking wether $CXX works... " >>configure.log
cat > test_compiler.cpp <<EOF
int main() {
int i = -1;
......@@ -347,31 +377,41 @@ $CXX $CLANGFLAGS test_compiler.cpp -o test_compiler > /dev/null 2>>error.log
result=$?
if [ "x$result" = "x0" ]; then
echo "yes"
echo "yes" >>configure.log
else
echo "no"
echo "ERROR: $CXX is not a working C++ compiler!"
echo "no" >>configure.log
echo "ERROR: $CXX is not a working C++ compiler!" >>configure.log
exit 2
fi
echo -n "configure: checking wether $CXX supports -ggdb... "
echo -n "configure: checking wether $CXX supports -ggdb... " >>configure.log
$CXX $CLANGFLAGS -ggdb test_compiler.cpp -o test_compiler > /dev/null 2>>error.log
result=$?
if [ "x$result" = "x0" ]; then
echo "yes"
echo "yes" >>configure.log
rm test_compiler.cpp test_compiler
else
echo "no"
echo "no" >>configure.log
rm test_compiler.cpp
CXX_DBG=""
fi
echo -n "configure: checking whether $CXX is a GNU compiler... "
echo -n "configure: checking whether $CXX is a GNU compiler... " >>configure.log
$CXX --version | grep "g++" > /dev/null
result=$?
if [ "x$result" = "x0" ]; then
echo "yes"
echo "yes" >>configure.log
else
echo "no"
echo "no" >>configure.log
fi
echo -n "configure: checking wether $CXX is a MPI compiler... "
echo -n "configure: checking wether $CXX is a MPI compiler... " >>configure.log
cat > test_compiler.cpp <<EOF
# include <mpi.h>
int main() {
......@@ -391,19 +431,23 @@ if [ "x$result" = "x0" ]; then
result=$?
if [ "x$result" = "x0" ]; then
echo "yes"
echo "yes" >>configure.log
MPIFLAGS=" -DUSE_MPI"
else
echo "no"
echo "no" >>configure.log
MPIFLAGS=""
fi
rm test_compiler test_compiler.cpp
else
echo "no"
echo "no" >>configure.log
MPIFLAGS=""
rm test_compiler.cpp
fi
if [ "x$OMPMODE" != "xno" ]; then
echo -n "configure: checking whether $CXX supports OpenMP... "
echo -n "configure: checking whether $CXX supports OpenMP... " >>configure.log
cat > test_compiler.cpp <<EOF
#include <omp.h>
int main() {
......@@ -419,13 +463,16 @@ EOF
result=$?
if [ "x$result" = "x0" ]; then
echo "yes"
echo "yes" >>configure.log
OMPFLAGS=" -fopenmp -DUSE_OMP"
else
echo "no"
echo "no" >>configure.log
OMP_FLAGS=""
OFFLOAD="no"
if [ "x$OMPMODE" = "xyes" ]; then
echo "ERROR: OpenMP was requested, but it is not supported."
echo "ERROR: OpenMP was requested, but it is not supported." >>configure.log
rm test_compiler test_compiler.cpp
exit 2
fi
......@@ -433,10 +480,12 @@ EOF
rm test_compiler test_compiler.cpp
else
echo "no"
echo "no" >>configure.log
OMP_FLAGS=""
OFFLOAD="no"
if [ "x$OMPMODE" = "xyes" ]; then
echo "ERROR: OpenMP was requested, but it is not supported."
echo "ERROR: OpenMP was requested, but it is not supported." >>configure.log
rm test_compiler.cpp
exit 2
fi
......@@ -446,6 +495,7 @@ fi
# End of C++ compiler check
# Check HDF5
echo -n "configure: checking for HDF5 header flags..."
echo -n "configure: checking for HDF5 header flags..." >>configure.log
if [ "x$HDF5_HOME" != "x" ]; then
HDF5_INCLUDE="$HDF5_HOME/include"
HDF5_LIB="$HDF5_HOME/lib"
......@@ -508,14 +558,18 @@ fi
if [ "x$HDF5FLAGS" = "x" ]; then
echo "not found."
echo "ERROR: HDF5 headers not found!"
echo "not found." >>configure.log
echo "ERROR: HDF5 headers not found!" >>configure.log
exit 2
else
echo "$HDF5FLAGS"
echo "$HDF5FLAGS" >>configure.log
fi
# End of HDF5 check
# LAPACK checks
if [ "x$LAPACK" != "xno" ]; then
echo -n "configure: checking for LAPACK... "
echo -n "configure: checking for LAPACK... " >>configure.log
if [ "x$ENABLE_ILP64" = "xyes" ]; then
# 64-bit indices are enabled
LAPACK_ILP64_FLAG="-DLAPACK_ILP64 -DUSE_ILP64"
......@@ -544,6 +598,7 @@ if [ "x$LAPACK" != "xno" ]; then
LAPACKFLAGS=" -DUSE_LAPACK -DUSE_MKL ${LAPACK_ILP64_FLAG} ${MKL_INCLUDE}"
LAPACKLDFLAGS="$(pkg-config --libs ${MKL_BUILD})"
echo "MKL"
echo "MKL" >>configure.log
else
# MKL was not found, so configuration searches for BLAS
declare -a pkg_array=$(pkg-config --list-all | grep blas${LAPACK_LDSPEC})
......@@ -571,6 +626,7 @@ if [ "x$LAPACK" != "xno" ]; then
LAPACKFLAGS=" -DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${LAPACK_INCLUDE} ${BLASFLAGS}"
LAPACKLDFLAGS="$(pkg-config --libs lapacke${LAPACK_LDSPEC}) ${BLASLDFLAGS}"
echo "lapacke"
echo "lapacke" >>configure.log
fi # end of LAPACKe decision tree
if [ "x${LAPACKFLAGS}${LAPACKLDFLAGS}" = "x" ]; then
# LAPACKe was not found, so configuration searches for LAPACK
......@@ -583,6 +639,7 @@ if [ "x$LAPACK" != "xno" ]; then
LAPACKFLAGS=" -DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${LAPACK_INCLUDE} ${BLASFLAGS}"
LAPACKLDFLAGS="$(pkg-config --libs lapack${LAPACK_LDSPEC}) ${BLASLDFLAGS}"
echo "LAPACK"
echo "LAPACK" >>configure.log
fi # end of LAPACK decision tree
fi # end of LAPACKe decision tree
fi # end of MKL decision tree
......@@ -594,18 +651,22 @@ if [ "x$LAPACK" != "xno" ]; then
LAPACKFLAGS=" -DUSE_LAPACK -DUSE_MKL ${LAPACK_ILP64_FLAG} -I{MKLROOT}/include"
LAPACKLDFLAGS=" -L${MKLROOT}/lib -Wl,--no-as-needed -lmkl_intel${LAPACK_ILP64_LDSPEC} -lmkl_gnu_thread -lmkl_core -lgomp -lpthread -lm -ldl"
echo "MKL"
echo "MKL" >>configure.log
else
if [ -f /usr/include/lapacke.h ]; then
LAPACKFLAGS=" -DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${BLASFLAGS}"
LAPACKLDFLAGS=" -llapacke${LAPACK_LDSPEC} ${BLASLDFLAGS}"
echo "lapacke"
echo "lapacke" >>configure.log
fi
fi
fi
if [ "x$LAPACKFLAGS" = "x" ]; then
echo "no"
echo "no" >>configure.log
if [ "x$LAPACK" = "xyes" ]; then
echo "ERROR: LAPACK was required, but no LAPACK was found."
echo "ERROR: LAPACK was required, but no LAPACK was found." >>configure.log
fi
fi
fi
......@@ -613,6 +674,7 @@ fi
# cuBLAS checks
if [ "x$CUBLAS" != "xno" ]; then
echo -n "configure: checking for cuBLAS... "
echo -n "configure: checking for cuBLAS... " >>configure.log
pkg-config --version > /dev/null
use_pkg_config=$?
if [ "x${CUDAFLAGS}${CUDALDFLAGS}" = "x" ]; then
......@@ -676,12 +738,15 @@ if [ "x$CUBLAS" != "xno" ]; then
fi
if [ "x$CUBLASFLAGS$CUBLASLDFLAGS" = "x" ]; then
echo "no"
echo "no" >>configure.log
if [ "x$CUBLAS" = "xyes" ]; then
echo "ERROR: cuBLAS was required, but no cuBLAS found."
echo "ERROR: cuBLAS was required, but no cuBLAS found." >>configure.log
exit 2
fi
else
echo "cuBLAS"
echo "cuBLAS" >>configure.log
fi
else
CUBLASFLAGS=""
......@@ -691,6 +756,7 @@ fi
# MAGMA checks
if [ "x$MAGMA" != "xno" ]; then
echo -n "configure: checking for MAGMA... "
echo -n "configure: checking for MAGMA... " >>configure.log
if [ "x$ENABLE_ILP64" = "xyes" ]; then
# 64-bit indices are enabled
MAGMA_ILP64_FLAG="-DMAGMA_ILP64"
......@@ -763,8 +829,10 @@ if [ "x$MAGMA" != "xno" ]; then
fi
if [ "x$MAGMAFLAGS$MAGMALDFLAGS" = "x" ]; then
echo "no"
echo "no" >>configure.log
if [ "x$MAGMA" = "xyes" ]; then
echo "ERROR: MAGMA was required, but no MAGMA found."
echo "ERROR: MAGMA was required, but no MAGMA found." >>configure.log
exit 2
fi
else
......@@ -774,6 +842,7 @@ if [ "x$MAGMA" != "xno" ]; then
MAGMAFLAGS="$MAGMAFLAGS$MAGMA_INVERT_FLAGS"
fi
echo "yes"
echo "yes" >>configure.log
fi
else
MAGMAFLAGS=""
......@@ -783,13 +852,13 @@ fi
# Offload checks
if [ "x$OFFLOAD" != "xno" ]; then
echo -n "configure: checking whether system supports offload... "
echo -n "configure: checking whether system supports offload... " >>configure.log
cat > conf_test_offload.cpp <<EOF
#include <omp.h>
#pragma omp requires unified_shared_memory
#pragma omp begin declare target device_type(any)
void fill_with_ones(int *array) {
#pragma omp target teams distribute parallel for
#pragma omp teams distribute parallel for collapse(2)
for (int i = 0; i < 1000; i++) {
for (int j = 0; j < 1000; j++) {
array[(1000 * i) + j] = 1;
......@@ -797,14 +866,16 @@ void fill_with_ones(int *array) {
}
}
#pragma omp end declare target
int main(int argc, char** argv) {
int *numbers = new int[1000000]();
#pragma omp target map(tofrom:numbers[0:1000000])
fill_with_ones(numbers);
delete[] numbers;
return 0;
}
EOF
$CXX -fcf-protection=check -foffload=nvptx-none="-O3 -ggdb -fcf-protection=check -fopt-info -lm -latomic -mgomp" -fopenmp conf_test_offload.cpp -o conf_test_offload > /dev/null 2>&1
$CXX -fopenmp -fcf-protection=none -fno-stack-protector -foffload=nvptx-none="-O3 -ggdb -fcf-protection=none -fno-stack-protector -fopt-info -lm -latomic -lgomp" conf_test_offload.cpp -o conf_test_offload > /dev/null 2>>error.log
result=$?
rm conf_test_offload.cpp
if [ "x$result" = "x0" ]; then
......@@ -814,12 +885,14 @@ EOF
fi
if [ "x$result" = "x0" ]; then
echo "yes"
OFFLOADFLAGS=" -DUSE_TARGET_OFFLOAD -fcf-protection=check -foffload=nvptx-none=\"-O${CXX_OPT}${CXX_DBG} -fcf-protection=check -fopt-info -lm -latomic -lgomp\""
echo "yes" >>configure.log
OFFLOADFLAGS=" -DUSE_TARGET_OFFLOAD -fcf-protection=none -fno-stack-protector -foffload=nvptx-none=\"-O${CXX_OPT}${CXX_DBG} -fcf-protection=none -fno-stack-protector -fopt-info -lm -latomic -lgomp\""
if [ "x${OMPFLAGS}" = "x" ]; then
OFFLOADFLAGS="${OFFLOADFLAGS} -fopenmp"
OFFLOADFLAGS="-fopenmp ${OFFLOADFLAGS}"
fi
else
echo "no"
echo "no" >>configure.log
OFFLOADFLAGS=""
fi
else
......@@ -844,57 +917,79 @@ fi
# Print a summary of configuration options
echo "INFO: optimization level is ${CXX_OPT}."
echo "INFO: optimization level is ${CXX_OPT}." >>configure.log
if [ "x${CXX_DBG}" = "x" ]; then
echo "INFO: gdb is disabled."
echo "INFO: gdb is disabled." >>configure.log
else
echo "INFO: gdb is enabled."
echo "INFO: gdb is enabled." >>configure.log
fi
if [ "x${OMPFLAGS}" = "x" ]; then
echo "INFO: OpenMP is disabled."
echo "INFO: OpenMP is disabled." >>configure.log
else
echo "INFO: OpenMP is enabled."
echo "INFO: OpenMP is enabled." >>configure.log
fi
if [ "x${MPIFLAGS}" = "x" ]; then
echo "INFO: MPI is disabled."
echo "INFO: MPI is disabled." >>configure.log
else
echo "INFO: MPI is enabled."
echo "INFO: MPI is enabled." >>configure.log
fi
if [ "x${LAPACKFLAGS}" = "x" ]; then
echo "INFO: LAPACK is disabled."
echo "INFO: LAPACK is disabled." >>configure.log
else
echo "INFO: LAPACK is enabled."
echo "INFO: LAPACK is enabled." >>configure.log
fi
if [ "x${CUBLASFLAGS}" = "x" ]; then
echo "INFO: cuBLAS was not found."
echo "INFO: cuBLAS was not found." >>configure.log
else
echo "INFO: cuBLAS was found."
echo "INFO: cuBLAS was found." >>configure.log
fi
if [ "x${MAGMAFLAGS}" = "x" ]; then
echo "INFO: MAGMA is disabled."
echo "INFO: MAGMA is disabled." >>configure.log
else
echo "INFO: MAGMA is enabled."
echo "INFO: MAGMA is enabled." >>configure.log
if [ "x${MAGMA_INVERT_FLAGS}" = "x" ]; then
echo "INFO: using LU factorisation for matrix inversion."
echo "INFO: using LU factorisation for matrix inversion." >>configure.log
elif [ "x${MAGMA_INVERT_FLAGS}" = "x -DUSE_ZGESV_GPU" ]; then
echo "INFO: using MAGMA zgesv_gpu function for matrix inversion."
echo "INFO: using MAGMA zgesv_gpu function for matrix inversion." >>configure.log
elif [ "x${MAGMA_INVERT_FLAGS}" = "x -DUSE_ZGESV_RBT" ]; then
echo "INFO: using MAGMA zgesv_rbt function for matrix inversion."
echo "INFO: using MAGMA zgesv_rbt function for matrix inversion." >>configure.log
fi
fi
if [ "x${NVTXFLAGS}" = "x" ]; then
echo "INFO: NVTX profiling is disabled."
echo "INFO: NVTX profiling is disabled." >>configure.log
else
echo "INFO: NVTX profiling is enabled."
echo "INFO: NVTX profiling is enabled." >>configure.log
fi
if [ "x${OFFLOADFLAGS}" = "x" ]; then
echo "INFO: GPU offload through OpenMP is disabled."
echo "INFO: GPU offload through OpenMP is disabled." >>configure.log
else
echo "INFO: GPU offload through OpenMP is enabled."
echo "INFO: GPU offload through OpenMP is enabled." >>configure.log
fi
if [ "x${LIBMODE}" = "xstatic" ]; then
echo "INFO: configured to build static proprietary libraries."
echo "INFO: configured to build static proprietary libraries." >>configure.log
else
echo "INFO: configured to build shared proprietary libraries."
echo "INFO: configured to build shared proprietary libraries." >>configure.log
fi
# End of summary printing section.
......@@ -911,4 +1006,5 @@ CXXLDFLAGS=${CXXLDFLAGS}
EOF
echo "configure: finished."
echo "configure: finished." >>configure.log
# End of script execution
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment