From 5dcb1d9139c6181b8f67b1f76268bcf5612d4123 Mon Sep 17 00:00:00 2001 From: Ricardo Frantz Date: Thu, 14 Dec 2023 15:56:36 +0000 Subject: [PATCH] adding installer script (experimental) --- install.sh | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 install.sh diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..4f0c7f9 --- /dev/null +++ b/install.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +FC="mpif90" +FFLAGS="" + +if command -v mpiifort >/dev/null 2>&1; then + echo "Compiler found: $(mpiifort -v)" + FC="mpiifort" + FFLAGS+=" -O3 -no-prec-div -fp-model fast=2 -xHost -g -traceback" + if command -v mpiifx >/dev/null 2>&1; then + echo "Using LLVM version of Intel compiler..." + FC="mpiifx" + FFLAGS+=" -qmkl" + else + echo "LLVM not found, using classic." + FFLAGS+=" -ipo -qmkl" + fi +else + echo "Compiler found: $(mpif90 --version | head -n1)" + FFLAGS+=" -O3 -march=native -funroll-loops -ffast-math -g -fbacktrace" +fi +#FFLAGS+=" -fanalyser" # Enable the Clang Static Analyzer for code analysis +# export FFLAGS +# export FC + +echo "Compiler: $FC" +echo "Flags: $FFLAGS" + +if ! command -v fpm &> /dev/null +then + echo "fpm could not be found" + exit +fi + +fpm clean +#fpm test --verbose --compiler "$FC" --flag "$FFLAGS" || { echo 'fpm test failed' ; exit 1; } +fpm install --verbose --compiler="$FC" --flag="$FFLAGS" || { echo 'fpm install failed' ; exit 1; } + + +# fpm test --compiler 'mpif90' --flag "-O3 -march=native -funroll-loops -ffast-math -g -fbacktrace" +# fpm test --compiler 'mpiifort' --flag "-O3 -no-prec-div -fp-model fast=2 -xHost -g -traceback -ipo -mkl" +# fpm test --compiler 'mpiifx' --flag " -O3 -no-prec-div -fp-model fast=2 -xHost -g -traceback -qmkl" \ No newline at end of file