Skip to content

Porting Overview

mvertens edited this page Jan 30, 2017 · 2 revisions

One of the first steps many users will have to address is getting CIME based models running on their local machine. This section will describe that process. It is usually very helpful to assure that you can run a basic mpi parallel program on your machine prior to attempting a CIME port. Understanding how to compile and run the program fhello_world_mpi.F90 shown here could potentially save many hours of frustration.

program fhello_world_mpi.F90
  use mpi
  implicit none
  integer ( kind = 4 ) error
  integer ( kind = 4 ) id
  integer p
  character(len=MPI_MAX_PROCESSOR_NAME) :: name
  integer clen
  integer, allocatable :: mype(:)
  real ( kind = 8 ) wtime

  call MPI_Init ( error )
  call MPI_Comm_size ( MPI_COMM_WORLD, p, error )
  call MPI_Comm_rank ( MPI_COMM_WORLD, id, error )
  if ( id == 0 ) then

    wtime = MPI_Wtime ( )

    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) 'HELLO_MPI - Master process:'
    write ( *, '(a)' ) '  FORTRAN90/MPI version'
    write ( *, '(a)' ) ' '
    write ( *, '(a)' ) '  An MPI test program.'
    write ( *, '(a)' ) ' '
    write ( *, '(a,i8)' ) '  The number of processes is ', p
    write ( *, '(a)' ) ' '

  end if

  call MPI_GET_PROCESSOR_NAME(NAME, CLEN, ERROR)

  write ( *, '(a)' ) ' '
  write ( *, '(a,i8,a,a)' ) '  Process ', id, ' says "Hello, world!" ',name(1:clen)

  call MPI_Finalize ( error )

end program

Once you are assured that you have a basic functional MPI environment you will need to provide a few prerequisite tools for building and running CIME.

  • A python interpreter version 2.7 or newer
  • Build tools gmake and cmake
  • A netcdf library version 4.3 or newer built with the same compiler you will use for CIME
  • Optionally a pnetcdf library.

The following steps should be followed:

  • Create a $HOME/.cime directory
  • Copy the template file $CIME/cime_config/xml_schemas/config_machines_template.xml to $HOME/.cime/config_machines.xml
  • Fill in the details of $HOME/.cime/config_machines.xml that specific to your machine.
  • The completed file should conform to the schema definition provided, check it using:
xmllint --noout --schema $CIME/cime_config/xml_schemas/config_machines.xsd $HOME/.cime/config_machines.xml
  • The files config_batch.xml and config_compilers.xml may also need specific adjustments for your batch system and compiler. You can edit these files in place to add your machine configuration or you can place your custom configuration files in the directory $HOME/.cime/. We recommend the latter approach. All files in $HOME/.cime/ are appended to the xml objects read into memory.
  • Once you have a basic configuration for your machine defined in your new $HOME/.cime XML files, you should try the scripts_regression_test in directory $CIME/utils/python/tests. This script will run a number of basic unit tests starting from the simplest issues and working toward more complicated ones.
  • Finally when all the previous steps have run correctly, you are ready to try a case at your target compset and resolution.
Clone this wiki locally