def Bcast(self, n_send, varij, n_recv): send = Commdomm.darray(n_send) recv = Commdomm.darray(n_recv) for i in range(n_send): send[i] = varij[i] self.CD.__mpi_sendrecv_real__( send, n_send, recv, n_recv, self.lcomm, self.commij); self.CD.__mpi_bcast_real__( recv, n_recv, self.lcomm, self.commij); varji = np.zeros(n_recv) for i in range(n_recv): varji[i] = recv[i] return varji
def ExchangeDouble(self, send, n_dof): n_send = self.n_send * n_dof n_recv = self.n_recv * n_dof var_ij = Commdomm.darray(n_send) var_ji = Commdomm.darray(n_recv) for i in range(n_send): var_ij[i] = send[i] self.CD.__locator_exchange_double_scalar__(var_ij, var_ji, n_dof) recv = np.zeros(n_recv) for i in range(n_recv): recv[i] = var_ji[i] return recv
def SetGeometryJ(self, n_vertices, vertex_coords): self.n_vertices_j = n_vertices self.vertex_coords_j = Commdomm.darray( n_vertices*self.dim ) k = 0 for i in range(n_vertices): for j in range(self.dim): self.vertex_coords_j[k] = vertex_coords[i][j] k += 1
def SetGeometryI(self, n_vertices, vertex_coords, n_elements, n_vertex_type, vertex_num, vertex_type): self.n_elements_i = n_elements self.vertex_num_i = Commdomm.iarray( n_elements*n_vertex_type ) self.vertex_type_i = Commdomm.iarray( n_elements ) k = 0 for i in range(n_elements): self.vertex_type_i[i] = int(vertex_type[i]) for j in range(n_vertex_type): self.vertex_num_i[k] = int(vertex_num[i][j]) k += 1 self.n_vertices_i = n_vertices self.vertex_coords_i = Commdomm.darray( n_vertices*self.dim ) k = 0 for i in range(n_vertices): for j in range(self.dim): self.vertex_coords_i[k] = vertex_coords[i][j] k += 1
def __init__(self, _type, _namei, _namej, _comm, _dim=3): self.dim = _dim self.CD = Commdomm.CommDom() self.CD.init() self.CD.set_app_type( _type ) self.CD.set_app_name( _namei ) self.CD.set_world_comm( _comm ) self.lcomm = self.CD.set_mpi_comms() self.lrank = self.lcomm.Get_rank() self.lsize = self.lcomm.Get_size() self.wcomm = _comm self.wrank = _comm.Get_rank() self.wsize = _comm.Get_size() self.commij = MPI.COMM_NULL if( (self.CD.__get_app_name__() == _namei) and (self.CD.__get_friends__(_namej) == 1) ): self.commij = self.CD.get_mpi_commij(_namej) if( (self.CD.__get_app_name__() == _namej) and (self.CD.__get_friends__(_namei) == 1) ): self.commij = self.CD.get_mpi_commij(_namei) self.lcomm.Barrier()
def GetCoordsJ(self): dist_coords_j = Commdomm.darray( self.n_send*self.dim ) self.CD.__locator_get_dist_coords__( dist_coords_j ) return self.F2C( self.n_send, self.dim, dist_coords_j )
import Commdomm import Loader_alya import Read_file Types = ["COORDINATES", "ELEMENTS", "CHARACTERISTICS"] ## 3d case, coinciding meshes, Temper 3-interaction basenamei = ROOT+"/Tools/Temper/Mesh01/METIS02/xxx_%s%s.alya" filenamej = ROOT+"/Tools/Temper/Mesh02/METIS01/xxx_COORDINATES000.alya" #=================================================================| COMMs |===# app_type = "PYTH" app_name = "MESH01" CD = Commdomm.CommDom() CD.init() CD.set_app_type(app_type); CD.set_app_name(app_name); CD.set_world_comm(world_comm) local_comm = MPI.COMM_NULL local_comm = CD.set_mpi_comms() local_rank = local_comm.Get_rank() local_size = local_comm.Get_size() rank = str( local_rank ).zfill(3) DATA = {} for typei in Types:
#=========================================================================||===# #=========================================================================||===# import Commdomm from mpi4py import MPI #import MPI print(MPI.get_vendor()) # Open MPI all handles are pointers # MPICH2 they are plain 'int'. world_comm = MPI.COMM_WORLD world_rank = world_comm.Get_rank() world_size = world_comm.Get_size() CD = Commdomm.CommDom() CD.init() CD.set_app_type(app_type) CD.set_app_name(app_name) CD.set_world_comm(world_comm) local_comm = MPI.COMM_NULL local_comm = CD.set_mpi_comms() local_comm.Barrier() local_rank = local_comm.Get_rank() val = -1 if (local_rank == 0): val = 69 commij = MPI.COMM_NULL
#=================================================================| Mpi4py |===# from mpi4py import MPI print MPI.get_vendor() world_comm = MPI.COMM_WORLD world_rank = world_comm.Get_rank() world_size = world_comm.Get_size() Datatype = MPI.Datatype #=================================================================| COMMs |===# import Commdomm app_type = "PYTH" app_name = "MESH01" CD = Commdomm.CommDom() CD.init() CD.set_app_type(app_type) CD.set_app_name(app_name) CD.set_world_comm(world_comm) local_comm = MPI.COMM_NULL local_comm = CD.set_mpi_comms() #local_rank = local_comm.Get_rank() #local_size = local_comm.Get_size() print "OK!! \n" #========================================================================||===# #========================================================================||===#
world_comm = MPI.COMM_WORLD world_rank = world_comm.Get_rank() world_size = world_comm.Get_size() #=================================================================| COMMs |===# import Commdomm import Loader_alya import Read_file """ |_cs_syr_coupling.cs_syr_coupling_all_init |_ _init_all_mpi_syr """ app_type = "SYRTHES 4" #"ALYA_CFD" app_name = options.app_name CD = Commdomm.CommDom() CD.init() CD.set_app_type(app_type) CD.set_app_name(app_name) CD.set_world_comm(world_comm) local_comm = MPI.COMM_NULL local_comm = CD.set_mpi_comms() local_rank = local_comm.Get_rank() local_size = local_comm.Get_size() #==================================================================| MESH |===# n_vertices_j = 0 vertex_coords_j = Commdomm.darray(n_vertices_j) n_vertices = 0
world_comm = MPI.COMM_WORLD world_rank = world_comm.Get_rank() world_size = world_comm.Get_size() #=================================================================| COMMs |===# import Commdomm import Loader_alya import Read_file """ |_cs_syr_coupling.cs_syr_coupling_all_init |_ _init_all_mpi_syr """ app_type = "ALYA_CFD" app_name = options.app_name CD = Commdomm.CommDom() CD.init() CD.set_app_type(app_type) CD.set_app_name(app_name) CD.set_world_comm(world_comm) local_comm = MPI.COMM_NULL local_comm = CD.set_mpi_comms() local_rank = local_comm.Get_rank() local_size = local_comm.Get_size() #==================================================================| MESH |===# n_vertices_j = 0 vertex_coords_j = Commdomm.darray(n_vertices_j) n_vertices = 0
#-------------------------------------------------------------------------||---# #=================================================================| Mpi4py |===# from mpi4py import MPI world_comm = MPI.COMM_WORLD world_rank = world_comm.Get_rank() world_size = world_comm.Get_size() #-------------------------------------------------------------------------||---# #==================================================================| COMMs |===# import Commdomm app_type = "SYRTHES 4" app_name = options.app_name CD = Commdomm.CommDom() CD.init() CD.set_app_type(app_type) CD.set_app_name(app_name) CD.set_world_comm(world_comm) local_comm = MPI.COMM_NULL local_comm = CD.set_mpi_comms() local_rank = local_comm.Get_rank() local_size = local_comm.Get_size() #-------------------------------------------------------------------------||---# #===================================================================| MESH |===# #-------------------------------------------------------------------------||---# n_vertices_j = 0