#!/bin/bash -e # --------------------------------------------------------------------------- # # cmplr.env : Defines the compiler executable and its options for WW3 # # from the compiler keyword given in argument # # # # - supported compiler are SGI-MPT, INTEL, GNU, PORTLAND # # # # # # use : cmplr.env cmplr # # # # cmplr : keyword based on a value and optional suffix and prefix # # # # value : mpt / intel / gnu / pgi # # suffix : _debug # # prefix : zeus_ / datarmor_ # # # # - examples : intel / pgi_debug / datarmor_mpt_debug # # # # remarks : # # # # - template files comp.tmpl and link.tmpl will be used to create the # # comp and link file based on the following environment variables : # # $optc, $optl, $comp_seq and $comp_mpi # # # # # # M. Accensi # # August 2018 # # --------------------------------------------------------------------------- # # disable listing done by the compiler list='no' ############################### # MPT # ############################### if [ "$cmplr" == "mpt" ] || [ "$cmplr" == "mpt_debug" ] || \ [ "$cmplr" == "zeus_mpt" ] || [ "$cmplr" == "zeus_mpt_debug" ] || \ [ "$cmplr" == "datarmor_mpt" ] || [ "$cmplr" == "datarmor_mpt_debug" ] ; then # COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common compiler comp_seq='ifort' comp_mpi='ifort -lmpi' # zeus compiler if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then comp_seq='ftn' comp_mpi='ftn' fi # OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common options optc='-c -module $path_m -no-fma -ip -p -g -i4 -real-size 32 -fp-model precise -assume byterecl -convert big_endian -fno-alias -fno-fnalias' optl='-o $prog -p -g' # list options if [ "$list" == 'yes' ] ; then optc="$optc -list"; fi # omp options if [ "$omp_mod" = 'yes' ] ; then optc="$optc -openmp"; optl="$optl -openmp"; fi # optimized options if [ -z "$(echo $cmplr | grep debug)" ] ; then optc="$optc -O3" optl="$optl -O3" fi # debugging options if [ ! -z "$(echo $cmplr | grep debug)" ] ; then optc="$optc -O0 -debug all -warn all -check all -check noarg_temp_created -fp-stack-check -heap-arrays -traceback -fpe0" optl="$optl -O0 -traceback" fi # system-dependant options if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then optc="$optc -fastsse" optl="$optl -fastsse" elif [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then optc="$optc -xcore-avx2" optl="$optl -xcore-avx2" else optc="$optc -xhost" optl="$optl -xhost" fi fi ############################### # INTEL # ############################### if [ "$cmplr" == "intel" ] || [ "$cmplr" == "intel_debug" ] || \ [ "$cmplr" == "zeus_intel" ] || [ "$cmplr" == "zeus_intel_debug" ] || \ [ "$cmplr" == "datarmor_intel" ] || [ "$cmplr" == "datarmor_intel_debug" ] ; then # COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # compiler comp_seq='ifort' comp_mpi='mpiifort' # zeus compiler if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then comp_seq='ftn' comp_mpi='ftn' fi # OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common options optc='-c -module $path_m -no-fma -ip -p -g -i4 -real-size 32 -fp-model precise -assume byterecl -convert big_endian -fno-alias -fno-fnalias' optl='-o $prog -p -g' # list options if [ "$list" == 'yes' ] ; then optc="$optc -list"; fi # omp options if [ "$omp_mod" = 'yes' ] ; then optc="$optc -openmp"; optl="$optl -openmp"; fi # optimized options if [ -z "$(echo $cmplr | grep debug)" ] ; then optc="$optc -O3" optl="$optl -O3" fi # debugging options if [ ! -z "$(echo $cmplr | grep debug)" ] ; then optc="$optc -O0 -debug all -warn all -check all -check noarg_temp_created -fp-stack-check -heap-arrays -traceback -fpe0" optl="$optl -O0 -traceback" fi # system-dependant options if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then optc="$optc -fastsse" optl="$optl -fastsse" elif [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then optc="$optc -xcore-avx2" optl="$optl -xcore-avx2" else optc="$optc -xhost" optl="$optl -xhost" fi fi ############################### # GNU # ############################### if [ "$cmplr" == "gnu" ] || [ "$cmplr" == "gnu_debug" ] || \ [ "$cmplr" == "zeus_gnu" ] || [ "$cmplr" == "zeus_gnu_debug" ] || \ [ "$cmplr" == "datarmor_gnu" ] || [ "$cmplr" == "datarmor_gnu_debug" ] ; then # COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common compiler comp_seq='gfortran' comp_mpi='mpif90' # zeus compiler if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then comp_seq='ftn' comp_mpi='ftn' fi # OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common options optc='-c -J$path_m -p -g -fno-second-underscore -ffree-line-length-none -fconvert=big-endian' optl='-o $prog -p -g' # omp options if [ "$omp_mod" = 'yes' ] ; then optc="$optc -fopenmp"; optl="$optl -fopenmp"; fi # optimized options if [ -z "$(echo $cmplr | grep debug)" ] ; then optc="$optc -O3" optl="$optl -O3" fi # debugging options if [ ! -z "$(echo $cmplr | grep debug)" ] ; then optc="$optc -O0 -Wall -fcheck=all -ffpe-trap=invalid,zero,overflow -frecursive -fbacktrace" optl="$optl -O0 -fbacktrace" fi # system-dependant options if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then optc="$optc -fastsse" optl="$optl -fastsse" elif [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then optc="$optc -march=core-avx2" optl="$optl -march=core-avx2" else optc="$optc -march=native" optl="$optl -march=native" fi fi ############################### # PGI # ############################### if [ "$cmplr" == "pgi" ] || [ "$cmplr" == "pgi_debug" ] || \ [ "$cmplr" == "zeus_pgi" ] || [ "$cmplr" == "zeus_pgi_debug" ] || \ [ "$cmplr" == "datarmor_pgi" ] || [ "$cmplr" == "datarmor_pgi_debug" ] ; then # COMPILER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common compiler comp_seq='pgf90' comp_mpi='mpif90' # zeus compiler if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then comp_seq='ftn' comp_mpi='ftn' fi # OPTIONS - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - # common options optc='-c -module $path_m -p -g -i4 -r4 -Kieee -byteswapio' optl='-o $prog -p -g' # list options if [ "$list" == 'yes' ] ; then optc="$optc -Mlist"; fi # omp options if [ "$omp_mod" = 'yes' ] ; then optc="$optc -mp"; optl="$optl -mp"; fi # optimized options if [ -z "$(echo $cmplr | grep debug)" ] ; then optc="$optc -O3" optl="$optl -O3" fi # debugging options if [ ! -z "$(echo $cmplr | grep debug)" ] ; then optc="$optc -O0 -Mbounds -Mchkfpstk -Mchkstk -Mdalign -Mdclchk -Mdepchk -Miomutex -Ktrap=fp -Mrecursive -traceback" optl="$optl -O0 -traceback" fi # system-dependant options if [ ! -z "$(echo $cmplr | grep zeus)" ] ; then optc="$optc -fastsse" optl="$optl -fastsse" elif [ ! -z "$(echo $cmplr | grep datarmor)" ] ; then optc="$(echo $optc | sed 's/O3/O2/') -Mlist" optl="$optl" else optc="$optc" optl="$optl" fi fi