-
Notifications
You must be signed in to change notification settings - Fork 22
Home
DISCLAIMER: The below instructions aim at helping inexperienced users in compiling SMOKE (and its prerequisite libraries and software). These instructions had been tested on limited number of Linux operating systems with their specific configurations, and so they may not work on all other systems.
- Instructions for I/O API
- Instructions for SMOKE
- Required fortran compilers: intel fortran (preferred) or gfortran compilers
- Prerequisite libraries (Skip to Installations instructions for required packages if they are not pre-installed):
- netcdf
- netcdf-fortran
- (Optional, required for netCDF-4 format) HDF5 , ZLIB, Szip.
The following instructions presumes all software will be installed under a parent directory with environmental name $MASTERDIR
NOTE
- Although these instructions are for both gcc/gfortran and intel compilers, using gcc/gfortran is NOT recommended due to inconsistency in gcc. Using intel compiler is highly recommended.
- 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.
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/ioapi-3.2/dependencies
. 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/tcsh
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]
breaksw
case 2:
case 3:
endsw
setenv IOAPI_HOME $MASTERDIR/ioapi-3.2
setenv IOAPI_BASE $IOAPI_HOME
setenv IOAPILIBS ${IOAPI_HOME}/${BIN}
setenv IOAPIINCD ${IOAPI_HOME}/${BIN}
setenv IOBIN ${IOAPI_HOME}/${BIN}
setenv BASEDIR ${PWD}
setenv INSTALL ${PWD}
setenv LIBINST ${INSTALL}/${BIN}
setenv BININST ${INSTALL}/${BIN}
setenv CPLMODE nocpl
setenv IOAPIDEFS "-DIOAPI_NCF4"
setenv PVMINCL
setenv VERSION '3.2-${CPLMODE}'
if ( ${BIN} == 'Linux2_x86_64' || ${BIN} == 'Linux2_x86_64gfortran' ) then
#module load gcc/9.1.0
setenv NETCDFC ${IOAPI_HOME}/dependencies/netcdfc.4.9.2_gcc
setenv NETCDFF ${IOAPI_HOME}/dependencies/netcdff.4.6.1_gcc
setenv HDF5 ${IOAPI_HOME}/dependencies/hdf5.1.14.3_gcc
setenv SZIP ${IOAPI_HOME}/dependencies/szip.2.1.1_gcc
setenv ZLIB ${IOAPI_HOME}/dependencies/zlib.1.3.1_gcc
setenv NCFLIBS "-L${NETCDFF}/lib -L${NETCDFC}/lib -L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib -lnetcdff -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lsz -ldl"
endif
if ( ${BIN} == 'Linux2_x86_64ifort' || ${BIN} == 'Linux2_x86_64ifort_mediumdbg' ) then
#module load intel/19.4
setenv NETCDFC ${IOAPI_HOME}/dependencies/netcdfc.4.9.2_intel
setenv NETCDFF ${IOAPI_HOME}/dependencies/netcdff.4.6.1_intel
setenv HDF5 ${IOAPI_HOME}/dependencies/hdf5.1.14.3_intel
setenv SZIP ${IOAPI_HOME}/dependencies/szip.2.1.1_intel
setenv ZLIB ${IOAPI_HOME}/dependencies/zlib.1.3.1_intel
setenv NCFLIBS "-L${NETCDFF}/lib -lnetcdff -L${NETCDFC}/lib -L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib -lnetcdf -lhdf5_hl -lhdf5 -lm -lz -lsz"
endif
- Create
$MASTERDIR/ioapi-3.2/compile.ioapi.csh
with the following content
#!/bin/tcsh
# Select either gfortran or intel fortran compiler
#setenv BIN Linux2_x86_64 # Using gfortran compiler
setenv BIN Linux2_x86_64ifort # Using intel fortran compiler (ifort)
source ./IOAPI.config.csh $BIN
cd $IOAPI_HOME
make clean
make all >& compile.$BIN.log
- 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
# ---------- 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
inconfigure
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
# 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'
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:
#OMPFLAGS = -openmp # for Intel compilers, version 15 or earlier
#OMPLIBS = -openmp
OMPFLAGS = -qopenmp
OMPLIBS = -qopenmp -qopenmp-link=static -static-intel
COPTFLAGS = -O3 ${MFLAGS}
FOPTFLAGS = -O3 -unroll -stack-temps -safe-cray-ptr \
-convert big_endian -assume byterecl ${MFLAGS}
##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) -static
## Module-include-directory command
MODI = -I
E132 = -ffixed-line-length-132
MFLAGS = -ffast-math -funroll-loops -m64 -static # -march=native -mtune=native
OMPFLAGS = -fopenmp
OMPLIBS = -fopenmp
COPTFLAGS = -O3 ${MFLAGS}
FOPTFLAGS = -O3 -std=legacy ${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 = -static -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
- 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 # source IOAPI config to get same variable $BIN and libraries
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
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 -static-intel -debug # 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 -march=native -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
- Create C-shell script
$MASTERDIR/config_support_softwares.csh
with the following content
#!/bin/tcsh -f
switch ( $#argv )
case 0:
echo "SCRIPT ERROR: compiler argument must be set: <intel/gcc>"
exit( 1 )
breaksw
case 1:
breaksw
case 2:
echo "SCRIPT ERROR: too many input arguments. Abort!"
exit( 1 )
breaksw
endsw
setenv compiler "$argv[1]"
if ($compiler == 'gcc') then
# module load gcc/9.1.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"
else if ($compiler == 'intel') then
# module load intel/19.4
setenv CC icc
setenv CXX icpc
setenv FC ifort
else
echo "SCRIPT ERROR: compiler parameter is not recognized. Abort!"
exit( 1 )
endif
#> Critical Folder Locations for Installed Software
setenv AUXILIARY $MASTERDIR/ioapi-3.2/dependencies
setenv HDF5 $AUXILIARY/hdf5.1.14.3_$compiler
setenv NETCDFF $AUXILIARY/netcdff.4.6.1_$compiler
setenv NETCDFC $AUXILIARY/netcdfc.4.9.2_$compiler
setenv ZLIB $AUXILIARY/zlib.1.3.1_$compiler
setenv SZIP $AUXILIARY/szip.2.1.1_$compiler
- Download zlib:
wget -P $MASTERDIR https://www.zlib.net/zlib-1.3.1.tar.gz
- Decompress the downloaded package
cd $MASTERDIR
tar -xvzf zlib-1.3.1.tar.gz
cd zlib-1.3.1
- Create
$MASTERDIR/zlib-1.3.1/compile.csh
with the following content
#!/bin/tcsh
# Select either gfortran or intel fortran compiler
setenv compiler intel
#setenv compiler gcc
source $MASTERDIR/config_support_softwares.csh $compiler
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
./configure --prefix=$ZLIB --64 --static
#>IMPORTANT: After running configure, add -fPIC to CFLAGS in Makefile before compiling: CFLAGS=-O3 -D_LARGEFILE64_SOURCE=1 -DHAVE_HIDDEN -fPIC
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/zlib-1.3.1/compile.csh
-
Run
$MASTERDIR/zlib-1.3.1/compile.csh <option>
with<option>
to be configure, make and make_install to compile zlib
$MASTERDIR/zlib-1.3.1/compile.csh configure
-
NOTE: After running
$MASTERDIR/zlib-1.3/compile.csh configure
add-fPIC
to the end of CFLAGS in Makefile before continue compiling
$MASTERDIR/zlib-1.3.1/compile.csh make_clean
(Optional; recommended when recompiling)
$MASTERDIR/zlib-1.3.1/compile.csh make
$MASTERDIR/zlib-1.3.1/compile.csh make_check
(Optional; recommended when recompiling)
$MASTERDIR/zlib-1.3.1/compile.csh make_install
-
If compiled successfully, zlib should be installed under
$MASTERDIR/ioapi-3.2/dependencies/zlib.1.3.1_$compiler
- Download szip
wget -P $MASTERDIR https://support.hdfgroup.org/ftp/lib-external/szip/2.1.1/src/szip-2.1.1.tar.gz
cd $MASTERDIR
tar -xvzf szip-2.1.1.tar.gz
cd szip-2.1.1
- Create
$MASTERDIR/szip-2.1.1/compile.csh
with the following content
#!/bin/tcsh
##Select either gfortran or intel fortran compiler
#setenv compiler gcc
setenv compiler intel
source $MASTERDIR/config_support_softwares.csh $compiler
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
./configure --prefix=$SZIP --disable-shared --enable-static
#>IMPORTANT: After running configure, add -fPIC to CFLAGS in Makefile
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/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/ioapi-3.2/dependencies/szip.2.1.1_$compiler
- Download hdf5
wget -P $MASTERDIR 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
tar -xvzf hdf5-1.14.3.tar.gz
cd hdf5-1.14.3
- Create
$MASTERDIR/hdf5-1.14.3/compile.csh
with the following content
#!/bin/tcsh
##Select either gfortran or intel fortran compiler
#setenv compiler gcc
setenv compiler intel
source $MASTERDIR/config_support_softwares.csh $compiler
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
./configure --prefix=$HDF5 --with-zlib=$ZLIB --with-szlib=$SZIP \
--enable-static --disable-shared \
--enable-static-exec \
--enable-fortran --enable-cxx --enable-hl \
--enable-fast-install \
--enable-tests=no \
--disable-sharedlib-rpath
endif
if ( $compiler == 'intel' ) then
./configure --prefix=$HDF5 --with-zlib=$ZLIB --with-szlib=$SZIP \
CFLAGS="-diag-disable=10441 -fPIC -O3 -xHost -ip -align -static -static-intel" \
FFLAGS="-fPIC -O3 -xHost -ip -align -static -static-intel" \
CXXFLAGS="-fPIC -O3 -xHost -ip -align -static -static-intel" \
--enable-static --disable-shared \
--enable-static-exec \
--enable-fortran --enable-cxx --enable-hl \
--enable-tests=no \
--disable-sharedlib-rpath
#--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 test >& log.$RUN_TYPE
endif
if ( $RUN_TYPE == "make_install" ) then
make install >& log.$RUN_TYPE
endif
chmod u+x $MASTERDIR/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/ioapi-3.2/dependencies/hdf5.1.14.3_$compiler
- Two NETCDF packages are required: netcdf-c and netcdf-fortran
- Download netcdf-c
wget -P $MASTERDIR https://downloads.unidata.ucar.edu/netcdf-c/4.9.2/netcdf-c-4.9.2.tar.gz
cd $MASTERDIR
tar -xvzf netcdf-c-4.9.2.tar.gz
cd netcdf-c-4.9.2
- Create
$MASTERDIR/netcdf-c-4.9.2/compile.csh
with the following content
#!/bin/tcsh
##Select either gfortran or intel fortran compiler
#setenv compiler gcc
setenv compiler intel
source $MASTERDIR/config_support_softwares.csh $compiler
mkdir -p $NETCDFC
setenv CPPFLAGS "-I${HDF5}/include -I${SZIP}/include -I${ZLIB}/include"
setenv LDFLAGS "-L${HDF5}/lib -L${SZIP}/lib -L${ZLIB}/lib"
#setenv LIBS "-lhdf5_hl -lhdf5 -lm -lz -lsz" # Does not need this
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
./configure --prefix=$NETCDFC \
--disable-dap \
--disable-shared \
--disable-examples \
--enable-static \
--disable-byterange \
--disable-plugins \
CFLAGS='-static -static-libgcc -static-libgfortran' \
--disable-libxml2
endif
if ( $compiler == 'intel' ) then
./configure --prefix=$NETCDFC \
--disable-dap \
--disable-examples \
--disable-shared \
--disable-byterange \
--disable-libxml2 \
--disable-plugins \
CFLAGS='-static -static-intel' \
--enable-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 check >& log.$RUN_TYPE
endif
if ( $RUN_TYPE == "make_install" ) then
make install >& log.$RUN_TYPE
endif
chmod u+x $MASTERDIR/netcdf-c-4.9.2/compile.csh
- Run
$MASTERDIR/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/ioapi-3.2/dependencies/netcdfc.4.9.2_$compiler
- Download netcdf-fortran
wget -P $MASTERDIR https://downloads.unidata.ucar.edu/netcdf-fortran/4.6.1/netcdf-fortran-4.6.1.tar.gz
cd $MASTERDIR
tar -xvzf netcdf-fortran-4.6.1.tar.gz
cd netcdf-fortran-4.6.1
- Create
$MASTERDIR/netcdf-fortran-4.6.1/compile.csh
with the following content
#!/bin/tcsh
##Select either gfortran or intel fortran compiler
#setenv compiler gcc
setenv compiler intel
source $MASTERDIR/config_support_softwares.csh $compiler
mkdir -p $NETCDFF
setenv LIBS `${NETCDFC}/bin/nc-config --libs`
setenv CPPFLAGS "-I${NETCDFC}/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
./configure --prefix=$NETCDFF CFLAGS='-static' \
--disable-shared \
--enable-static \
--disable-zstandard-plugin \
--enable-fast-install
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/netcdf-fortran-4.6.1/compile.csh
- Run
$MASTERDIR/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/ioapi-3.2/dependencies/netcdff.4.6.1_$compiler
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