Skip to content

SMOKE Installation Instructions

Huy Tran edited this page Jan 13, 2025 · 10 revisions

DISCLAIMER: The below instructions aim at helping inexperienced users with compiling SMOKE (and its prerequisite libraries and software if not already available). These instructions were tested on a limited number of Linux operating systems and may not work on all systems. Configurations of C and Fortran compilers and the related software and libraries vary. These instructions were developed in to assist SMOKE users with navigating through various compilation options, but we note that these options vary across systems. These instructions are not the only way to compile the libraries/software described below. If issues arise with compilation and/or use of the resulting libraries and executables, users are encouraged to submit questions to the CMAS SMOKE forum.

Contents of instructions

NOTE

  1. The following instructions provide suggested configurations to compile related software using either dynamic linking which is the most suitable for various system. (Using static linking requires the other prerequisite libraries to be compiled also in static which may not available in all local machine)

  2. In high-performance cluster system, it is a common practice to have software compiled on one computer system (e.g., login node) and executed in another system (e.g., compute node). There is potential conflict in CPU instruction set if the software was compiled on system with newer CPU (e.g., with Intel CPU Xeon 6140) and then executed on system with older CPU (e.g., Intel Xeon E5-2463). It is recommended to have the software compiled on system with older CPU to maximize compatibility.

  3. The following instructions presumes all software will be installed under a parent directory with environmental name $MASTERDIR

Installations instructions for prerequisite packages (skipped if they are already available)

  • Create C-shell script $MASTERDIR/external_software/config_support_softwares.csh with the following content
#!/bin/csh -f

if ( ! $?MASTERDIR ) setenv MASTERDIR /proj/ie/proj/SMOKE/htran # Defined MASTERDIR if not already defined

switch ( $#argv )
   case 0:
      echo "SCRIPT ERROR: compiler argument and must be set: <intel/gcc> OR <intel/gcc> <shared/static>"
      exit( 1 )
breaksw
   case 1:
      setenv compiler    "$argv[1]"
      setenv lnktyp     "dynamic"      # Assume dynamic linking by default
breaksw
   case 2:
      setenv compiler    "$argv[1]"
      setenv lnktyp     "$argv[2]"
breaksw
   case 3:
      echo "SCRIPT ERROR: too many input arguments. Abort!"
      exit( 1 )
breaksw
endsw

## gcc/gfortran compiler
 if ($compiler == 'gcc') then
#    module load gcc/4.9.1
#    module load gcc/11.2.0
     setenv CC gcc
     setenv CXX g++
     setenv FC gfortran
     #setenv CFLAGS "-ffixed-line-length-132  -fno-backslash -fcheck=all -Wall -march=native -ffast-math -funroll-loops"

     # Get path to GCC libraries to pass on to C/Fortran compiler
     setenv COMPDIR  `which gcc | xargs dirname | xargs dirname`
     setenv COMPLIB  ${COMPDIR}/lib64

     set gcc_version=`gcc -dumpversion` # Get GCC version
     # Extract the major version
     set major_version=`echo "$gcc_version" | cut -d. -f1`
     if ( $major_version > 10 ) then
          setenv EXFFLAGS  '-fallow-argument-mismatch'# argument only valid in gcc version > 10
     else
          setenv EXFFLAGS  '-std=legacy'
     endif

## Intel classic compiler
 else if ($compiler == 'intel') then
#    module load intel/19.4
#    module load intel/20.2
     setenv CC icc
     setenv CXX icpc
     setenv FC ifort
     setenv COMPDIR `which ifort | xargs dirname | xargs dirname`
     setenv COMPLIB $COMPDIR/lib
     setenv EXFFLAGS  '-fallow-argument-mismatch'

## Intel OneAPI compiler
 else if ($compiler == 'ifx') then
#    module load intel/2024.1.0
     source $MASTERDIR/external_software/intel_oneapi/install/setvars.csh
     setenv CC icx
     setenv CXX icpx
     setenv FC ifx
     setenv COMPDIR `which ifx | xargs dirname | xargs dirname`
     setenv COMPLIB $COMPDIR/lib
     setenv EXFFLAGS  '-fallow-argument-mismatch'

 else
     echo "SCRIPT ERROR: compiler parameter is not recognized. Abort!"
     exit( 1 )
 endif

#> Critical Folder Locations for Installed Software; Modified if using pre-installed libraries
 if ( $lnktyp != "static" ) setenv lnktyp "dynamic"
 setenv AUXILIARY $MASTERDIR/external_software/dependent_libraries/${lnktyp}/${compiler}

 if ( ! $?HDF5ver )  setenv HDF5ver "hdf5-1.14.3" # Update version number as needed
 setenv HDF5 $AUXILIARY/${HDF5ver}

 if ( ! $?NCFFver ) setenv NCFFver "netcdf-fortran-4.6.1" # Update version number as needed
 setenv NETCDFF   $AUXILIARY/${NCFFver}

 if ( ! $?NCFCver ) setenv NCFCver "netcdf-c-4.9.2" # Update version number as needed
 setenv NETCDFC   $AUXILIARY/${NCFCver}

 if ( ! $?ZLIBver )  setenv ZLIBver "zlib-1.3" # Update version number as needed
 setenv ZLIB      $AUXILIARY/${ZLIBver}

 if ( ! $?SZLIBver ) setenv SZLIBver "szip-2.1.1" # Update version number as needed
 setenv SZIP      $AUXILIARY/${SZLIBver}

ZLIB

  • Download zlib (Update to newer version if needed):
    wget -P $MASTERDIR/external_software https://www.zlib.net/zlib-1.3.1.tar.gz
  • Decompress the downloaded package
    cd $MASTERDIR/external_software
    tar -xvzf zlib-1.3.1.tar.gz
    cd zlib-1.3.1
  • Create compile.csh with the following content
#!/bin/tcsh

setenv ZLIBver "zlib-1.3"

if ( ! $?MASTERDIR ) setenv MASTERDIR /proj/ie/proj/SMOKE/htran # Defined MASTERDIR if not already defined

#Load necessary modules
#setenv compiler intel
setenv compiler gcc

source ${MASTERDIR}/external_software/config_support_softwares.csh $compiler "dynamic"

mkdir -p $ZLIB

switch ( $#argv )
   case 0:
      echo "SCRIPT ERROR: compile script must have a valid option from the following:"
      echo "     <configure>        : generate configuration for compilation"
      echo "     <make_clean>       : uninstall previous build"
      echo "     <make_check>       : build and run check, not install yet"
      echo "     <make_install>     : finall installation; must be run after make_check"
      exit( 1 )
endsw

setenv RUN_TYPE    "$argv[1]"

if ( $RUN_TYPE == "configure" ) then
   if ( $lnktyp == "dynamic" ) then
      setenv CFLAGS "-O3 -fPIC -DPIC"
      ./configure  --prefix=$ZLIB --64
   endif
   if ( $lnktyp == "static" ) ./configure  --prefix=$ZLIB --64 --static
 endif
endif

if ( $RUN_TYPE == "make_clean" ) then
make clean
make uninstall
endif

if ( $RUN_TYPE == "make" ) then
make >& log.$RUN_TYPE
endif

if ( $RUN_TYPE == "make_check" ) then
make test >& log.$RUN_TYPE
endif

if ( $RUN_TYPE == "make_install" ) then
make install >& log.$RUN_TYPE
endif
  • chmod u+x $MASTERDIR/external_software/zlib-1.3.1/compile.csh

  • Run $MASTERDIR/external_software/zlib-1.3.1/compile.csh <option> with <option> to be configure, make and make_install to compile zlib
    $MASTERDIR/external_software/zlib-1.3.1/compile.csh configure
    $MASTERDIR/external_software/zlib-1.3.1/compile.csh make_clean (Optional; recommended when recompiling)
    $MASTERDIR/external_software/zlib-1.3.1/compile.csh make
    $MASTERDIR/external_software/zlib-1.3.1/compile.csh make_check (Optional; recommended when recompiling)
    $MASTERDIR/external_software/zlib-1.3.1/compile.csh make_install

  • If compiled successfully, zlib should be installed under $MASTERDIR/dependent_libraries/dynamic/$compiler/zlib-1.3

SZIP

  • Download szip (Update to newer version if needed)
    wget -P $MASTERDIR/external_software https://support.hdfgroup.org/ftp/lib-external/szip/2.1.1/src/szip-2.1.1.tar.gz
    cd $MASTERDIR/external_software
    tar -xvzf szip-2.1.1.tar.gz
    cd szip-2.1.1
  • Create compile.csh with the following content
#!/bin/tcsh

setenv SZLIBver szip-2.1.1 # Update version number as needed

if ( ! $?MASTERDIR ) setenv MASTERDIR /proj/ie/proj/SMOKE/htran # Defined MASTERDIR if not already defined

#Load necessary modules
setenv compiler gcc
#setenv compiler intel

source ${MASTERDIR}/external_software/config_support_softwares.csh $compiler "dynamic"

mkdir -p $SZIP

switch ( $#argv )
   case 0:
      echo "SCRIPT ERROR: compile script must have a valid option from the following:"
      echo "     <configure>        : generate configuration for compilation"
      echo "     <make_clean>       : uninstall previous build"
      echo "     <make_check>       : build and run check, not install yet"
      echo "     <make_install>     : finall installation; must be run after make_check"
      exit( 1 )
endsw

setenv RUN_TYPE    "$argv[1]"

if ( $RUN_TYPE == "configure" ) then
   if ( $lnktyp == "dynamic" ) ./configure --prefix=$SZIP CFLAGS="-O3 -fPIC -DPIC"
   if ( $lnktyp == "static" ) ./configure --prefix=$SZIP --disable-shared --enable-static
endif

if ( $RUN_TYPE == "make_clean" ) then
make clean
make uninstall
endif

if ( $RUN_TYPE == "make" ) then
make >& log.$RUN_TYPE
endif

if ( $RUN_TYPE == "make_check" ) then
make check >& log.$RUN_TYPE
endif

if ( $RUN_TYPE == "make_install" ) then
make install >& log.$RUN_TYPE
endif

  • chmod u+x $MASTERDIR/external_software/szip-2.1.1/compile.csh
  • Run $MASTERDIR/szip-2.1.1/compile.csh <option> with <option> to be configure, make and make_install to compile zlib
  • If compiled successfully, szip should be installed under $MASTERDIR/external_software/dependent_libraries/dynamic/$compiler/szip-2.1.1

HDF5

  • Download hdf5 (Update to newer version as needed) wget -P $MASTERDIR/external_software https://hdf-wordpress-1.s3.amazonaws.com/wp-content/uploads/manual/HDF5/HDF5_1_14_3/src/hdf5-1.14.3.tar.gz
    cd $MASTERDIR/external_software
    tar -xvzf hdf5-1.14.3.tar.gz
    cd hdf5-1.14.3
  • Create compile.csh with the following content
#!/bin/tcsh

setenv HDF5ver "hdf5-1.14.3"

if ( ! $?MASTERDIR ) setenv MASTERDIR /proj/ie/proj/SMOKE/htran # Defined MASTERDIR if not already defined

#Load necessary modules
 setenv compiler gcc
#setenv compiler intel

source ${MASTERDIR}/external_software/config_support_softwares.csh $compiler "dynamic"

mkdir -p $HDF5

switch ( $#argv )
   case 0:
      echo "SCRIPT ERROR: compile script must have a valid option from the following:"
      echo "     <configure>        : generate configuration for compilation"
      echo "     <make_clean>       : uninstall previous build"
      echo "     <make_check>       : build and run check, not install yet"
      echo "     <make_install>     : finall installation; must be run after make_check"
      exit( 1 )
endsw

setenv RUN_TYPE    "$argv[1]"

if ( $RUN_TYPE == "configure" ) then
 if ( $compiler == 'gcc' ) then
   setenv FFLAGS $EXFFLAGS
    if ( $lnktyp == "dynamic" ) then
            setenv LDFLAGS  "-Wl,-rpath,${COMPLIB}:${SZIP}/lib:${ZLIB}/lib"
            ./configure --prefix=$HDF5 --with-zlib=$ZLIB --with-szlib=$SZIP \
             CFLAGS="-fPIC -DPIC" \
             --enable-static-exec --enable-fortran --enable-cxx --enable-hl \
             --enable-fast-install --enable-tests=no
    endif
    if ( $lnktyp == "static" ) then
            setenv LDFLAGS  "-L${COMPLIB} -L${SZIP}/lib -L${ZLIB}/lib"
            ./configure --prefix=$HDF5 --with-zlib=$ZLIB --with-szlib=$SZIP \
             --enable-static-exec --enable-static --disable-shared --disable-sharedlib-rpath \
             --enable-fortran --enable-cxx --enable-hl \
             --enable-fast-install --enable-tests=no
    endif
 endif

 if ( $compiler == 'intel' || $compiler == 'ifx' ) then
    if ( $lnktyp == "dynamic" ) then
            ./configure --prefix=$HDF5 --with-zlib=$ZLIB --with-szlib=$SZIP \
             CFLAGS="-fPIC -DPIC" \
             --enable-static-exec --enable-fortran --enable-cxx --enable-hl \
             --enable-fast-install --enable-tests=no
    endif
    if ( $lnktyp == "static" ) then
            ./configure --prefix=$HDF5 --with-zlib=$ZLIB --with-szlib=$SZIP \
             CFLAGS="-diag-disable=10441 -fPIC -O3 -traceback -axAVX2,SSE4.2 -ip -align -static" \
             FFLAGS="-fPIC -O3 -traceback -axAVX2,SSE4.2 -ip -align -static" \
             CXXFLAGS="-fPIC -O3 -traceback -ip -align -static" \
             --disable-shared \
             --enable-static --enable-static-exec \
             --enable-fortran --enable-cxx --enable-hl \
             --enable-tests=no --disable-sharedlib-rpath
             #--enable-fast-install \
    endif
 endif

endif

if ( $RUN_TYPE == "make_clean" ) then
make clean
make uninstall
endif

if ( $RUN_TYPE == "make" ) then
make  >& log.$RUN_TYPE
endif

if ( $RUN_TYPE == "make_check" ) then
make test >& log.$RUN_TYPE
endif

if ( $RUN_TYPE == "make_install" ) then
make install >& log.$RUN_TYPE
endif
  • chmod u+x $MASTERDIR/external_software/hdf5-1.14.3/compile.csh
  • Run $MASTERDIR/hdf5-1.14.3/compile.csh <option> with <option> to be configure, make and make_install to compile hdf5
  • If compiled successfully, hdf5 should be installed under $MASTERDIR/external_software/dependent_libraries/dynamic/$compiler/hdf5-1.14.3

NETCDF

  • Two NETCDF packages are required: netcdf-c and netcdf-fortran

netcdf-c

  • Download netcdf-c (Update to newer version if needed) wget -P $MASTERDIR/external_software https://downloads.unidata.ucar.edu/netcdf-c/4.9.2/netcdf-c-4.9.2.tar.gz
    cd $MASTERDIR/external_software
    tar -xvzf netcdf-c-4.9.2.tar.gz
    cd netcdf-c-4.9.2
  • Create compile.csh with the following content
#!/bin/tcsh

setenv NCFCver "netcdf-c-4.9.2"

if ( ! $?MASTERDIR ) setenv MASTERDIR /proj/ie/proj/SMOKE/htran # Defined MASTERDIR if not already defined

#Load necessary modules
setenv compiler gcc
#setenv compiler intel

source $MASTERDIR/external_software/config_support_softwares.csh $compiler "dynamic"

mkdir -p $NETCDFC

setenv CPPFLAGS "-I${HDF5}/include -I${SZIP}/include -I${ZLIB}/include"

switch ( $#argv )
   case 0:
      echo "SCRIPT ERROR: compile script must have a valid option from the following:"
      echo "     <configure>        : generate configuration for compilation"
      echo "     <make_clean>       : uninstall previous build"
      echo "     <make_check>       : build and run check, not install yet"
      echo "     <make_install>     : finall installation; must be run after make_check"
      exit( 1 )
endsw

setenv RUN_TYPE    "$argv[1]"

if ( $RUN_TYPE == "configure" ) then
 if ( $compiler == 'gcc' ) then

    if ( $lnktyp == "dynamic" ) then
        setenv LDFLAGS  "-L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib -Wl,-rpath,${COMPLIB}:${HDF5}/lib:${SZIP}/lib:${ZLIB}/lib -lhdf5_hl -lhdf5 -lz -lsz"
        ./configure --prefix=$NETCDFC CFLAGS='-fPIC -DPIC' \
             --disable-examples  \
             --enable-netcdf-4
    endif

    if ( $lnktyp == 'static' ) then
        setenv LDFLAGS  "-L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib"
        ./configure --prefix=$NETCDFC CFLAGS='-static' \
             --disable-examples \
             --disable-shared --enable-static \
             --disable-byterange \
             --enable-netcdf-4 \
             --disable-dap \
             --disable-plugins \
             --disable-libxml2
    endif
 endif
 if ( $compiler == 'intel' || $compiler == 'ifx' ) then
    if ( $lnktyp == "dynamic" ) then
        setenv LDFLAGS  "-L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib -Wl,-rpath,${COMPLIB}:${HDF5}/lib:${SZIP}/lib:${ZLIB}/lib -lhdf5_hl -lhdf5 -lz -lsz"
        ./configure --prefix=$NETCDFC --disable-examples \
             CFLAGS='-fPIC -DPIC' \
             --enable-netcdf-4
    endif

    if ( $lnktyp == "static" ) then
        setenv LDFLAGS  "-L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib"
        ./configure --prefix=$NETCDFC \
             CFLAGS='-static' \
             --disable-dap \
             --disable-examples \
             --disable-shared \
             --disable-byterange \
             --disable-libxml2 \
             --disable-plugins \
             --enable-static
     endif
 endif
endif

if ( $RUN_TYPE == "make_clean" ) then
make clean
make uninstall
endif

if ( $RUN_TYPE == "make" ) then
make >& log.$RUN_TYPE
endif

if ( $RUN_TYPE == "make_check" ) then
make check >& log.$RUN_TYPE
endif

if ( $RUN_TYPE == "make_install" ) then
make install >& log.$RUN_TYPE
endif
  • chmod u+x $MASTERDIR/external_software/netcdf-c-4.9.2/compile.csh
  • Run $MASTERDIR/external_software/netcdf-c-4.9.2/compile.csh <option> with <option> to be configure, make and make_install to compile netcdf-c
  • If compiled successfully, netcdf-c should be installed under $MASTERDIR/external_software/dependent_libraries/dynamic/$compiler/netcdf-c-4.9.2

netcdf-fortran

  • Download netcdf-fortran (Update to newer version if needed)
    wget -P $MASTERDIR/external_software https://downloads.unidata.ucar.edu/netcdf-fortran/4.6.1/netcdf-fortran-4.6.1.tar.gz
    cd $MASTERDIR/external_software
    tar -xvzf netcdf-fortran-4.6.1.tar.gz
    cd netcdf-fortran-4.6.1
  • Create compile.csh with the following content
setenv NCFFver "netcdf-fortran-4.6.1"

if ( ! $?MASTERDIR ) setenv MASTERDIR /proj/ie/proj/SMOKE/htran # Define MASTERDIR if not already defined

#Load necessary modules
setenv compiler gcc
#setenv compiler intel

source $MASTERDIR/external_software/config_support_softwares.csh $compiler "dynamic"

mkdir -p $NETCDFF

switch ( $#argv )
   case 0:
      echo "SCRIPT ERROR: compile script must have a valid option from the following:"
      echo "     <configure>        : generate configuration for compilation"
      echo "     <make_clean>       : uninstall previous build"
      echo "     <make_check>       : build and run check, not install yet"
      echo "     <make_install>     : finall installation; must be run after make_check"
      exit( 1 )
endsw

setenv RUN_TYPE    "$argv[1]"

if ( $RUN_TYPE == "configure" ) then
     setenv LIBS     `${NETCDFC}/bin/nc-config --libs`
     setenv CPPFLAGS '-I${HDF5}/include -I${NETCDFC}/include'

     if ( $lnktyp == 'dynamic' ) then
         setenv LDFLAGS "-L$HDF5/lib -L$NETCDFC/lib -Wl,-rpath,${COMPLIB}:$HDF5/lib:$NETCDFC/lib -lhdf5_hl -lhdf5 -lnetcdf"
        ./configure --prefix=$NETCDFF  FFLAGS=$EXFFLAGS
     endif

     if ( $lnktyp == 'static' ) then
         setenv LDFLAGS "-L${COMPLIB} -L$HDF5/lib -L$NETCDFC/lib -lhdf5_hl -lhdf5 -lnetcdf"
        ./configure --prefix=$NETCDFF \
             CFLAGS='-static' FFLAGS=$EXFFLAGS \
             --disable-shared \
             --enable-static \
             --disable-zstandard-plugin \
             --enable-fast-install
     endif
endif

if ( $RUN_TYPE == "make_clean" ) then
make clean
make uninstall
endif

if ( $RUN_TYPE == "make" ) then
make >& log.$RUN_TYPE
endif

if ( $RUN_TYPE == "make_check" ) then
make check >& log.$RUN_TYPE
endif

if ( $RUN_TYPE == "make_install" ) then
make install >& log.$RUN_TYPE
endif
  • chmod u+x $MASTERDIR/external_software/netcdf-fortran-4.6.1/compile.csh
  • Run $MASTERDIR/external_software/netcdf-fortran-4.6.1/compile.csh <option> with <option> to be configure, make and make_install to compile netcdf-c
  • If compiled successfully, netcdf-fortran should be installed under $MASTERDIR/external_software/dependent_libraries/dynamic/$compiler/netcdf-fortran-4.6.1

I/O API

NOTE: The following instructions are just an example of compiling I/O API and use the configurations that are in consistent with configurations used in compilation of other packages in the entire instruction. The users are strongly recommended to consult I/O API User Manual and its Tutorial for more comprehensive information on compilation options.Common issues with compiling I/O API are also discussed in I/O API Troubleshooting

cd $MASTERDIR
git clone https://github.com/cjcoats/ioapi-3.2.git ioapi-3.2

  • Change into $MASTERDIR/ioapi-3.2
    cd $MASTERDIR/ioapi-3.2

NOTE This instruction assumes all required software packages are precompiled under $MASTERDIR/external_software/dependent_libraries. If this not the case, follow Installations instructions for required packages in the subsequent sections.

  • Create $MASTERDIR/ioapi-3.2/IOAPI.config.csh with the following content
#!/bin/csh

if ( ! $?MASTERDIR ) setenv MASTERDIR /proj/ie/proj/SMOKE/htran # Defined MASTERDIR if not already defined

unsetenv BIN

switch ( $#argv )
  case 0:
     echo "SCRIPT ERROR: BIN parameter <Linux2_x86_64ifort|Linux2_x86_64> must be set"
     exit(1)
  breaksw
  case 1:
     setenv BIN $argv[1]
     setenv typlnk "dynamic"
  breaksw
  case 2:
     setenv BIN $argv[1]
     setenv typlnk $argv[2]
  breaksw
  case 3:
endsw

 setenv IOAPI_HOME $MASTERDIR/ioapi-3.2.github
 setenv IOAPI_BASE $IOAPI_HOME
 setenv IOAPILIBS  ${IOAPI_HOME}/${BIN}
 setenv IOAPIINCD  ${IOAPI_HOME}/${BIN}
 setenv IOBIN      ${IOAPI_HOME}/${BIN}

 setenv BASEDIR    ${IOAPI_HOME}
 setenv INSTALL    ${IOAPI_HOME}
 setenv LIBINST    ${INSTALL}/${BIN}
 setenv BININST    ${INSTALL}/${BIN}
 setenv CPLMODE    nocpl
 setenv IOAPIDEFS  "-DIOAPI_NCF4"
 setenv PVMINCL
 setenv VERSION    '3.2-${CPLMODE}'

## gcc/gfortran compiler
if ( ${BIN} == 'Linux2_x86_64' || ${BIN} == 'Linux2_x86_64gfortran' ) then
     setenv compiler gcc
     source $MASTERDIR/external_software/config_support_softwares.csh $compiler $typlnk
#    source $MASTERDIR/external_software/config_support_softwares.csh $compiler "dynamic"
#    setenv dbgflag '-g -fcheck-bounds -fbacktrace -Wsurprising -finit-real=snan -m64'
     if ( $typlnk == "dynamic" ) then
        setenv NCFLIBS  "-L${NETCDFF}/lib -L${NETCDFC}/lib -L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib -Wl,-rpath,${COMPLIB}:${NETCDFF}/lib:${NETCDFC}/lib:${HDF5}/lib:${SZIP}/lib:${ZLIB}/lib -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz -lsz"
        setenv foptflg  $EXFFLAGS
        setenv coptflg  ""
        setenv ompflg   ""
        setenv archflg  "-dynamic"
     endif

     if ( $typlnk == "static" ) then
        setenv NCFLIBS "-L${COMPLIB} -L${NETCDFF}/lib -L${NETCDFC}/lib -L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz -lsz -ldl -lm"
        setenv lnkext   "_static"
        setenv foptflg  "-static $EXFFLAGS"
        setenv coptflg  "-static"
        setenv ompflg   "-static"
        setenv archflg  "-static"
     endif
endif

## Intel classic compiler
if ( ${BIN} == 'Linux2_x86_64ifort' || ${BIN} == 'Linux2_x86_64ifort_mediumdbg' ) then
     setenv compiler intel
     source $MASTERDIR/external_software/config_support_softwares.csh $compiler $typlnk
     if ( $typlnk == "dynamic" ) then
        setenv NCFLIBS  "-L${NETCDFF}/lib -L${NETCDFC}/lib -L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib -Wl,-rpath,${COMPLIB}:${NETCDFF}/lib:${NETCDFC}/lib:${HDF5}/lib:${SZIP}/lib:${ZLIB}/lib -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz -lsz"
        setenv foptflg  ""
        setenv coptflg  ""
        setenv ompflg   "-qopenmp-link=static -shared_intel"
        setenv archflg  "-Bstatic"
     endif

     if ( $typlnk == "static" ) then
        setenv NCFLIBS "-L${NETCDFF}/lib -L${NETCDFC}/lib -L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lz -lsz"
        setenv foptflg  "-static"
        setenv coptflg  "-static"
        setenv ompflg   "-static"
        setenv archflg  "-static"
     endif
endif

  • Create $MASTERDIR/ioapi-3.2/compile.ioapi.csh with the following content
#!/bin/csh

## Define version of dependent libraries; Update version number as needed
setenv HDF5ver "hdf5-1.14.3"
setenv NCFFver "netcdf-fortran-4.6.1"
setenv NCFCver "netcdf-c-4.9.2"

if ( ! $?MASTERDIR ) setenv MASTERDIR /proj/ie/proj/SMOKE/htran # Defined MASTERDIR if not already defined

# Select either gfortran or intel fortran compiler
 setenv compiler gcc
#setenv compiler intel

if ( $compiler == "gcc" )   setenv BIN Linux2_x86_64       # Using gfortran compiler
if ( $compiler == "intel" ) setenv BIN Linux2_x86_64ifort  # Using intel fortran compiler (ifort)

source ./IOAPI.config.csh $BIN  "dynamic"

cd $IOAPI_HOME

#if (-d ${IOAPI_HOME}/${BIN} ) make clean

make all >& compile.$BIN.log
if ($status == 0) then
    echo "Compilation succeeded."
else
    echo "Compilation failed. Make corrections and try again"
endif
  • Create Makefile from provide Makefile.template
    cp $MASTERDIR/ioapi-3.2/Makefile.template $MASTERDIR/ioapi-3.2/Makefile
  • Modify $MASTERDIR/ioapi-3.2/Makefile as follow
#      ----------  Edit-command used by "make configure"  to customize the "*/Makefile*"

SEDCMD = \
-e 's|IOAPI_BASE|$(BASEDIR)|' \
-e 's|LIBINSTALL|$(LIBINST)|' \
-e 's|BININSTALL|$(BININST)|' \
-e 's|IOAPI_DEFS|$(IOAPIDEFS)|' \
-e 's|NCFLIBS|$(NCFLIBS)|' \
-e 's|MAKEINCLUDE|include $(IODIR)/Makeinclude|' \
-e 's|PVMINCLUDE|include  $(PVMINCL)|'

#      ----------   I/O API Build System directory definitions  --------

VERSION    = 3.2-${CPLMODE}
#BASEDIR    = ${PWD}              # No longer need cause it is defined in $MASTERDIR/ioapi-3.2/IOAPI.config.csh
#NCFLIBS    = -lnetcdff -lnetcdf  # No longer need cause it is defined in $MASTERDIR/ioapi-3.2/IOAPI.config.csh
IODIR      = $(BASEDIR)/ioapi
FIXDIR     = $(IODIR)/fixed_src
HTMLDIR    = $(BASEDIR)/HTML
TOOLDIR    = $(BASEDIR)/m3tools
OBJDIR     = $(BASEDIR)/$(BIN)
  • Also comment out the ${IODIR}/Makefile ${TOOLDIR}/Makefile in configure section in the in the $MASTERDIR/ioapi-3.2/Makefile
configure: #${IODIR}/Makefile ${TOOLDIR}/Makefile
	(cd $(IODIR)   ;  sed $(SEDCMD) < Makefile.$(CPLMODE).sed > Makefile )
	(cd $(TOOLDIR) ;  sed $(SEDCMD) < Makefile.$(CPLMODE).sed > Makefile )
  • Modify $MASTERDIR/ioapi-3.2/ioapi/Makefile.nocpl.sed as follow
BASEDIR = IOAPI_BASE
INSTDIR = LIBINSTALL

IODIR  = ${BASEDIR}/ioapi

OBJDIR  = ${BASEDIR}/${BIN}

FIXDIR  = ${IODIR}/fixed_src

# Architecture dependent stuff

MAKEINCLUDE.$(BIN)

#DEFINEFLAGS  =                $(ARCHFLAGS) $(PARFLAGS)
#DEFINEFLAGS = -DIOAPICPL=1   $(ARCHFLAGS) $(PARFLAGS)
#DEFINEFLAGS = -DIOAPI_PNCF=1 $(ARCHFLAGS) $(PARFLAGS)
DEFINEFLAGS = -DIOAPI_NCF4=1 $(ARCHFLAGS) $(PARFLAGS)
#DEFINEFLAGS = -DIOAPI_PNCF=1 -DIOAPI_NCF4=1 $(ARCHFLAGS) $(PARFLAGS)

#VFLAG  = -DVERSION='3.2-cpl'
#VFLAG  = -DVERSION='3.2-cpl-mpi'
#VFLAG  = -DVERSION='3.2-cpl-ncf4'
#VFLAG  = -DVERSION='3.2-cpl-ncf4-mpi'
#VFLAG  = -DVERSION='3.2-nocpl-mpi'
VFLAG  = -DVERSION='3.2-nocpl-ncf4'
#VFLAG  = -DVERSION='3.2-nocpl-ncf4-mpi'
#VFLAG   = -DVERSION='3.2-nocpl'

CFLAGS = $(DEFINEFLAGS) $(COPTFLAGS) $(VFLAG)
FFLAGS = $(DEFINEFLAGS) $(FOPTFLAGS) $(OMPFLAGS) $(ARCHFLAGS) -I${IODIR}
ARFLAGS = rsv

NOTE for using Intel Fortran Compiler

  • Intel® C++ Compiler Classic (icc) is removed in the oneAPI 2024.0 release (see this link). See instructions for using intel oneAPI in the bellow optional sections.
  • Modify the $MASTERDIR/ioapi-3.2/ioapi/Makeinclude.Linux2_x86_64ifort as follow:
AR   = ar
CC   = icc
CXX  = icpc
FC   = ifort -auto -warn notruncated_source
M4   = m4
LINK = $(CC)

## Module-include-directory command
MODI = -I
E132 = -extend-source 132

  MFLAGS  = -traceback                                          # generic
# MFLAGS  = -traceback -msse4.1 -xSSE4.1                        # penryn
# MFLAGS  = -traceback -mavx2   -xAVX    -march=corei7-avx      # SandyBridge
# MFLAGS  = -traceback -mavx    -xAVX2   -march=corei7-avx2     # Haswell
# MFLAGS    = -traceback -xHost                                 # this-machine

#OMPFLAGS  = -openmp      # for Intel compilers, version 15 or earlier
#OMPLIBS   = -openmp
 OMPFLAGS  = -qopenmp
 OMPLIBS   = -qopenmp ${ompflg}

COPTFLAGS = -O3 ${MFLAGS} ${coptflg} ${dbgflg}
FOPTFLAGS = -O3 -unroll -stack_temps -safe_cray_ptr \
  -convert big_endian -assume byterecl  ${MFLAGS} ${foptflg}
FPPFLAGS  = -DF90=1
FSFLAGS   = -save
ARCHFLAGS = \
 -DAUTO_ARRAYS=1 \
 -DF90=1 -DFLDMN=1 \
 -DFSTR_L=int \
 -DIOAPI_NO_STDOUT=1 \
 -DAVOID_FLUSH=1 -DBIT32=1
PARFLAGS  =
ARCHLIB   = ${archflg} # -Bstatic

##No change to the remaining lines

NOTE for using gfortran compiler

  • Executable files compiled with gfortran always check for version of glibc on the OS system upon execution, and will crash if there is discrepancy in glibc version the files were compiled with and the one the OS system that they are executed on. This practice makes gfortran-compiled executable files not portable (i.e., files compiled on one system can not be executed on another system). For portability, intel fortran compiler is recommended.
  • Modify the $MASTERDIR/ioapi-3.2/ioapi/Makeinclude.Linux2_x86_64 as follow:
AR   = ar
CC   = gcc
CXX  = g++
FC   = gfortran
M4   = m4
LINK = $(CC)

## Module-include-directory command
MODI = -I
E132 = -ffixed-line-length-132

MFLAGS    = -ffast-math -funroll-loops -m64 #  -Wall -Wsurprising -march=native -mtune=native

OMPFLAGS  = -fopenmp
OMPLIBS   = -fopenmp ${ompflg}
COPTFLAGS = -O3 ${coptflg} ${MFLAGS}
FOPTFLAGS = -O3 $(foptflg) ${MFLAGS}
FPPFLAGS  = -DF90=1
FSFLAGS   = -fno-automatic
ARCHFLAGS = \
 -DAUTO_ARRAYS=1 \
 -DF90=1 -DFLDMN=1 \
 -DFSTR_L=int \
 -DIOAPI_NO_STDOUT=1 \
 -DNEED_ARGS=1
PARFLAGS  =
ARCHLIB   = ${archflg} -L/usr/lib64 -lm -lpthread -lc

M4DEFFILE = $(PVM_ROOT)/conf/$(PVM_ARCH).m4
PVMLIBS   = # -lpvm3

Now compile IOAPI
chmod 755 $MASTERDIR/ioapi-3.2/compile.ioapi.csh
$MASTERDIR/ioapi-3.2/compile.ioapi.csh

SMOKE

  • Clone latest release version of SMOKE (version 5.0 at the time of this instruction) from CMAS center
    cd $MASTERDIR
    git clone https://github.com/CEMPD/SMOKE.git SMOKE_v5.0
  • Create $MASTERDIR/SMOKE_v5.0/SMOKE_INSTALL.config.csh with content
#!/bin/tcsh

 setenv SMK_HOME $MASTERDIR/SMOKE_v5.0 
#setenv BIN Linux2_x86_64       # if using gfotran
 setenv BIN Linux2_x86_64ifort  # if using intel fortran
 #> source IOAPI config to get same variable $BIN and libraries that were used to compile IOAPI
source $MASTERDIR/ioapi-3.2/IOAPI.config.csh $BIN "dynamic" # source IOAPI config to get same variable $BIN and libraries 

setenv dbgflg "-debug -check bounds" # use debug flags if needed
if ( $lnktyp == "dynamic" ) then
   setenv extralnk '-Bdynamic'
   setenv extraflg ''
endif
if ( $lnktyp == "static" ) then
   setenv extralnk '-Bstatic -static-intel'
   setenv extraflg '-qopenmp-link=static -static-intel'
endif

  • cd $MASTERDIR/SMOKE_v5.0
  • Create $MASTERDIR/SMOKE_v5.0/compile.SMOKE.csh with content
#!/bin/tcsh

 source ./SMOKE_INSTALL.config.csh

 mkdir -p $SMK_HOME/$BIN

#> Before compiling, update Makeinclude with the following:
#          point INSTDIR to correct path
#          point BASEDIR to correct path
#          point IOBASE to correct path
#          OBJDIR to correct path
#          EFLAG to correct compiler. eg., INtel, GNU, PGI

cd $SMK_HOME/src
make clean # Optional, only needed if changes were made to SMOKE program and need a clean re-compile 
make all # >& $SMK_HOME/LOG.compile.$BIN
  • If using intel compiler, modify $MASTERDIR/SMOKE_v5.0/src/Makeinclude as follow
BASEDIR = ${SMK_HOME}/src
INCDIR  = ${BASEDIR}/inc
OBJDIR  = ${SMK_HOME}/${BIN}

IOBASE  = ${IOAPI_HOME}
IODIR   = ${IOBASE}/ioapi
IOBIN   = ${IOBASE}/${BIN}
IOINC   = ${IODIR}/fixed_src

INSTDIR = ${SMK_HOME}/${BIN}

##  Architecture dependent stuff

include ${IODIR}/Makeinclude.${BIN}

F90 = $(FC)

 IFLAGS = -I${IOINC} -I${INCDIR} -I${IOBIN} -traceback      #  Intel, Absoft, Pathscale, UNIX Fortran
# IFLAGS = -I${IOINC} -I${INCDIR} -I${IOBIN}                #  GNU   Fortran
# IFLAGS = -I${IOINC} -I${INCDIR} -M${IOBIN}                #  Sun   Fortran
# IFLAGS = -I${IOINC} -I${INCDIR} -module ${OBJDIR} -module ${IOBIN}    #  PGI Fortran:  order *important*

 EFLAG = -extend-source 132 -zero ${extralnk} ${dbgflg} #  Intel Fortran
# EFLAG = -ffixed-line-length-132  -fno-backslash       #  GNU   Fortran
# EFLAG = -Mextend -Mbackslash                          #  PGI Fortran
# EFLAG = -e                                            #  Sun   Fortran
# EFLAG = -W132                                         #  Absoft   Fortran

FFLAGS  = ${IFLAGS} ${EFLAG} ${DEFINEFLAGS} ${PARFLAGS} ${FOPTFLAGS} ${ARCHFLAGS}

LDFLAGS = ${IFLAGS} ${DEFINEFLAGS} ${ARCHFLAGS}

ARFLAGS = rv

SMKLIB = -L${OBJDIR} -lsmoke

########  netCDF-4 needs "-lnetcdff -lnetcdf":

# IOLIB = -L$(IOBIN) -lioapi -lnetcdff -lnetcdf ${PVMLIBS}
# IOLIB = -L$(IOBIN) -lioapi -lnetcdff -lnetcdf  
  IOLIB = -L$(IOBIN) -lioapi ${NCFLIBS} 
  • If using gfortran compiler, modify $MASTERDIR/SMOKE_v5.0/src/Makeinclude as follow
BASEDIR = ${SMK_HOME}/src
INCDIR  = ${BASEDIR}/inc
OBJDIR  = ${SMK_HOME}/${BIN}

IOBASE  = ${IOAPI_HOME}
IODIR   = ${IOBASE}/ioapi
IOBIN   = ${IOBASE}/${BIN}
IOINC   = ${IODIR}/fixed_src

INSTDIR = ${SMK_HOME}/${BIN}

##  Architecture dependent stuff

include ${IODIR}/Makeinclude.${BIN}

F90 = $(FC)

# IFLAGS = -I${IOINC} -I${INCDIR} -I${IOBIN}                #  Intel, Absoft, Pathscale, UNIX Fortran
 IFLAGS = -I${IOINC} -I${INCDIR} -I${IOBIN}                #  GNU   Fortran
# IFLAGS = -I${IOINC} -I${INCDIR} -M${IOBIN}                #  Sun   Fortran
# IFLAGS = -I${IOINC} -I${INCDIR} -module ${OBJDIR} -module ${IOBIN}    #  PGI Fortran:  order *important*

# EFLAG = -extend-source 132 -zero                      #  Intel Fortran
 EFLAG = -ffixed-line-length-132  -fno-backslash -fcheck=all -Wall -ffast-math -funroll-loops #  GNU   Fortran
# EFLAG = -Mextend -Mbackslash                          #  PGI Fortran
# EFLAG = -e                                            #  Sun   Fortran
# EFLAG = -W132                                         #  Absoft   Fortran

FFLAGS  = ${IFLAGS} ${EFLAG} ${DEFINEFLAGS} ${PARFLAGS} ${FOPTFLAGS} ${ARCHFLAGS}

LDFLAGS = ${IFLAGS} ${DEFINEFLAGS} ${ARCHFLAGS}

ARFLAGS = rv

SMKLIB = -L${OBJDIR} -lsmoke

########  netCDF-4 needs "-lnetcdff -lnetcdf":

# IOLIB = -L$(IOBIN) -lioapi -lnetcdff -lnetcdf ${PVMLIBS}
# IOLIB = -L$(IOBIN) -lioapi -lnetcdff -lnetcdf  
IOLIB = -L$(IOBIN) -lioapi ${NCFLIBS} 

Now compile SMOKE
chmod 755 $MASTERDIR/SMOKE_v5.0/compile.SMOKE.csh
$MASTERDIR/SMOKE_v5.0/compile.SMOKE.csh

OPTIONAL: Intel OneAPI installation and settings

Obtain and install Intel oneAPI Base Toolkit and Intel HPC Toolkit following instructions provided by Intel (Offline Installer is recommended)

In all of the instructions above and where intel compiler is applied, replace "icc" with "icx" and "icpc" with "icpx" (As of Intel HPC Toolkit 2024.1.0, classic fortran compiler "ifort" is still supported but it will be replaced by "ifx" in future versions).

One modification needed for compiling IOAPI: add stdlib.h header to $MASTERDIR/ioapi-3.2/ioapi/sortic.c so that it would look like:

#include  <string.h>  
#include  <stdint.h>  
#include "parms3.h"  
#include  <stdlib.h>  

Addition Information All software installations under this instruction were tested on Red Hat Enterprise Linux 8 and Ubuntu operation systems with gcc version 9.1.0, 11.2, intel classic compiler version 19.4 and intel OneAPI version 2024.1.0