my build paths

From WikiROMS
Jump to: navigation, search
Library and Executable Paths - my_build_paths.csh, my_build_paths.sh

NoteNote: in SVN revision 933 (January 26, 2019) the custom libraries section was removed from the ROMS build script and placed in Compilers/my_build_paths.csh and Compilers/my_build_paths.sh to both streamline the ROMS build script and make setting up new applications less tedious. More information can be found in ROMS Trac ticket #794. Prior to ROMS release 933, the paths mentioned below were included in the ROMS build script.


Rather than editing files released with ROMS and possibly creating conflicts during updates, we suggest that you copy the appropriate my_build_paths file to another folder (we recommend ~/Compilers/ROMS) and set MY_PATHS to the full path to your my_build_paths file (i.e. ~/Compilers/ROMS/my_build_paths.csh).

The path of the libraries and MPI implementations required by ROMS can be set using environment variables which take precedence over the values specified in the makefile macro definitions file (Compilers/*.mk). To activate custom paths set in my_build_paths, set USE_MY_LIBS to yes and make sure MY_PATHS is properly set in the ROMS build script.

Compiler and MPI Implementation

There is a section (the one from my_build_paths.csh is shown below) in the MY_PATHS file to make it easier to switch between different compilers and MPI implementations. This will only apply to MPI implementations that use the mpif90 style wrapper script (MPICH, MPICH2, OpenMPI, etc.).

if ($?USE_MPIF90) then
switch ($FORT)

case "ifort"
if ($which_MPI == "mpich" ) then
setenv MPI_ROOT /opt/intelsoft/mpich
else if ($which_MPI == "mpich2" ) then
setenv MPI_ROOT /opt/intelsoft/mpich2
else if ($which_MPI == "openmpi" ) then
setenv MPI_ROOT /opt/intelsoft/openmpi
else if ($which_MPI == "mvapich2" ) then
setenv MPI_ROOT /opt/intelsoft/mvapich2
endif
setenv PATH ${MPI_ROOT}/bin:$PATH
setenv MPI_INCDIR ${MPI_ROOT}/include
breaksw

case "pgi"
if ($which_MPI == "mpich" ) then
setenv MPI_ROOT /opt/pgisoft/mpich
else if ($which_MPI == "mpich2" ) then
setenv MPI_ROOT /opt/pgisoft/mpich2
else if ($which_MPI == "openmpi" ) then
setenv MPI_ROOT /opt/pgisoft/openmpi
else if ($which_MPI == "mvapich2" ) then
setenv MPI_ROOT /opt/pgisoft/mvapich2
endif
setenv PATH ${MPI_ROOT}/bin:$PATH
setenv MPI_INCDIR ${MPI_ROOT}/include
breaksw

case "gfortran"
if ($which_MPI == "mpich2" ) then
setenv MPI_ROOT /opt/gfortransoft/mpich2
else if ($which_MPI == "openmpi" ) then
setenv MPI_ROOT /opt/gfortransoft/openmpi
else if ($which_MPI == "mvapich2" ) then
setenv MPI_ROOT /opt/gfortransoft/mvapich2
endif
setenv PATH ${MPI_ROOT}/bin:$PATH
setenv MPI_INCDIR ${MPI_ROOT}/include
breaksw

endsw
endif

NoteKeep in mind that you need to adjust the paths to your MPI implementations for your particular system. You must also set USE_MPIF90 to on.

External Library Paths

For information about required and optional external libraries visit the External Libraries page.

For most applications, only the location of the NetCDF library (NETCDF_LIBDIR) and include directory (NETCDF_INCDIR) are needed. Notice that when the USE_NETCDF4 macro is activated, we need the serial or parallel version of the NetCDF-4/HDF5 library. The configuration script NF_CONFIG (available since NetCDF 4.2) is used to set up all the required libraries according to the installed options (OPeNDAP, NetCDF4/HDF5 file format). The parallel library uses the MPI-I/O layer (available in most modern MPI implementation) requiring compiling with the selected MPI library.

In ROMS distributed-memory applications, you may use either the serial or parallel version of the NetCDF-4/HDF5 library. The parallel version is required when parallel I/O is activated (ROMS cpp option PARALLEL_IO and HDF5). For more I/O options see the ROMS I/O page.

However, in serial or shared-memory ROMS applications, we need to use the serial version of the NetCDF-4/HDF5 to avoid conflicts with the compiler. We cannot activate MPI constructs in serial or shared-memory ROMS code. Hybrid parallelism is not possible.


Below is an excerpt from the custom library section.

setenv MPI_SOFT ""

switch ($FORT)

# Intel Compiler:

case "ifort"
setenv ESMF_COMPILER intelgcc
if ($?USE_DEBUG) then
setenv ESMF_BOPT g
else
setenv ESMF_BOPT O
endif

setenv ESMF_ABI 64
setenv ESMF_COMM ${which_MPI}
setenv ESMF_SITE default

setenv ARPACK_LIBDIR /opt/intelsoft/serial/ARPACK

if ($?USE_MPI) then
if ($which_MPI == "mpich" ) then
setenv MPI_SOFT /opt/intelsoft/mpich
else if ($which_MPI == "mpich2" ) then
setenv MPI_SOFT /opt/intelsoft/mpich2
else if ($which_MPI == "openmpi" ) then
setenv MPI_SOFT /opt/intelsoft/openmpi
else if ($which_MPI == "mvapich2" ) then
setenv MPI_SOFT /opt/intelsoft/mvapich2
endif

setenv MCT_INCDIR ${MPI_SOFT}/mct/include
setenv MCT_LIBDIR ${MPI_SOFT}/mct/lib
setenv PARPACK_LIBDIR ${MPI_SOFT}/PARPACK
endif

if ($?USE_NETCDF4) then
if ($?USE_PARALLEL_IO && $?USE_MPI) then
setenv ESMF_DIR ${MPI_SOFT}/esmf_nc4
setenv NETCDF ${MPI_SOFT}/netcdf4
setenv NF_CONFIG ${NETCDF}/bin/nf-config
setenv NETCDF_INCDIR ${NETCDF}/include
setenv NETCDF4 1
else
setenv ESMF_DIR ${MPI_SOFT}/esmf_nc4
setenv NETCDF /opt/intelsoft/serial/netcdf4
setenv NF_CONFIG ${NETCDF}/bin/nf-config
setenv NETCDF_INCDIR ${NETCDF}/include
setenv NETCDF4 1
endif
else
setenv ESMF_DIR ${MPI_SOFT}/esmf_nc3
setenv NETCDF /opt/intelsoft/serial/netcdf3
setenv NETCDF_INCDIR ${NETCDF}/include
setenv NETCDF_LIBDIR ${NETCDF}/lib
endif

if ($?USE_PIO) then
setenv PIO ${MPI_SOFT}/pio
setenv PIO_LIBDIR ${PIO}/lib
setenv PIO_INCDIR ${PIO}/include
setenv PNETCDF ${MPI_SOFT}/pnetcdf
setenv PNETCDF_LIBDIR ${PNETCDF}/lib
setenv PNETCDF_INCDIR ${PNETCDF}/include
endif

if ($?USE_SCORPIO) then
setenv SCORPIO ${MPI_SOFT}/scorpio
setenv PIO_LIBDIR ${SCORPIO}/lib
setenv PIO_INCDIR ${SCORPIO}/include
setenv PNETCDF ${MPI_SOFT}/pnetcdf
setenv PNETCDF_LIBDIR ${PNETCDF}/lib
setenv PNETCDF_INCDIR ${PNETCDF}/include
endif

if ($?USE_HDF5) then
if ($?USE_PARALLEL_IO && $?USE_MPI) then
setenv HDF5 ${MPI_SOFT}/hdf5
setenv HDF5_LIBDIR ${HDF5}/lib
setenv HDF5_INCDIR ${HDF5}/include
else
setenv HDF5 /opt/intelsoft/serial/hdf5
setenv HDF5_LIBDIR ${HDF5}/lib
setenv HDF5_INCDIR ${HDF5}/include
endif
endif

. . .

breaksw