Exemplo n.º 1
0
    def build_exe(self, loc_compiler=None):

        if loc_compiler == None:
            loc_compiler = self._compiler

        drv_dir = os.path.join(self._marbl_dir, 'tests', 'driver_src')

        if self._machine != 'local':
            machs.load_module(self._machine, loc_compiler,
                              self._module_names[loc_compiler])

        makecmd = 'make %s' % loc_compiler
        if self._mpitasks > 0:
            makecmd += ' USEMPI=TRUE'
        sh_command('cd %s; %s' % (drv_dir, makecmd))
Exemplo n.º 2
0
  def run_exe(self):

    logger = logging.getLogger(__name__)

    # build the executable command string
    execmd = os.path.join(self._marbl_dir, 'tests', 'driver_exe') + os.sep

    # if running in parallel, executable is marbl-mpi.exe
    if self._mpitasks > 0:
      execmd += "marbl-mpi.exe"

      # need to launch with mpirun
      execmd = 'mpirun -n %d %s' % (self._mpitasks, execmd)

    # if running in serial, executable is marbl.exe
    else:
      execmd += "marbl.exe"

    # First argument is the file containing &marbl_driver_nml namelist
    execmd += " -n %s" % self._namelist_file

    # If an input file was specified, it should be the second argument
    if self._settings_file != None:
      execmd += " -s %s" % self._settings_file

    # Log executable command
    logging.info("Running following command:")
    logging.info(execmd)
    sys.stdout.flush()
    status_code = sh_command(execmd)
    if status_code != 0:
        logging.error("ERROR in executable")
        sys.exit(1)
Exemplo n.º 3
0
  def build_lib(self, loc_compiler=None):

    if loc_compiler == None:
      loc_compiler = self._compiler

    src_dir = os.path.join(self._marbl_dir, 'src')

    if self._machine != 'local':
      machs.load_module(self._machine, loc_compiler, self._module_names[loc_compiler])

    makecmd = 'make %s' % loc_compiler
    if self._mpitasks > 0:
      makecmd += ' USEMPI=TRUE'
    status_code = sh_command('cd %s; %s' % (src_dir, makecmd))
    if status_code != 0:
        logging.error("ERROR building MARBL library")
        sys.exit(1)
Exemplo n.º 4
0
  def build_exe(self, loc_compiler=None):

    if loc_compiler == None:
      loc_compiler = self._compiler

    drv_dir = os.path.join(self._marbl_dir, 'tests', 'driver_src')

    if self._machine != 'local':
      machs.load_module(self._machine, loc_compiler, self._module_names[loc_compiler])

    makecmd = 'make %s' % loc_compiler
    if self._withnc:
      makecmd += ' USE_NETCDF=TRUE'
    if self._mpitasks > 0:
      makecmd += ' USEMPI=TRUE'
    status_code = sh_command('cd %s; %s' % (drv_dir, makecmd))
    if status_code != 0:
        logging.error("ERROR building MARBL stand-alone driver")
        sys.exit(1)
Exemplo n.º 5
0
    def run_exe(self):

        logger = logging.getLogger(__name__)

        # build the executable command string
        execmd = os.path.join(self._marbl_dir, 'tests', 'driver_exe') + os.sep

        # if running in parallel, executable is marbl-mpi.exe
        if self._mpitasks > 0:
            execmd += "marbl-mpi.exe"

            # need to launch with mpirun
            # Note that yellowstone actually uses mpirun.lsf
            # (and we want to avoid running on a login node)
            if self._machine == 'yellowstone':
                execmd = 'mpirun.lsf %s' % execmd
                if 'yslogin' in self._hostname:
                    # on login node => request caldera node!
                    execmd = 'execca %s' % execmd
            else:
                execmd = 'mpirun -n %d %s' % (self._mpitasks, execmd)

        # if running in serial, executable is marbl.exe
        else:
            execmd += "marbl.exe"

        # First argument is the file containing &marbl_driver_nml namelist
        execmd += " -n %s" % self._namelist_file

        # If an input file was specified, it should be the second argument
        if self._input_file != None:
            execmd += " -i %s" % self._input_file

        # Log executable command
        logging.info("Running following command:")
        logging.info(execmd)
        sys.stdout.flush()
        status_code = sh_command(execmd)
        if status_code != 0:
            logging.error("ERROR in executable")
            sys.exit(status_code)
Exemplo n.º 6
0
    def _clean_exe(self):

        drv_dir = os.path.join(self._marbl_dir, 'tests', 'driver_src')
        sh_command('cd %s; make clean' % drv_dir)
Exemplo n.º 7
0
    def _clean_lib(self):

        src_dir = os.path.join(self._marbl_dir, 'src')
        sh_command('cd %s; make clean' % src_dir)