Commit 2f021d62 authored by Giovanni La Mura's avatar Giovanni La Mura
Browse files

Improve ar test logic and write a configuration log file

parent b706f13d
Loading
Loading
Loading
Loading
+1 −0
Original line number Original line Diff line number Diff line
build/autom4te.cache
build/autom4te.cache
build/config.*
build/config.*
build/configure.log
build/cluster/*
build/cluster/*
build/error.log
build/error.log
build/inclusion/*
build/inclusion/*
+106 −11
Original line number Original line Diff line number Diff line
@@ -174,6 +174,7 @@ do
	dbg_feature=$(echo $arg | cut -d '=' -f2)
	dbg_feature=$(echo $arg | cut -d '=' -f2)
	if [ "x$dbg_feature" = "x" ]; then
	if [ "x$dbg_feature" = "x" ]; then
	    echo "ERROR: no debug feature specified!"
	    echo "ERROR: no debug feature specified!"
	    echo "ERROR: no debug feature specified!" >>configure.log
	    exit 1
	    exit 1
	else
	else
	    if [ "x$DEBUGFLAGS" = "x" ]; then
	    if [ "x$DEBUGFLAGS" = "x" ]; then
@@ -190,6 +191,7 @@ do
	opt_level=$(echo $arg | cut -d '=' -f2)
	opt_level=$(echo $arg | cut -d '=' -f2)
	if [ $opt_level -lt 0 -o $opt_level -gt 3 ]; then
	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"
	    echo "ERROR: invalid optimization level $opt_level" >>configure.log
	    exit 1
	    exit 1
	fi
	fi
	FC_OPT=$opt_level
	FC_OPT=$opt_level
@@ -218,6 +220,7 @@ do
	HDF5_HOME=$(echo $arg | cut -d '=' -f2)
	HDF5_HOME=$(echo $arg | cut -d '=' -f2)
	if [ "x${HDF5_HOME}" = "x" ]; then
	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."
	    echo "ERROR: option --with-hdf5 requires a valid HDF5 path." >>configure.log
	    exit 1
	    exit 1
	fi
	fi
    elif [ "x$cut_arg" = "x--with-include" ]; then
    elif [ "x$cut_arg" = "x--with-include" ]; then
@@ -245,41 +248,56 @@ do
	    MAGMA_INVERT_FLAGS=" -DUSE_ZGESV_RBT"
	    MAGMA_INVERT_FLAGS=" -DUSE_ZGESV_RBT"
	else
	else
	    echo "ERROR: unrecognized --enable-magma-invert option \"$MAGMA_INVERT_CHOICE\""
	    echo "ERROR: unrecognized --enable-magma-invert option \"$MAGMA_INVERT_CHOICE\""
	    echo "ERROR: unrecognized --enable-magma-invert option \"$MAGMA_INVERT_CHOICE\"" >>configure.log
	    exit 1
	    exit 1
	fi
	fi
    else
    else
	echo "ERROR: unrecognized argument \"$arg\""
	echo "ERROR: unrecognized argument \"$arg\""
	echo "ERROR: unrecognized argument \"$arg\"" >>configure.log
	exit 1
	exit 1
    fi
    fi
done
done
# End of argument parsing section
# End of argument parsing section


# Configuration logic
# Configuration logic
echo "NPtm_code configuration"
echo "NPtm_code configuration" > configure.log
echo -n "" > error.log
# Check for AR
# Check for AR
echo -n "configure: checking 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
    if [ "x$AR" = "x" ]; then
	AR="ar"
	AR="ar"
    fi
    fi
$AR --version > /dev/null 2>>error.log
fi
which $AR >/dev/null 2>>error.log
result=$?
result=$?
if [ "x$result" = "x0" ]; then
if [ "x$result" != "x0" ]; then
    echo "$AR"
else
    echo "none"
    echo "none"
    echo "none" >>configure.log
    if [ "x$LIBMODE" = "xstatic" ]; then
    if [ "x$LIBMODE" = "xstatic" ]; then
	echo "ERROR: ar not found!"
	echo "ERROR: $AR not found!"
	echo "ERROR: $AR not found!" >>configure.log
	exit 2
	exit 2
    fi
    fi
else
    echo $AR
    echo $AR >>configure.log
fi
fi
# Check FORTRAN compiler (if required)
# Check FORTRAN compiler (if required)
if [ "x$FC" = "x" ]; then
if [ "x$FC" = "x" ]; then
    echo -n "configure: checking for FORTRAN compiler... "
    echo -n "configure: checking for FORTRAN compiler... "
    echo -n "configure: checking for FORTRAN compiler... " >>configure.log
    FC=$(guess_fc)
    FC=$(guess_fc)
    echo $FC
    echo $FC
    echo $FC
fi
fi
if [ "x$FC" = "xnone" ]; then
if [ "x$FC" = "xnone" ]; then
    if [ "x$BUILDFORTRAN" = "xyes" ]; 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."
	echo "ERROR: FORTRAN compilation was requested, but no FORTRAN compiler found." >>configure.log
	exit 2
	exit 2
    else
    else
	BUILDFORTRAN=""
	BUILDFORTRAN=""
@@ -289,6 +307,7 @@ else
	BUILDFORTRAN="yes"
	BUILDFORTRAN="yes"
    fi
    fi
    echo -n "configure: checking whether $FC supports -ggdb... "
    echo -n "configure: checking whether $FC supports -ggdb... "
    echo -n "configure: checking whether $FC supports -ggdb... " >>configure.log
    cat > test_fortran.f <<EOF
    cat > test_fortran.f <<EOF
      PROGRAM CONF_TEST_FORTRAN
      PROGRAM CONF_TEST_FORTRAN
      I=2
      I=2
@@ -299,9 +318,11 @@ EOF
    result=$?
    result=$?
    if [ "x$result" = "x0" ]; then
    if [ "x$result" = "x0" ]; then
	echo "yes"
	echo "yes"
	echo "yes" >>configure.log
	rm test_fortran.f test_fortran
	rm test_fortran.f test_fortran
    else
    else
	echo "no"
	echo "no"
	echo "no" >>configure.log
	rm test_fortran.f
	rm test_fortran.f
	FC_DBG=""
	FC_DBG=""
    fi
    fi
@@ -310,23 +331,30 @@ EOF
    if [ "x$result" = "x0" ]; then
    if [ "x$result" = "x0" ]; then
	FCFLAGS="-O${FC_OPT}${FC_DBG} -std=legacy"
	FCFLAGS="-O${FC_OPT}${FC_DBG} -std=legacy"
	echo "yes"
	echo "yes"
	echo "yes" >>configure.log
    else
    else
	FCFLAGS="-O$FC_OPT${FC_DBG}"
	FCFLAGS="-O$FC_OPT${FC_DBG}"
	echo "no"
	echo "no"
	echo "WARNING: FORTRAN compiler does not support legacy flag."
	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
fi # End of FORTRAN compiler check
fi # End of FORTRAN compiler check


# Check C++ compiler (mandatory)
# Check C++ compiler (mandatory)
if [ "x$CXX" = "x" ]; then
if [ "x$CXX" = "x" ]; then
    echo -n "configure: checking for C++ compiler... "
    echo -n "configure: checking for C++ compiler... "
    echo -n "configure: checking for C++ compiler... " >>configure.log
    CXX=$(guess_cxx)
    CXX=$(guess_cxx)
    echo $CXX
    echo $CXX
    echo $CXX
else
else
    echo "configure: using $CXX as C++ compiler."
    echo "configure: using $CXX as C++ compiler."
    echo "configure: using $CXX as C++ compiler." >>configure.log
fi
fi
if [ "x$CXX" = "xnone" ]; then
if [ "x$CXX" = "xnone" ]; then
    echo "ERROR: no C++ compiler found!"
    echo "ERROR: no C++ compiler found!"
    echo "ERROR: no C++ compiler found!" >>configure.log
    exit 2
    exit 2
fi
fi
CLANGFLAGS=""
CLANGFLAGS=""
@@ -336,6 +364,7 @@ if [ "x$result" = "x0" ]; then
    CLANGFLAGS=" -stdlib=libstdc++"
    CLANGFLAGS=" -stdlib=libstdc++"
fi
fi
echo -n "configure: checking wether $CXX works... "
echo -n "configure: checking wether $CXX works... "
echo -n "configure: checking wether $CXX works... " >>configure.log
cat > test_compiler.cpp <<EOF
cat > test_compiler.cpp <<EOF
int main() {
int main() {
  int i = -1;
  int i = -1;
@@ -347,31 +376,41 @@ $CXX $CLANGFLAGS test_compiler.cpp -o test_compiler > /dev/null 2>>error.log
result=$?
result=$?
if [ "x$result" = "x0" ]; then
if [ "x$result" = "x0" ]; then
    echo "yes"
    echo "yes"
    echo "yes" >>configure.log
else
else
    echo "no"
    echo "no"
    echo "ERROR: $CXX is not a working C++ compiler!"
    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
    exit 2
fi
fi
echo -n "configure: checking wether $CXX supports -ggdb... "
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
$CXX $CLANGFLAGS -ggdb test_compiler.cpp -o test_compiler > /dev/null 2>>error.log
result=$?
result=$?
if [ "x$result" = "x0" ]; then
if [ "x$result" = "x0" ]; then
    echo "yes"
    echo "yes"
    echo "yes" >>configure.log
    rm test_compiler.cpp test_compiler
    rm test_compiler.cpp test_compiler
else
else
    echo "no"
    echo "no"
    echo "no" >>configure.log
    rm test_compiler.cpp
    rm test_compiler.cpp
    CXX_DBG=""
    CXX_DBG=""
fi
fi
echo -n "configure: checking whether $CXX is a GNU compiler... "
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
$CXX --version | grep "g++" > /dev/null
result=$?
result=$?
if [ "x$result" = "x0" ]; then
if [ "x$result" = "x0" ]; then
    echo "yes"
    echo "yes"
    echo "yes" >>configure.log
else
else
    echo "no"
    echo "no"
    echo "no" >>configure.log
fi
fi
echo -n "configure: checking wether $CXX is a MPI compiler... "
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
cat > test_compiler.cpp <<EOF
# include <mpi.h>
# include <mpi.h>
int main() {
int main() {
@@ -391,19 +430,23 @@ if [ "x$result" = "x0" ]; then
    result=$?
    result=$?
    if [ "x$result" = "x0" ]; then
    if [ "x$result" = "x0" ]; then
	echo "yes"
	echo "yes"
	echo "yes" >>configure.log
	MPIFLAGS=" -DUSE_MPI"
	MPIFLAGS=" -DUSE_MPI"
    else
    else
	echo "no"
	echo "no"
	echo "no" >>configure.log
	MPIFLAGS=""
	MPIFLAGS=""
    fi
    fi
    rm test_compiler test_compiler.cpp
    rm test_compiler test_compiler.cpp
else
else
    echo "no"
    echo "no"
    echo "no" >>configure.log
    MPIFLAGS=""
    MPIFLAGS=""
    rm test_compiler.cpp
    rm test_compiler.cpp
fi
fi
if [ "x$OMPMODE" != "xno" ]; then
if [ "x$OMPMODE" != "xno" ]; then
    echo -n "configure: checking whether $CXX supports OpenMP... "
    echo -n "configure: checking whether $CXX supports OpenMP... "
    echo -n "configure: checking whether $CXX supports OpenMP... " >>configure.log
    cat > test_compiler.cpp <<EOF
    cat > test_compiler.cpp <<EOF
#include <omp.h>
#include <omp.h>
int main() {
int main() {
@@ -419,13 +462,16 @@ EOF
	result=$?
	result=$?
	if [ "x$result" = "x0" ]; then
	if [ "x$result" = "x0" ]; then
	    echo "yes"
	    echo "yes"
	    echo "yes" >>configure.log
	    OMPFLAGS=" -fopenmp -DUSE_OMP"
	    OMPFLAGS=" -fopenmp -DUSE_OMP"
	else
	else
	    echo "no"
	    echo "no"
	    echo "no" >>configure.log
	    OMP_FLAGS=""
	    OMP_FLAGS=""
	    OFFLOAD="no"
	    OFFLOAD="no"
	    if [ "x$OMPMODE" = "xyes" ]; then
	    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."
		echo "ERROR: OpenMP was requested, but it is not supported." >>configure.log
		rm test_compiler test_compiler.cpp
		rm test_compiler test_compiler.cpp
		exit 2
		exit 2
	    fi
	    fi
@@ -433,10 +479,12 @@ EOF
	rm test_compiler test_compiler.cpp
	rm test_compiler test_compiler.cpp
    else
    else
	echo "no"
	echo "no"
	echo "no" >>configure.log
	OMP_FLAGS=""
	OMP_FLAGS=""
	OFFLOAD="no"
	OFFLOAD="no"
	if [ "x$OMPMODE" = "xyes" ]; then
	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."
	    echo "ERROR: OpenMP was requested, but it is not supported." >>configure.log
	    rm test_compiler.cpp
	    rm test_compiler.cpp
	    exit 2
	    exit 2
	fi
	fi
@@ -446,6 +494,7 @@ fi
# End of C++ compiler check
# End of C++ compiler check
# Check HDF5
# Check HDF5
echo -n "configure: checking for HDF5 header flags..."
echo -n "configure: checking for HDF5 header flags..."
echo -n "configure: checking for HDF5 header flags..." >>configure.log
if [ "x$HDF5_HOME" != "x" ]; then
if [ "x$HDF5_HOME" != "x" ]; then
    HDF5_INCLUDE="$HDF5_HOME/include"
    HDF5_INCLUDE="$HDF5_HOME/include"
    HDF5_LIB="$HDF5_HOME/lib"
    HDF5_LIB="$HDF5_HOME/lib"
@@ -508,14 +557,18 @@ fi
if [ "x$HDF5FLAGS" = "x" ]; then
if [ "x$HDF5FLAGS" = "x" ]; then
    echo "not found."
    echo "not found."
    echo "ERROR: HDF5 headers not found!"
    echo "ERROR: HDF5 headers not found!"
    echo "not found." >>configure.log
    echo "ERROR: HDF5 headers not found!" >>configure.log
    exit 2
    exit 2
else
else
    echo "$HDF5FLAGS"
    echo "$HDF5FLAGS"
    echo "$HDF5FLAGS" >>configure.log
fi
fi
# End of HDF5 check
# End of HDF5 check
# LAPACK checks
# LAPACK checks
if [ "x$LAPACK" != "xno" ]; then
if [ "x$LAPACK" != "xno" ]; then
    echo -n "configure: checking for LAPACK... "
    echo -n "configure: checking for LAPACK... "
    echo -n "configure: checking for LAPACK... " >>configure.log
    if [ "x$ENABLE_ILP64" = "xyes" ]; then
    if [ "x$ENABLE_ILP64" = "xyes" ]; then
	# 64-bit indices are enabled
	# 64-bit indices are enabled
	LAPACK_ILP64_FLAG="-DLAPACK_ILP64 -DUSE_ILP64"
	LAPACK_ILP64_FLAG="-DLAPACK_ILP64 -DUSE_ILP64"
@@ -544,6 +597,7 @@ if [ "x$LAPACK" != "xno" ]; then
            LAPACKFLAGS=" -DUSE_LAPACK -DUSE_MKL ${LAPACK_ILP64_FLAG} ${MKL_INCLUDE}"
            LAPACKFLAGS=" -DUSE_LAPACK -DUSE_MKL ${LAPACK_ILP64_FLAG} ${MKL_INCLUDE}"
            LAPACKLDFLAGS="$(pkg-config --libs ${MKL_BUILD})"
            LAPACKLDFLAGS="$(pkg-config --libs ${MKL_BUILD})"
	    echo "MKL"
	    echo "MKL"
	    echo "MKL" >>configure.log
      else
      else
          # MKL was not found, so configuration searches for BLAS
          # MKL was not found, so configuration searches for BLAS
          declare -a pkg_array=$(pkg-config --list-all | grep blas${LAPACK_LDSPEC})
          declare -a pkg_array=$(pkg-config --list-all | grep blas${LAPACK_LDSPEC})
@@ -571,6 +625,7 @@ if [ "x$LAPACK" != "xno" ]; then
              LAPACKFLAGS=" -DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${LAPACK_INCLUDE} ${BLASFLAGS}"
              LAPACKFLAGS=" -DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${LAPACK_INCLUDE} ${BLASFLAGS}"
              LAPACKLDFLAGS="$(pkg-config --libs lapacke${LAPACK_LDSPEC}) ${BLASLDFLAGS}"
              LAPACKLDFLAGS="$(pkg-config --libs lapacke${LAPACK_LDSPEC}) ${BLASLDFLAGS}"
	      echo "lapacke"
	      echo "lapacke"
	      echo "lapacke" >>configure.log
          fi # end of LAPACKe decision tree
          fi # end of LAPACKe decision tree
          if [ "x${LAPACKFLAGS}${LAPACKLDFLAGS}" = "x" ]; then
          if [ "x${LAPACKFLAGS}${LAPACKLDFLAGS}" = "x" ]; then
              # LAPACKe was not found, so configuration searches for LAPACK
              # LAPACKe was not found, so configuration searches for LAPACK
@@ -583,6 +638,7 @@ if [ "x$LAPACK" != "xno" ]; then
		  LAPACKFLAGS=" -DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${LAPACK_INCLUDE} ${BLASFLAGS}"
		  LAPACKFLAGS=" -DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${LAPACK_INCLUDE} ${BLASFLAGS}"
		  LAPACKLDFLAGS="$(pkg-config --libs lapack${LAPACK_LDSPEC}) ${BLASLDFLAGS}"
		  LAPACKLDFLAGS="$(pkg-config --libs lapack${LAPACK_LDSPEC}) ${BLASLDFLAGS}"
		  echo "LAPACK"
		  echo "LAPACK"
		  echo "LAPACK" >>configure.log
              fi # end of LAPACK decision tree
              fi # end of LAPACK decision tree
          fi # end of LAPACKe decision tree
          fi # end of LAPACKe decision tree
	fi # end of MKL decision tree
	fi # end of MKL decision tree
@@ -594,18 +650,22 @@ if [ "x$LAPACK" != "xno" ]; then
            LAPACKFLAGS=" -DUSE_LAPACK -DUSE_MKL ${LAPACK_ILP64_FLAG} -I{MKLROOT}/include"
            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"
            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"
	    echo "MKL" >>configure.log
	else
	else
            if [ -f /usr/include/lapacke.h ]; then
            if [ -f /usr/include/lapacke.h ]; then
		LAPACKFLAGS=" -DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${BLASFLAGS}"
		LAPACKFLAGS=" -DUSE_LAPACK ${LAPACK_ILP64_FLAG} ${BLASFLAGS}"
		LAPACKLDFLAGS=" -llapacke${LAPACK_LDSPEC} ${BLASLDFLAGS}"
		LAPACKLDFLAGS=" -llapacke${LAPACK_LDSPEC} ${BLASLDFLAGS}"
		echo "lapacke"
		echo "lapacke"
		echo "lapacke" >>configure.log
            fi
            fi
	fi
	fi
    fi
    fi
    if [ "x$LAPACKFLAGS" = "x" ]; then
    if [ "x$LAPACKFLAGS" = "x" ]; then
	echo "no"
	echo "no"
	echo "no" >>configure.log
	if [ "x$LAPACK" = "xyes" ]; then
	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."
	    echo "ERROR: LAPACK was required, but no LAPACK was found." >>configure.log
	fi
	fi
    fi
    fi
fi
fi
@@ -613,6 +673,7 @@ fi
# cuBLAS checks
# cuBLAS checks
if [ "x$CUBLAS" != "xno" ]; then
if [ "x$CUBLAS" != "xno" ]; then
    echo -n "configure: checking for cuBLAS... "
    echo -n "configure: checking for cuBLAS... "
    echo -n "configure: checking for cuBLAS... " >>configure.log
    pkg-config --version > /dev/null
    pkg-config --version > /dev/null
    use_pkg_config=$?
    use_pkg_config=$?
    if [ "x${CUDAFLAGS}${CUDALDFLAGS}" = "x" ]; then
    if [ "x${CUDAFLAGS}${CUDALDFLAGS}" = "x" ]; then
@@ -675,13 +736,16 @@ if [ "x$CUBLAS" != "xno" ]; then
	CUBLASLDFLAGS="${CUDALDFLAGS}"
	CUBLASLDFLAGS="${CUDALDFLAGS}"
    fi
    fi
    if [ "x$CUBLASFLAGS$CUBLASLDFLAGS" = "x" ]; then
    if [ "x$CUBLASFLAGS$CUBLASLDFLAGS" = "x" ]; then
	echo "no"
	echo "no"
	echo "no"
	if [ "x$CUBLAS" = "xyes" ]; then
	if [ "x$CUBLAS" = "xyes" ]; then
	    echo "ERROR: cuBLAS was required, but no cuBLAS found."
	    echo "ERROR: cuBLAS was required, but no cuBLAS found."
	    echo "ERROR: cuBLAS was required, but no cuBLAS found." >>configure.log
	    exit 2
	    exit 2
	fi
	fi
    else
    else
	echo "cuBLAS"
	echo "cuBLAS"
	echo "cuBLAS" >>configure.log
    fi
    fi
else
else
    CUBLASFLAGS=""
    CUBLASFLAGS=""
@@ -690,6 +754,7 @@ fi
# End of cuBLAS checks
# End of cuBLAS checks
# MAGMA checks
# MAGMA checks
if [ "x$MAGMA" != "xno" ]; then
if [ "x$MAGMA" != "xno" ]; then
    echo -n "configure: checking for MAGMA... "
    echo -n "configure: checking for MAGMA... "
    echo -n "configure: checking for MAGMA... "
    if [ "x$ENABLE_ILP64" = "xyes" ]; then
    if [ "x$ENABLE_ILP64" = "xyes" ]; then
	# 64-bit indices are enabled
	# 64-bit indices are enabled
@@ -763,8 +828,10 @@ if [ "x$MAGMA" != "xno" ]; then
    fi
    fi
    if [ "x$MAGMAFLAGS$MAGMALDFLAGS" = "x" ]; then
    if [ "x$MAGMAFLAGS$MAGMALDFLAGS" = "x" ]; then
	echo "no"
	echo "no"
	echo "no" >>configure.log
	if [ "x$MAGMA" = "xyes" ]; then
	if [ "x$MAGMA" = "xyes" ]; then
	    echo "ERROR: MAGMA was required, but no MAGMA found."
	    echo "ERROR: MAGMA was required, but no MAGMA found."
	    echo "ERROR: MAGMA was required, but no MAGMA found." >>configure.log
	    exit 2
	    exit 2
	fi
	fi
    else
    else
@@ -774,6 +841,7 @@ if [ "x$MAGMA" != "xno" ]; then
	    MAGMAFLAGS="$MAGMAFLAGS$MAGMA_INVERT_FLAGS"
	    MAGMAFLAGS="$MAGMAFLAGS$MAGMA_INVERT_FLAGS"
	fi
	fi
	echo "yes"
	echo "yes"
	echo "yes" >>configure.log
    fi
    fi
else
else
    MAGMAFLAGS=""
    MAGMAFLAGS=""
@@ -783,13 +851,13 @@ fi
# Offload checks
# Offload checks
if [ "x$OFFLOAD" != "xno" ]; then
if [ "x$OFFLOAD" != "xno" ]; then
    echo -n "configure: checking whether system supports offload... "
    echo -n "configure: checking whether system supports offload... "
    echo -n "configure: checking whether system supports offload... " >>configure.log
    cat > conf_test_offload.cpp <<EOF
    cat > conf_test_offload.cpp <<EOF
#include <omp.h>
#include <omp.h>
#pragma omp requires unified_shared_memory


#pragma omp begin declare target device_type(any)
#pragma omp begin declare target device_type(any)
void fill_with_ones(int *array) {
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 i = 0; i < 1000; i++) {
    for (int j = 0; j < 1000; j++) {
    for (int j = 0; j < 1000; j++) {
      array[(1000 * i) + j] = 1;
      array[(1000 * i) + j] = 1;
@@ -797,14 +865,16 @@ void fill_with_ones(int *array) {
  }
  }
}
}
#pragma omp end declare target
#pragma omp end declare target

int main(int argc, char** argv) {
int main(int argc, char** argv) {
  int *numbers = new int[1000000]();
  int *numbers = new int[1000000]();
#pragma omp target map(tofrom:numbers[0:1000000])
  fill_with_ones(numbers);
  fill_with_ones(numbers);
  delete[] numbers;
  delete[] numbers;
  return 0;
  return 0;
}
}
EOF
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=$?
    result=$?
    rm conf_test_offload.cpp
    rm conf_test_offload.cpp
    if [ "x$result" = "x0" ]; then
    if [ "x$result" = "x0" ]; then
@@ -814,12 +884,14 @@ EOF
    fi
    fi
    if [ "x$result" = "x0" ]; then
    if [ "x$result" = "x0" ]; then
	echo "yes"
	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
	if [ "x${OMPFLAGS}" = "x" ]; then
	    OFFLOADFLAGS="${OFFLOADFLAGS} -fopenmp"
	    OFFLOADFLAGS="-fopenmp ${OFFLOADFLAGS}"
	fi
	fi
    else
    else
	echo "no"
	echo "no"
	echo "no" >>configure.log
	OFFLOADFLAGS=""
	OFFLOADFLAGS=""
    fi
    fi
else
else
@@ -844,57 +916,79 @@ fi


# Print a summary of configuration options
# Print a summary of configuration options
echo "INFO: optimization level is ${CXX_OPT}."
echo "INFO: optimization level is ${CXX_OPT}."
echo "INFO: optimization level is ${CXX_OPT}." >>configure.log
if [ "x${CXX_DBG}" = "x" ]; then
if [ "x${CXX_DBG}" = "x" ]; then
    echo "INFO: gdb is disabled."
    echo "INFO: gdb is disabled."
    echo "INFO: gdb is disabled." >>configure.log
else
else
    echo "INFO: gdb is enabled."
    echo "INFO: gdb is enabled."
    echo "INFO: gdb is enabled." >>configure.log
fi
fi
if [ "x${OMPFLAGS}" = "x" ]; then
if [ "x${OMPFLAGS}" = "x" ]; then
    echo "INFO: OpenMP is disabled."
    echo "INFO: OpenMP is disabled."
    echo "INFO: OpenMP is disabled." >>configure.log
else
else
    echo "INFO: OpenMP is enabled."
    echo "INFO: OpenMP is enabled."
    echo "INFO: OpenMP is enabled." >>configure.log
fi
fi
if [ "x${MPIFLAGS}" = "x" ]; then
if [ "x${MPIFLAGS}" = "x" ]; then
    echo "INFO: MPI is disabled."
    echo "INFO: MPI is disabled."
    echo "INFO: MPI is disabled." >>configure.log
else
else
    echo "INFO: MPI is enabled."
    echo "INFO: MPI is enabled."
    echo "INFO: MPI is enabled." >>configure.log
fi
fi
if [ "x${LAPACKFLAGS}" = "x" ]; then
if [ "x${LAPACKFLAGS}" = "x" ]; then
    echo "INFO: LAPACK is disabled."
    echo "INFO: LAPACK is disabled."
    echo "INFO: LAPACK is disabled." >>configure.log
else
else
    echo "INFO: LAPACK is enabled."
    echo "INFO: LAPACK is enabled."
    echo "INFO: LAPACK is enabled." >>configure.log
fi
fi
if [ "x${CUBLASFLAGS}" = "x" ]; then
if [ "x${CUBLASFLAGS}" = "x" ]; then
    echo "INFO: cuBLAS was not found."
    echo "INFO: cuBLAS was not found."
    echo "INFO: cuBLAS was not found." >>configure.log
else
else
    echo "INFO: cuBLAS was found."
    echo "INFO: cuBLAS was found."
    echo "INFO: cuBLAS was found." >>configure.log
fi
fi
if [ "x${MAGMAFLAGS}" = "x" ]; then
if [ "x${MAGMAFLAGS}" = "x" ]; then
    echo "INFO: MAGMA is disabled."
    echo "INFO: MAGMA is disabled."
    echo "INFO: MAGMA is disabled." >>configure.log
else
else
    echo "INFO: MAGMA is enabled."
    echo "INFO: MAGMA is enabled."
    echo "INFO: MAGMA is enabled." >>configure.log
    if [ "x${MAGMA_INVERT_FLAGS}" = "x" ]; then
    if [ "x${MAGMA_INVERT_FLAGS}" = "x" ]; then
	echo "INFO: using LU factorisation for matrix inversion."
	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
    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."
	echo "INFO: using MAGMA zgesv_gpu function for matrix inversion." >>configure.log
    elif [ "x${MAGMA_INVERT_FLAGS}" = "x -DUSE_ZGESV_RBT" ]; then
    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."
	echo "INFO: using MAGMA zgesv_rbt function for matrix inversion." >>configure.log
    fi
    fi
fi
fi
if [ "x${NVTXFLAGS}" = "x" ]; then
if [ "x${NVTXFLAGS}" = "x" ]; then
    echo "INFO: NVTX profiling is disabled."
    echo "INFO: NVTX profiling is disabled."
    echo "INFO: NVTX profiling is disabled." >>configure.log
else
else
    echo "INFO: NVTX profiling is enabled."
    echo "INFO: NVTX profiling is enabled."
    echo "INFO: NVTX profiling is enabled." >>configure.log
fi
fi
if [ "x${OFFLOADFLAGS}" = "x" ]; then
if [ "x${OFFLOADFLAGS}" = "x" ]; then
    echo "INFO: GPU offload through OpenMP is disabled."
    echo "INFO: GPU offload through OpenMP is disabled."
    echo "INFO: GPU offload through OpenMP is disabled." >>configure.log
else
else
    echo "INFO: GPU offload through OpenMP is enabled."
    echo "INFO: GPU offload through OpenMP is enabled."
    echo "INFO: GPU offload through OpenMP is enabled." >>configure.log
fi
fi
if [ "x${LIBMODE}" = "xstatic" ]; then
if [ "x${LIBMODE}" = "xstatic" ]; then
    echo "INFO: configured to build static proprietary libraries."
    echo "INFO: configured to build static proprietary libraries."
    echo "INFO: configured to build static proprietary libraries." >>configure.log
else
else
    echo "INFO: configured to build shared proprietary libraries."
    echo "INFO: configured to build shared proprietary libraries."
    echo "INFO: configured to build shared proprietary libraries." >>configure.log
fi
fi
# End of summary printing section.
# End of summary printing section.


@@ -911,4 +1005,5 @@ CXXLDFLAGS=${CXXLDFLAGS}
EOF
EOF


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