Opened 13 years ago

Closed 13 years ago

#497 closed upgrade (Done)

IMPORTANT: ROMS build script revisited

Reported by: arango Owned by: arango
Priority: major Milestone: Release ROMS/TOMS 3.4
Component: Nonlinear Version: 3.4
Keywords: Cc:

Description

The build script (ROMS/Bin/build.bash and ROMS/Bin/build.sh) was improved and updated:

  • Mostly all the user tunable parameters are close to each other and better documented:
    # Other user defined environmental variables. See the ROMS makefile for
    # details on other options the user might want to set here. Be sure to
    # leave the switches meant to be off set to an empty string or commented
    # out. Any string value (including off) will evaluate to TRUE in
    # conditional if-statements.
    
     export           USE_MPI=on            # distributed-memory parallelism
     export        USE_MPIF90=on            # compile with mpif90 script
    #export         which_MPI=mpich         # compile with MPICH library
    #export         which_MPI=mpich2        # compile with MPICH2 library
     export         which_MPI=openmpi       # compile with OpenMPI library
    
    #export        USE_OpenMP=on            # shared-memory parallelism
    
     export              FORT=ifort
    #export              FORT=gfortran
    #export              FORT=pgi
    
    #export         USE_DEBUG=on            # use Fortran debugging flags
     export         USE_LARGE=on            # activate 64-bit compilation
    #export       USE_NETCDF4=on            # compile with NetCDF-4 library
    #export   USE_PARALLEL_IO=on            # Parallel I/O with Netcdf-4/HDF5
    
    #export       USE_MY_LIBS=on            # use my library paths below
    
    Notice the new local variable which_MPI to specify which MPI library to use during compilation. You need choose only one and comment the other values.
  • The value of local variable USE_MY_LIBS is commented out by default. If you want to use this nice capability, you need to change the paths of the required libraries in your particular computer. Recall that you may want to have different copies of the build script for a particular computer.
  • Now we are using the NetCDF-4 configuration script nc-config which is available since NetCDF version 4.0.1. This script loads all the required libraries according to the NetCDF-4 installation options (openDAP, NetCDF4/HDF5 file format). For Example, the logic for the ifort compiler is now:
    if [ -n "${USE_MY_LIBS:+1}" ]; then
      case "$FORT" in
        ifort )
          export            ESMF_OS=Linux
          export      ESMF_COMPILER=ifort
          export          ESMF_BOPT=O
          export           ESMF_ABI=64
          export          ESMF_COMM=mpich
          export          ESMF_SITE=default
    
          if [ -n "${USE_MPI:+1}" ]; then
            if [ "${which_MPI}" = "mpich" ]; then
              export       ESMF_DIR=/opt/intelsoft/mpich/esmf
              export     MCT_INCDIR=/opt/intelsoft/mpich/mct/include
              export     MCT_LIBDIR=/opt/intelsoft/mpich/mct/lib
            elif [ "${which_MPI}" = "mpich2" ]; then
              export       ESMF_DIR=/opt/intelsoft/mpich2/esmf
              export     MCT_INCDIR=/opt/intelsoft/mpich2/mct/include
              export     MCT_LIBDIR=/opt/intelsoft/mpich2/mct/lib
            elif [ "${which_MPI}" = "openmpi" ]; then
              export       ESMF_DIR=/opt/intelsoft/openmpi/esmf
              export     MCT_INCDIR=/opt/intelsoft/openmpi/mct/include
              export     MCT_LIBDIR=/opt/intelsoft/openmpi/mct/lib
            fi
          fi
    
          export        ARPACK_LIBDIR=/opt/intelsoft/serial/ARPACK
          if [ -n "${USE_MPI:+1}" ]; then
            if [ "${which_MPI}" = "mpich" ]; then
              export   PARPACK_LIBDIR=/opt/intelsoft/mpich/PARPACK
            elif [ "${which_MPI}" = "mpich2" ]; then
              export   PARPACK_LIBDIR=/opt/intelsoft/mpich2/PARPACK
            elif [ "${which_MPI}" = "openmpi" ]; then
              export   PARPACK_LIBDIR=/opt/intelsoft/openmpi/PARPACK
            fi
          fi
    
          if [ -n "${USE_NETCDF4:+1}" ]; then
            if [ -n "${USE_PARALLEL_IO:+1}" ] && [ -n "${USE_MPI:+1}" ]; then
              if [ "${which_MPI}" = "mpich" ]; then
                export      NC_CONFIG=/opt/intelsoft/mpich/netcdf4/bin/nc-config
                export  NETCDF_INCDIR=/opt/intelsoft/mpich/netcdf4/include
              elif [ "${which_MPI}" = "mpich2" ]; then
                export      NC_CONFIG=/opt/intelsoft/mpich2/netcdf4/bin/nc-config
                export  NETCDF_INCDIR=/opt/intelsoft/mpich2/netcdf4/include
              elif [ "${which_MPI}" = "openmpi" ]; then
                export      NC_CONFIG=/opt/intelsoft/openmpi/netcdf4/bin/nc-config
                export  NETCDF_INCDIR=/opt/intelsoft/openmpi/netcdf4/include
              fi
            else
              export        NC_CONFIG=/opt/intelsoft/serial/netcdf4/bin/nc-config
              export    NETCDF_INCDIR=/opt/intelsoft/serial/netcdf4/include
            fi
          else
            export      NETCDF_INCDIR=/opt/intelsoft/serial/netcdf3/include
            export      NETCDF_LIBDIR=/opt/intelsoft/serial/netcdf3/lib
          fi
          ;;
    ...
    
    Again, all the above logic is processed when the environmental variable USE_MY_LIBS is not empty and has any non-blank value.
  • The above change with the NetCDF4 nc-config script required an update of all the make configuration (*.mk) files in the Compilers directory. This cleaned the logic nicely. Notice that such script is not available for NetCDF 3.x.

Many thanks to Mark Hadfield for suggesting this change.


WARNING:

  • You need to update the makefile, make configuration (*.mk) scripts, and build (build.bash, build.sh) for all this to work correctly.
  • I highly recommend to use the build script when compiling and linking ROMS always. Advanced users that run in various computer architecture may want to have their own Compiles sub-directory somewhere else. I have my customized make configuration files in $HOME/Compilers. So I tell the build script to use those configuration files instead:
    #export         COMPILERS=${MY_ROMS_SRC}/Compilers
     export         COMPILERS=${HOME}/Compilers
    

Change History (1)

comment:1 by arango, 13 years ago

Resolution: Done
Status: newclosed
Note: See TracTickets for help on using tickets.