Warning, /tools/build_options/linux_amd64_ifort_albedo is written in an unsupported language. File is not indexed.
view on githubraw file Latest commit c5638583 on 2023-02-07 23:00:11 UTC
c563858366 Mart*0001 #!/bin/bash
0002 #
0003 # Build options for intel compiler on Linux amd64 platform albedo (@AWI)
0004 # derived from linux_amd64_ifort
0005 #
0006 # Tested with intel-oneapi-compilers/2022.1.0 loading the following modules
0007 #
0008 # module purge (to remove you have anything that may conflict with ifort)
0009 # module load intel-oneapi-compilers
0010 # # module load intel-oneapi-mkl
0011 # module load intel-oneapi-mpi
0012 # module load netcdf-fortran/4.5.4-oneapi2022.1.0
0013 # albedo0::> module list
0014 # Currently Loaded Modulefiles:
0015 # 1) intel-oneapi-compilers/2022.1.0 2) intel-oneapi-mpi/2021.6.0
0016 # 3) netcdf-fortran/4.5.4-oneapi2022.1.0
0017
0018 if test "x$MPI" = xtrue ; then
0019 CC=mpiicc
0020 FC=mpiifort
0021 F90C=mpiifort
0022 else
0023 CC=icc
0024 FC=ifort
0025 F90C=ifort
0026 fi
0027 #LINK="$F90C -ipo"
0028
0029 DEFINES='-DWORDLENGTH=4'
0030 F90FIXEDFORMAT='-fixed -Tf'
0031 EXTENDED_SRC_FLAG='-132'
0032 GET_FC_VERSION="--version"
0033 OMPFLAG='-qopenmp'
0034
0035 NOOPTFLAGS='-O0'
0036 NOOPTFILES=''
0037
0038 FFLAGS="$FFLAGS -W0 -WB -convert big_endian -assume byterecl"
0039 FFLAGS="$FFLAGS -fPIC"
0040 #- might want to use '-r8' for fizhi pkg:
0041 #FFLAGS="$FFLAGS -r8"
0042
0043 if test "x$IEEE" = x ; then #- with optimisation:
0044 # FOPTIM='-fast' does not work because there are no static netcdf
0045 # libaries, also the implied '-xHost' is not recognized so we use
0046 # -xcore-avx2 instead and spell out the options explicitly.
0047 # '-ipo' makes linking very slow with no effect, so we will skip that, too.
0048 #FOPTIM='-ipo -align -O3 -static -no-prec-div -fp-model fast=2 -xHost'
0049 FOPTIM='-ip -align -O3 -no-prec-div -fp-model fast=2 -march=core-avx2'
0050 # probably not necessary
0051 FOPTIM="$FOPTIM -mtune=core-avx2"
0052 # additional options from benchmarkers
0053 FOPTIM="$FOPTIM -qopt-prefetch=5 -unroll-aggressive"
0054 # report optimization (very cryptic)
0055 #FOPTIM="$FOPTIM -qopt-report5"
0056 # reduce optimization level a little for some files
0057 NOOPTFLAGS='-ip -align -O1 -no-prec-div -fp-model fast=2 -march=core-avx2'
0058 #NOOPTFLAGS="$NOOPTFLAGS -mtune=core-avx2"
0059 NOOPTFILES='obcs_init_fixed.F obcs_set_connect.F'
0060 else
0061 if test "x$DEVEL" = x ; then #- no optimisation + IEEE :
0062 # "-fp-model [keyword]" is the recommended method of controlling precision
0063 FOPTIM='-O0 -noalign -march=core-avx2 -ip -fp-model consistent'
0064 # alternatives, see man pages for details
0065 # FOPTIM='-O0 -noalign -march=core-avx2 -ip -mp1'
0066 # FOPTIM='-O0 -noalign -march=core-avx2 -ip -fp-model precise'
0067 # FOPTIM='-O0 -noalign -march=core-avx2 -ip -mieee-fp'
0068 else #- development/check options:
0069 # FFLAGS="$FFLAGS -warn all -warn nounused"
0070 FFLAGS="$FFLAGS -warn unused"
0071 FOPTIM="-fpe0 -check all -ftrapuv -fp-model precise"
0072 FOPTIM="$FOPTIM -O0 -noalign -g -traceback"
0073 fi
0074 fi
0075
0076 F90FLAGS=$FFLAGS
0077 F90OPTIM=$FOPTIM
0078 CFLAGS='-O0 -fPIC -ip'
0079
0080 INCLUDEDIRS=''
0081 INCLUDES=''
0082 LIBS=''
0083
0084 if [[ -n $( nf-config --fflags ) && ($? == 0) ]]; then
0085 INCLUDES=$(nf-config --fflags)
0086 # LIBS=$(nf-config --flibs)
0087 LIBS="-L$(nf-config --prefix)/lib -lnetcdff"
0088 fi
0089
0090 if [ -n "$MPI_HOME" -a -z "$MPI_INC_DIR" ]; then
0091 MPI_INC_DIR="$MPI_HOME/include"
0092 fi
0093
0094 if [ "x$MPI" = xtrue ] ; then
0095 if [ -z "$MPI_INC_DIR" ] ; then
0096 # MPI env variables are not set, trying pkg-config insteal
0097 if [[ -n $( pkg-config --cflags-only-I impi ) && ($? == 0) ]] ; then
0098 MPI_INC_DIR=$(pkg-config --cflags-only-I impi | awk '{ print $1 }' | sed -e "s/-I//" )
0099 else
0100 echo MPI_HOME is not set and pkg-config not available, aborting
0101 exit 1
0102 fi
0103 fi
0104 if [ -n "$MPI_INC_DIR" ] ; then
0105 # only fill this if we can find MPI, otherwise triggers netcdf error
0106 INCLUDES+=" -I$MPI_INC_DIR"
0107 INCLUDEDIRS+=" $MPI_INC_DIR"
0108 #- used for parallel (MPI) DIVA
0109 MPIINCLUDEDIR="$MPI_INC_DIR"
0110 else
0111 echo could not set MPI_INC_DIR, aborting
0112 exit 1
0113 fi
0114 fi