本文整理汇总了Python中mpi4py.MPI.get_vendor方法的典型用法代码示例。如果您正苦于以下问题:Python MPI.get_vendor方法的具体用法?Python MPI.get_vendor怎么用?Python MPI.get_vendor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mpi4py.MPI
的用法示例。
在下文中一共展示了MPI.get_vendor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: check_mpi
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def check_mpi():
mpiexec_path, _ = os.path.split(distutils.spawn.find_executable("mpiexec"))
for executable, path in mpi4py.get_config().items():
if executable not in ['mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort']:
continue
if mpiexec_path not in path:
raise ImportError("mpi4py may not be configured against the same version of 'mpiexec' that you are using. The 'mpiexec' path is {mpiexec_path} and mpi4py.get_config() returns:\n{mpi4py_config}\n".format(mpiexec_path=mpiexec_path, mpi4py_config=mpi4py.get_config()))
if 'Open MPI' not in MPI.get_vendor():
raise ImportError("mpi4py must have been installed against Open MPI in order for StructOpt to function correctly.")
vendor_number = ".".join([str(x) for x in MPI.get_vendor()[1]])
if vendor_number not in mpiexec_path:
raise ImportError("The MPI version that mpi4py was compiled against does not match the version of 'mpiexec'. mpi4py's version number is {}, and mpiexec's path is {}".format(MPI.get_vendor(), mpiexec_path))
示例2: getlibraryinfo
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def getlibraryinfo():
from mpi4py import MPI
info = "MPI %d.%d" % MPI.Get_version()
name, version = MPI.get_vendor()
if name != "unknown":
info += (" (%s %s)" % (name, '%d.%d.%d' % version))
return info
示例3: main
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def main(split_into=2, nloops=3):
world = MPI.COMM_WORLD
rank = world.Get_rank()
size = world.Get_size()
if size < split_into:
raise ValueError("The number of cores passed to 'mpiexec' must be greater than the number of desired communicators.")
cores_per_comm = size // split_into
# Create fake data for input for each of the different processes we will spawn
multipliers = [i+1 for i in range(split_into)]
if 'Open MPI' not in MPI.get_vendor():
colors = [(i+1)//split_into for i in range(split_into)]
data_by_process = [(str(multipliers[i]), str(colors[i])) for i in range(split_into)]
else:
data_by_process = [(str(multipliers[i]),) for i in range(split_into)]
if rank == 0:
print("At each iteration we will spawn {} workers with {} cores each out of a total of {} cores.".format(split_into, cores_per_comm, size))
print("Those {} split communicators will get the following as input:".format(split_into))
for i in range(split_into):
print(" Communicator {}: {}".format(i, data_by_process[i]))
for i in range(nloops):
print("Iteration {}...".format(i))
spawn_multiple(split_into, cores_per_comm, data_by_process)
示例4: is_mpd_running
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def is_mpd_running():
name_of_the_vendor, version = MPI.get_vendor()
if name_of_the_vendor == 'MPICH2':
process = subprocess.Popen(['mpdtrace'], stdout = subprocess.PIPE, stderr = subprocess.PIPE)
(output_string, error_string) = process.communicate()
return not (process.returncode == 255)
else:
return True
示例5: ensure_mpd_is_running
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def ensure_mpd_is_running():
if not is_mpd_running():
name_of_the_vendor, version = MPI.get_vendor()
if name_of_the_vendor == "MPICH2":
try:
process = subprocess.Popen(["nohup", "mpd"], close_fds=True)
except OSError as ex:
pass
示例6: set_default_mpi_parameters
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def set_default_mpi_parameters(parameters):
# If mpi4py is used, make sure we can import it and set the rank/size for all cores in the parameters.mpi
use_mpi4py = True
if 'relaxations' in parameters:
for module in parameters.relaxations:
parameters.relaxations[module].setdefault('use_mpi4py', False)
parameters.relaxations[module].setdefault('MPMD', 0)
if parameters.relaxations[module].use_mpi4py:
use_mpi4py = True
if 'fitnesses' in parameters:
for module in parameters.fitnesses:
parameters.fitnesses[module].setdefault('use_mpi4py', False)
parameters.fitnesses[module].setdefault('MPMD', 0)
if parameters.fitnesses[module].use_mpi4py:
use_mpi4py = True
parameters.setdefault('mpi', {})
if use_mpi4py:
try:
import mpi4py
except ImportError:
raise ImportError("mpi4py must be installed to use StructOpt.")
mpiexec_path, _ = os.path.split(distutils.spawn.find_executable("mpiexec"))
for executable, path in mpi4py.get_config().items():
if executable not in ['mpicc', 'mpicxx', 'mpif77', 'mpif90', 'mpifort']:
continue
if mpiexec_path not in path:
raise ImportError("mpi4py may not be configured against the same version of 'mpiexec' that you are using. The 'mpiexec' path is {mpiexec_path} and mpi4py.get_config() returns:\n{mpi4py_config}\n".format(mpiexec_path=mpiexec_path, mpi4py_config=mpi4py.get_config()))
from mpi4py import MPI
if 'Open MPI' not in MPI.get_vendor():
raise ImportError("mpi4py must have been installed against Open MPI in order for StructOpt to function correctly.")
vendor_number = ".".join([str(x) for x in MPI.get_vendor()[1]])
if vendor_number not in mpiexec_path:
raise ImportError("The MPI version that mpi4py was compiled against does not match the version of 'mpiexec'. mpi4py's version number is {}, and mpiexec's path is {}".format(MPI.get_vendor(), mpiexec_path))
parameters.mpi.rank = MPI.COMM_WORLD.Get_rank()
parameters.mpi.ncores = MPI.COMM_WORLD.Get_size()
else:
parameters.mpi.rank = 0
parameters.mpi.ncores = 1
return parameters
示例7: testGetEnvelope
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def testGetEnvelope(self):
for dtype in datatypes:
try:
envelope = dtype.Get_envelope()
except NotImplementedError:
return
if ('LAM/MPI' == MPI.get_vendor()[0] and
"COMPLEX" in dtype.name): continue
ni, na, nd, combiner = envelope
self.assertEqual(combiner, MPI.COMBINER_NAMED)
self.assertEqual(ni, 0)
self.assertEqual(na, 0)
self.assertEqual(nd, 0)
示例8: skipMPI
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def skipMPI(predicate, *conditions):
from mpi4py import MPI
def key(s):
s = s.replace(' ', '')
s = s.replace('/', '')
s = s.replace('-', '')
s = s.replace('Microsoft', 'MS')
return s.lower()
vp = VersionPredicate(key(predicate))
if vp.name == 'mpi':
name, version = 'mpi', MPI.Get_version()
version = version + (0,)
else:
name, version = MPI.get_vendor()
if vp.name == key(name):
if vp.satisfied_by('%d.%d.%d' % version):
if not conditions or any(conditions):
return unittest.skip(str(vp))
return unittest.skipIf(False, '')
示例9: testGetEnvelope
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def testGetEnvelope(self):
for dtype in datatypes:
try:
envelope = dtype.Get_envelope()
except NotImplementedError:
self.skipTest('mpi-type-get_envelope')
if ('LAM/MPI' == MPI.get_vendor()[0] and
"COMPLEX" in dtype.name): continue
ni, na, nd, combiner = envelope
self.assertEqual(combiner, MPI.COMBINER_NAMED)
self.assertEqual(ni, 0)
self.assertEqual(na, 0)
self.assertEqual(nd, 0)
self.assertEqual(dtype.envelope, envelope)
self.assertEqual(dtype.combiner, combiner)
self.assertTrue(dtype.is_named)
self.assertTrue(dtype.is_predefined)
otype = dtype.decode()
self.assertTrue(dtype is otype)
示例10: get_intro_string
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def get_intro_string(self):
"""Return the string to append to the end of the relax introduction string.
@return: The string describing this Processor fabric.
@rtype: str
"""
# Get the specific MPI version.
version_info = MPI.Get_version()
# The vendor info.
vendor = MPI.get_vendor()
vendor_name = vendor[0]
vendor_version = str(vendor[1][0])
for i in range(1, len(vendor[1])):
vendor_version = vendor_version + '.%i' % vendor[1][i]
# Return the string.
return "MPI %s.%s running via mpi4py with %i slave processors & 1 master. Using %s %s." % (version_info[0], version_info[1], self.processor_size(), vendor_name, vendor_version)
示例11: testPreallocate
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def testPreallocate(self):
## MPICH2 1.0.x emits a nesting level warning
## when preallocating zero size.
name, ver = MPI.get_vendor()
if not (name == 'MPICH2' and ver < (1,1,0)):
self.FILE.Preallocate(0)
size = self.FILE.Get_size()
self.assertEqual(size, 0)
self.FILE.Preallocate(1)
size = self.FILE.Get_size()
self.assertEqual(size, 1)
self.FILE.Preallocate(100)
size = self.FILE.Get_size()
self.assertEqual(size, 100)
self.FILE.Preallocate(10)
size = self.FILE.Get_size()
self.assertEqual(size, 100)
self.FILE.Preallocate(200)
size = self.FILE.Get_size()
self.assertEqual(size, 200)
示例12: get_watermark
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def get_watermark():
"""
Return information about the current system relevant for pyasdf.
"""
vendor = MPI.get_vendor() if MPI else None
c = h5py.get_config()
if not hasattr(c, "mpi") or not c.mpi:
is_parallel = False
else:
is_parallel = True
watermark = {
"python_implementation": platform.python_implementation(),
"python_version": platform.python_version(),
"python_compiler": platform.python_compiler(),
"platform_system": platform.system(),
"platform_release": platform.release(),
"platform_version": platform.version(),
"platform_machine": platform.machine(),
"platform_processor": platform.processor(),
"platform_processor_count": cpu_count(),
"platform_architecture": platform.architecture()[0],
"platform_hostname": gethostname(),
"date": strftime('%d/%m/%Y'),
"time": strftime('%H:%M:%S'),
"timezone": strftime('%Z'),
"hdf5_version": h5py.version.hdf5_version,
"parallel_h5py": is_parallel,
"mpi_vendor": vendor[0] if vendor else None,
"mpi_vendor_version": ".".join(map(str, vendor[1]))
if vendor else None,
"problematic_multiprocessing": is_multiprocessing_problematic()
}
watermark["module_versions"] = {
module: get_distribution(module).version for module in modules}
if MPI is None:
watermark["module_versions"]["mpi4py"] = None
return watermark
示例13: is_mpd_running
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def is_mpd_running():
name_of_the_vendor, version = MPI.get_vendor()
if name_of_the_vendor == "MPICH2":
must_check_mpd = True
if "AMUSE_MPD_CHECK" in os.environ:
must_check_mpd = os.environ["AMUSE_MPD_CHECK"] == "1"
if "PMI_PORT" in os.environ:
must_check_mpd = False
if "HYDRA_CONTROL_FD" in os.environ:
must_check_mpd = False
if not must_check_mpd:
return True
try:
process = subprocess.Popen(["mpdtrace"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
(output_string, error_string) = process.communicate()
return not (process.returncode == 255)
except OSError as ex:
return True
else:
return True
示例14: ensure_mpd_is_running
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
def ensure_mpd_is_running():
if not is_mpd_running():
name_of_the_vendor, version = MPI.get_vendor()
if name_of_the_vendor == 'MPICH2':
process = subprocess.Popen(['nohup','mpd'], close_fds=True)
示例15:
# 需要导入模块: from mpi4py import MPI [as 别名]
# 或者: from mpi4py.MPI import get_vendor [as 别名]
assert v is win
MPI.Win.Free(v)
self.keyval = MPI.Win.Create_keyval(delete_fn=delete_fn)
self.assertNotEqual(self.keyval, MPI.KEYVAL_INVALID)
#
win = MPI.Win.Create(MPI.BOTTOM, 1,
MPI.INFO_NULL, MPI.COMM_SELF)
self.obj.Set_attr(self.keyval, win)
self.assertTrue(win != null)
self.obj.Delete_attr(self.keyval)
self.assertTrue(win == null)
try:
k = MPI.Datatype.Create_keyval()
k = MPI.Datatype.Free_keyval(k)
except NotImplementedError:
unittest.disable(BaseTestDatatypeAttr, 'mpi-type-attr')
SpectrumMPI = MPI.get_vendor()[0] == 'Spectrum MPI'
try:
if SpectrumMPI: raise NotImplementedError
MPI.Win.Create(MPI.BOTTOM, 1, MPI.INFO_NULL, MPI.COMM_SELF).Free()
k = MPI.Win.Create_keyval()
k = MPI.Win.Free_keyval(k)
except (NotImplementedError, MPI.Exception):
unittest.disable(TestWinAttr, 'mpi-win-attr')
if __name__ == '__main__':
unittest.main()