本文整理汇总了Python中CIME.XML.machines.Machines.is_valid_MPIlib方法的典型用法代码示例。如果您正苦于以下问题:Python Machines.is_valid_MPIlib方法的具体用法?Python Machines.is_valid_MPIlib怎么用?Python Machines.is_valid_MPIlib使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CIME.XML.machines.Machines
的用法示例。
在下文中一共展示了Machines.is_valid_MPIlib方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _case_two_setup
# 需要导入模块: from CIME.XML.machines import Machines [as 别名]
# 或者: from CIME.XML.machines.Machines import is_valid_MPIlib [as 别名]
def _case_two_setup(self):
mach_name = self._case.get_value("MACH")
mach_obj = Machines(machine=mach_name)
if mach_obj.is_valid_MPIlib("mpi-serial"):
self._case.set_value("MPILIB","mpi-serial")
else:
logger.warning("mpi-serial is not supported on machine '{}', "
"so we have to fall back to default MPI and "
"therefore very little is being tested".format(mach_name))
if os.path.isfile("Macros"):
os.remove("Macros")
self._case.case_setup(test_mode=True, reset=True)
示例2: configure
# 需要导入模块: from CIME.XML.machines import Machines [as 别名]
# 或者: from CIME.XML.machines.Machines import is_valid_MPIlib [as 别名]
def configure(self, compset_name, grid_name, machine_name=None,
project=None, pecount=None, compiler=None, mpilib=None,
user_compset=False, pesfile=None,
user_grid=False, gridfile=None, ninst=1, test=False,
walltime=None, queue=None):
#--------------------------------------------
# compset, pesfile, and compset components
#--------------------------------------------
self._set_compset_and_pesfile(compset_name, user_compset=user_compset, pesfile=pesfile)
self._components = self.get_compset_components()
#FIXME - if --user-compset is True then need to determine that
#all of the compset settings are valid
#--------------------------------------------
# grid
#--------------------------------------------
if user_grid is True and gridfile is not None:
self.set_value("GRIDS_SPEC_FILE", gridfile)
grids = Grids(gridfile)
gridinfo = grids.get_grid_info(name=grid_name, compset=self._compsetname)
self._gridname = gridinfo["GRID"]
for key,value in gridinfo.items():
logger.debug("Set grid %s %s"%(key,value))
self.set_lookup_value(key,value)
#--------------------------------------------
# component config data
#--------------------------------------------
self._get_component_config_data()
self.get_compset_var_settings()
#--------------------------------------------
# machine
#--------------------------------------------
# set machine values in env_xxx files
machobj = Machines(machine=machine_name)
machine_name = machobj.get_machine_name()
self.set_value("MACH",machine_name)
nodenames = machobj.get_node_names()
nodenames = [x for x in nodenames if
'_system' not in x and '_variables' not in x and 'mpirun' not in x and\
'COMPILER' not in x and 'MPILIB' not in x]
for nodename in nodenames:
value = machobj.get_value(nodename, resolved=False)
type_str = self.get_type_info(nodename)
if type_str is not None:
logger.debug("machine nodname %s value %s"%(nodename, value))
self.set_value(nodename, convert_to_type(value, type_str, nodename))
if compiler is None:
compiler = machobj.get_default_compiler()
else:
expect(machobj.is_valid_compiler(compiler),
"compiler %s is not supported on machine %s" %(compiler, machine_name))
self.set_value("COMPILER",compiler)
if mpilib is None:
mpilib = machobj.get_default_MPIlib({"compiler":compiler})
else:
expect(machobj.is_valid_MPIlib(mpilib, {"compiler":compiler}),
"MPIlib %s is not supported on machine %s" %(mpilib, machine_name))
self.set_value("MPILIB",mpilib)
machdir = machobj.get_machines_dir()
self.set_value("MACHDIR", machdir)
# Create env_mach_specific settings from machine info.
env_mach_specific_obj = self.get_env("mach_specific")
env_mach_specific_obj.populate(machobj)
self.schedule_rewrite(env_mach_specific_obj)
#--------------------------------------------
# pe payout
#--------------------------------------------
match1 = re.match('([0-9]+)x([0-9]+)', "" if pecount is None else pecount)
match2 = re.match('([0-9]+)', "" if pecount is None else pecount)
pes_ntasks = {}
pes_nthrds = {}
pes_rootpe = {}
if match1:
opti_tasks = match1.group(1)
opti_thrds = match1.group(2)
elif match2:
opti_tasks = match2.group(1)
opti_thrds = 1
other = {}
if match1 or match2:
for component_class in self._component_classes:
if component_class == "DRV":
component_class = "CPL"
string = "NTASKS_" + component_class
pes_ntasks[string] = opti_tasks
#.........这里部分代码省略.........
示例3: configure
# 需要导入模块: from CIME.XML.machines import Machines [as 别名]
# 或者: from CIME.XML.machines.Machines import is_valid_MPIlib [as 别名]
def configure(self, compset_name, grid_name, machine_name=None,
project=None, pecount=None, compiler=None, mpilib=None,
user_compset=False, pesfile=None,
user_grid=False, gridfile=None, ninst=1, test=False):
#--------------------------------------------
# compset, pesfile, and compset components
#--------------------------------------------
self._set_compset_and_pesfile(compset_name, user_compset=user_compset, pesfile=pesfile)
self._components = self.get_compset_components()
#FIXME - if --user-compset is True then need to determine that
#all of the compset settings are valid
#--------------------------------------------
# grid
#--------------------------------------------
if user_grid is True and gridfile is not None:
self.set_value("GRIDS_SPEC_FILE", gridfile);
grids = Grids(gridfile)
gridinfo = grids.get_grid_info(name=grid_name, compset=self._compsetname)
self._gridname = gridinfo["GRID"]
for key,value in gridinfo.items():
logger.debug("Set grid %s %s"%(key,value))
self.set_value(key,value)
#--------------------------------------------
# component config data
#--------------------------------------------
self._get_component_config_data()
self.get_compset_var_settings()
# Add the group and elements for the config_files.xml
for idx, config_file in enumerate(self._component_config_files):
self.set_value(config_file[0],config_file[1])
#--------------------------------------------
# machine
#--------------------------------------------
# set machine values in env_xxx files
machobj = Machines(machine=machine_name)
machine_name = machobj.get_machine_name()
self.set_value("MACH",machine_name)
nodenames = machobj.get_node_names()
nodenames = [x for x in nodenames if
'_system' not in x and '_variables' not in x and 'mpirun' not in x and\
'COMPILER' not in x and 'MPILIB' not in x]
for nodename in nodenames:
value = machobj.get_value(nodename)
type_str = self.get_type_info(nodename)
if type_str is not None:
self.set_value(nodename, convert_to_type(value, type_str, nodename))
if compiler is None:
compiler = machobj.get_default_compiler()
else:
expect(machobj.is_valid_compiler(compiler),
"compiler %s is not supported on machine %s" %(compiler, machine_name))
self.set_value("COMPILER",compiler)
if mpilib is None:
mpilib = machobj.get_default_MPIlib({"compiler":compiler})
else:
expect(machobj.is_valid_MPIlib(mpilib, {"compiler":compiler}),
"MPIlib %s is not supported on machine %s" %(mpilib, machine_name))
self.set_value("MPILIB",mpilib)
machdir = machobj.get_machines_dir()
self.set_value("MACHDIR", machdir)
# Overwriting an existing exeroot or rundir can cause problems
exeroot = self.get_value("EXEROOT")
rundir = self.get_value("RUNDIR")
for wdir in (exeroot, rundir):
if os.path.exists(wdir):
expect(not test, "Directory %s already exists, aborting test"% wdir)
response = raw_input("\nDirectory %s already exists, (r)eplace, (a)bort, or (u)se existing?"% wdir)
if response.startswith("r"):
shutil.rmtree(wdir)
else:
expect(response.startswith("u"), "Aborting by user request")
# the following go into the env_mach_specific file
vars = ("module_system", "environment_variables", "mpirun")
env_mach_specific_obj = self._get_env("mach_specific")
for var in vars:
nodes = machobj.get_first_child_nodes(var)
for node in nodes:
env_mach_specific_obj.add_child(node)
#--------------------------------------------
# pe payout
#--------------------------------------------
pesobj = Pes(self._pesfile)
#FIXME - add pesize_opts as optional argument below
#.........这里部分代码省略.........