Back to home page

MITgcm

 
 

    


Warning, /tools/build_options/linux_amd64_ifx+impi_avx2 is written in an unsupported language. File is not indexed.

view on githubraw file Latest commit ae4c03af on 2026-10-03 15:35:21 UTC
ae4c03af78 Oliv*0001 #!/bin/bash
                0002 #
                0003 #  Build options for Intel Compiler with impi on Linux AMD64 platform
                0004 #
                0005 #  Tested on engaging (Rocky 8) with ifx 2024.2.1 and impi 2021-13.
                0006 #  Executable will run on Sandybridge, Haswell, Broadwell, Skylake and above.
                0007 #
                0008 #  to compile and run with NetCdF:
                0009 #     > module use /home/jahn/software/modulefiles
                0010 #     > module load intel/2024.2.1
                0011 #     > module load jahn/netcdf-fortran/4.6.2_intel-2024.2.1
                0012 #-------
                0013 # run with OpenMP: needs to set environment var. OMP_NUM_THREADS
                0014 #    and generally, needs to increase the stack-size:
                0015 #   * sh,bash:
                0016 #     > export OMP_NUM_THREADS=2
                0017 #     > export KMP_STACKSIZE=400m
                0018 #   * csh,tcsh:
                0019 #     > setenv OMP_NUM_THREADS 2
                0020 #     > setenv KMP_STACKSIZE 400m
                0021 #-------
                0022 
                0023 if test "x$MPI" = xtrue ; then
                0024   CC=mpiicx
                0025   FC=mpiifx
                0026   F90C=mpiifx
                0027   LINK="mpiifx -shared-intel -no-ipo -Wl,--no-relax"
                0028 else
                0029   CC=icx
                0030   FC=ifx
                0031   F90C=ifx
                0032   LINK="$F90C -shared-intel"
                0033 fi
                0034 
                0035 DEFINES='-DWORDLENGTH=4'
                0036 F90FIXEDFORMAT='-fixed -Tf'
                0037 EXTENDED_SRC_FLAG='-132'
                0038 GET_FC_VERSION="--version"
                0039 OMPFLAG='-qopenmp'
                0040 #FC_CHECK=f
                0041 
                0042 NOOPTFLAGS='-O0 -g'
                0043 NOOPTFILES=''
                0044 
                0045 #- for setting specific options, check compiler version:
                0046 fcVers=`$FC $GET_FC_VERSION | head -n 1 | awk '{print $NF}'`
                0047 if ! [[ $fcVers =~ ^[0-9]+$ ]] ; then
                0048   echo "    un-recognized Compiler-release '$fcVers' ; ignored (-> set to 0)" ; fcVers=0 ;
                0049 else echo "    get Compiler-release: '$fcVers'" ; fi
                0050 
                0051 # This will run on Skylake or higher, but may give different results
                0052 PROCF="-mavx2 -mno-avx512f -fp-model=precise -fimf-arch-consistency=true -no-fma"
                0053 #PROCF="-fp-model consistent"
                0054 
                0055 CFLAGS="-O0 -m64 $PROCF"
                0056 FFLAGS="$FFLAGS -m64 -convert big_endian -assume byterecl"
                0057 #- for big setups, compile & link with memory-model set to "medium":
                0058  CFLAGS="$CFLAGS -mcmodel=medium"
                0059  FFLAGS="$FFLAGS -mcmodel=medium"
                0060 #- might want to use '-r8' for fizhi pkg:
                0061 #FFLAGS="$FFLAGS -r8"
                0062 
                0063 if test "x$IEEE" = x ; then     #- with optimisation:
                0064     FOPTIM="-O3 -align $PROCF"
                0065 else
                0066   if test "x$DEVEL" = x ; then  #- no optimisation + IEEE :
                0067     FOPTIM="-O0 -noalign $PROCF"
                0068   else                          #- development/check options:
                0069    #FFLAGS="$FFLAGS -debug all -debug-parameters all -fp-model strict"
                0070     FOPTIM="-O0 -noalign -g -traceback $PROCF"
                0071     NOOPTFLAGS=$FOPTIM
                0072     NOOPTFILES='adread_adwrite.F mdsio_rw_field.F mdsio_rw_slice.F'
                0073     FOPTIM="$FOPTIM -warn all,noexternal,nounused"
                0074     if test "x$MPI" = xtrue ; then
                0075       FOPTIM="$FOPTIM -fpe1 -ftz -fp-stack-check -check all,nouninit"
                0076     else
                0077       FOPTIM="$FOPTIM -fpe0 -ftz -fp-stack-check -check all,nouninit -ftrapuv"
                0078     fi
                0079   fi
                0080 fi
                0081 
                0082 F90FLAGS=$FFLAGS
                0083 F90OPTIM=$FOPTIM
                0084 
                0085 INCLUDEDIRS=''
                0086 INCLUDES=''
                0087 LIBS=''
                0088 
                0089 if [ "x$NETCDF_ROOT" != x ] ; then
                0090     INCLUDEDIRS="${NETCDF_ROOT}/include"
                0091     INCLUDES="-I${NETCDF_ROOT}/include"
                0092     LIBS="-L${NETCDF_ROOT}/lib64 -L${NETCDF_ROOT}/lib"
                0093 elif [ "x$NETCDF_HOME" != x ]; then
                0094     INCLUDEDIRS="${NETCDF_HOME}/include"
                0095     INCLUDES="-I${NETCDF_HOME}/include"
                0096     LIBS="-L${NETCDF_ROOT}/lib64 -L${NETCDF_HOME}/lib"
                0097 elif [ "x$NETCDF_INC" != x -a "x$NETCDF_LIB" != x ]; then
                0098     NETCDF_INC=`echo $NETCDF_INC | sed 's/-I//g'`
                0099     NETCDF_LIB=`echo $NETCDF_LIB | sed 's/-L//g'`
                0100     INCLUDEDIRS="${NETCDF_INC}"
                0101     INCLUDES="-I${NETCDF_INC}"
                0102     LIBS="-L${NETCDF_LIB}"
                0103 elif [ "x$NETCDF_INCDIR" != x -a "x$NETCDF_LIBDIR" != x ]; then
                0104     INCLUDEDIRS="${NETCDF_INCDIR}"
                0105     INCLUDES="-I${NETCDF_INCDIR}"
                0106     LIBS="-L${NETCDF_LIBDIR}"
                0107 elif test -d /usr/include/netcdf-3 ; then
                0108     INCLUDEDIRS='/usr/include/netcdf-3'
                0109     INCLUDES='-I/usr/include/netcdf-3'
                0110     LIBS='-L/usr/lib64/netcdf-3 -L/usr/lib/netcdf-3'
                0111 elif test -d /usr/local/pkg/netcdf ; then
                0112     INCLUDEDIRS='/usr/local/pkg/netcdf/include'
                0113     INCLUDES='-I/usr/local/pkg/netcdf/include'
                0114     LIBS='-L/usr/local/pkg-x86_64/netcdf/lib64 -L/usr/local/pkg-x86_64/netcdf/lib -L/usr/local/pkg/netcdf/lib64 -L/usr/local/pkg/netcdf/lib'
                0115 elif test -d /usr/include/netcdf ; then
                0116     INCLUDEDIRS='/usr/include/netcdf'
                0117     INCLUDES='-I/usr/include/netcdf'
                0118 elif test -d /usr/local/netcdf ; then
                0119     INCLUDEDIRS='/usr/include/netcdf/include'
                0120     INCLUDES='-I/usr/local/netcdf/include'
                0121     LIBS='-L/usr/local/netcdf/lib64 -L/usr/local/netcdf/lib'
                0122 elif test -f /usr/local/include/netcdf.inc ; then
                0123     INCLUDEDIRS='/usr/local/include'
                0124     INCLUDES='-I/usr/local/include'
                0125     LIBS='-L/usr/local/lib64 -L/usr/local/lib'
                0126 fi
                0127 
                0128 if [ -n "$I_MPI_ROOT" -a -z "$MPI_INC_DIR" ]; then
                0129     MPI_INC_DIR="$I_MPI_ROOT/include"
                0130 fi
                0131 
                0132 if [ -n "$MPI_INC_DIR" -a "x$MPI" = xtrue ] ; then
                0133     INCLUDES="$INCLUDES -I$MPI_INC_DIR"
                0134     INCLUDEDIRS="$INCLUDEDIRS $MPI_INC_DIR"
                0135     #- used for parallel (MPI) DIVA
                0136     MPIINCLUDEDIR="$MPI_INC_DIR"
                0137    #MPI_HEADER_FILES='mpif.h mpiof.h'
                0138 fi
                0139 
                0140 #LIBS="$LIBS -lshtns_omp -lfftw3_omp -lfftw3 -lm -lomp"
                0141 
                0142 if [ -n "$SPICELIBS" ]; then
                0143     LIBS="$LIBS $SPICELIBS"
                0144 fi