Commit 844c9bb9 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Write a log file of the configuration step

parent 4fbdcb10
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
build/autom4te.cache
build/config.*
build/configure.log
build/cluster/*
build/error.log
build/inclusion/*
+89 −2
Original line number Diff line number Diff line
@@ -140,6 +140,9 @@ EOF
num_args=${#@}
declare -a args=("$@")

echo "NPtm_code configuration"
echo "NPtm_code configuration" > configure.log

# Argument parsing section
for arg in "${args[@]}"
do
@@ -174,6 +177,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 +194,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 +223,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,10 +251,12 @@ 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
@@ -257,6 +265,7 @@ done
# Configuration logic
# Check for AR
echo -n "configure: checking for ar... "
echo -n "configure: checking for ar... " >> configure.log
if [ "x$AR" = "x" ]; then
    AR="ar"
fi
@@ -264,22 +273,28 @@ $AR --version > /dev/null 2>>error.log
result=$?
if [ "x$result" = "x0" ]; then
    echo "$AR"
    echo "$AR" >> configure.log
else
    echo "none"
    echo "none" >> configure.log
    if [ "x$LIBMODE" = "xstatic" ]; then
	echo "ERROR: ar not found!"
	echo "ERROR: ar not found!" >> configure.log
	exit 2
    fi
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 +304,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 +315,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 "no" >> configure.log
	echo "WARNING: FORTRAN compiler does not support legacy flag."
	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 +362,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 +374,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 +428,22 @@ 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,9 +459,11 @@ 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
@@ -433,6 +475,7 @@ EOF
	rm test_compiler test_compiler.cpp
    else
	echo "no"
	echo "no" >> configure.log
	OMP_FLAGS=""
	OFFLOAD="no"
	if [ "x$OMPMODE" = "xyes" ]; then
@@ -446,6 +489,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 +552,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 +592,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 +620,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 +633,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 +645,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 +668,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 +732,14 @@ 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 +749,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 +822,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 +835,7 @@ if [ "x$MAGMA" != "xno" ]; then
	    MAGMAFLAGS="$MAGMAFLAGS$MAGMA_INVERT_FLAGS"
	fi
	echo "yes"
	echo "yes" >> configure.log
    fi
else
    MAGMAFLAGS=""
@@ -783,6 +845,7 @@ 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>

@@ -817,12 +880,14 @@ EOF
    fi
    if [ "x$result" = "x0" ]; then
	echo "yes"
	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"
	fi
    else
	echo "no"
	echo "no" >> configure.log
	OFFLOADFLAGS=""
    fi
else
@@ -849,55 +914,76 @@ fi
echo "INFO: optimization level is ${CXX_OPT}."
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.

@@ -914,4 +1000,5 @@ CXXLDFLAGS=${CXXLDFLAGS}
EOF

echo "configure: finished."
echo "configure: finished." >> configure.log
# End of script execution