本文整理匯總了Python中mpi4py.MPI.FLOAT屬性的典型用法代碼示例。如果您正苦於以下問題:Python MPI.FLOAT屬性的具體用法?Python MPI.FLOAT怎麽用?Python MPI.FLOAT使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類mpi4py.MPI
的用法示例。
在下文中一共展示了MPI.FLOAT屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: get_array_buffer
# 需要導入模塊: from mpi4py import MPI [as 別名]
# 或者: from mpi4py.MPI import FLOAT [as 別名]
def get_array_buffer(vs, arr):
from mpi4py import MPI
MPI_TYPE_MAP = {
'int8': MPI.CHAR,
'int16': MPI.SHORT,
'int32': MPI.INT,
'int64': MPI.LONG,
'int128': MPI.LONG_LONG,
'float32': MPI.FLOAT,
'float64': MPI.DOUBLE,
'bool': MPI.BOOL,
}
if rs.backend == 'bohrium':
if np.check(arr):
buf = np.interop_numpy.get_array(arr)
else:
buf = arr
else:
buf = arr
return [buf, arr.size, MPI_TYPE_MAP[str(arr.dtype)]]
示例2: numpy_to_MPI_typemap
# 需要導入模塊: from mpi4py import MPI [as 別名]
# 或者: from mpi4py.MPI import FLOAT [as 別名]
def numpy_to_MPI_typemap(np_type):
from mpi4py import MPI
typemap = {
np.dtype(np.float64) : MPI.DOUBLE,
np.dtype(np.float32) : MPI.FLOAT,
np.dtype(np.int) : MPI.INT,
np.dtype(np.int8) : MPI.CHAR,
np.dtype(np.uint8) : MPI.UNSIGNED_CHAR,
np.dtype(np.int32) : MPI.INT,
np.dtype(np.uint32) : MPI.UNSIGNED_INT,
}
return typemap[np_type]
示例3: do_sendrecv
# 需要導入模塊: from mpi4py import MPI [as 別名]
# 或者: from mpi4py.MPI import FLOAT [as 別名]
def do_sendrecv(comm, glist, wlist, dest):
for gs, ws in zip(glist, wlist):
g = gs.container.value
w = ws.container.value
g.sync()
w.sync()
comm.Sendrecv(sendbuf=[bufint(g), MPI.FLOAT], dest=dest,
recvbuf=[bufint(w), MPI.FLOAT], source=dest)
示例4: test_dtype_to_mpi
# 需要導入模塊: from mpi4py import MPI [as 別名]
# 或者: from mpi4py.MPI import FLOAT [as 別名]
def test_dtype_to_mpi(self):
reload(util)
assert util.dtype_to_mpi(np.dtype('bool')) == MPI.C_BOOL
assert util.dtype_to_mpi(np.dtype('int8')) == MPI.INT8_T
assert util.dtype_to_mpi(np.dtype('uint8')) == MPI.UINT8_T
assert util.dtype_to_mpi(np.dtype('int16')) == MPI.INT16_T
assert util.dtype_to_mpi(np.dtype('uint16')) == MPI.UINT16_T
assert util.dtype_to_mpi(np.dtype('int32')) == MPI.INT32_T
assert util.dtype_to_mpi(np.dtype('uint32')) == MPI.UINT32_T
assert util.dtype_to_mpi(np.dtype('int64')) == MPI.INT64_T
assert util.dtype_to_mpi(np.dtype('uint64')) == MPI.UINT64_T
assert util.dtype_to_mpi(np.dtype('float32')) == MPI.FLOAT
assert util.dtype_to_mpi(np.dtype('float64')) == MPI.DOUBLE
assert util.dtype_to_mpi(np.dtype('complex64')) == MPI.C_FLOAT_COMPLEX
assert util.dtype_to_mpi(np.dtype('complex128')) == MPI.C_DOUBLE_COMPLEX