from mpi4py import MPI from cplpy.cpl import CPL import numpy as np #lib.set("output_mode", 0) CPL = CPL() nsteps = 1 dt = 0.2 # Parameters of the cpu topology (cartesian grid) NPx = 3 NPy = 3 NPz = 3 NProcs = NPx * NPy * NPz # Parameters of the mesh topology (cartesian grid) ncxyz = np.array([18, 18, 18], order='F', dtype=np.int32) xyzL = np.array([10.0, 10.0, 10.0], order='F', dtype=np.float64) xyz_orig = np.array([0.0, 0.0, 0.0], order='F', dtype=np.float64) # Create communicators and check that number of processors is consistent realm_comm = CPL.create_comm(CPL.CFD_REALM) nprocs_realm = realm_comm.Get_size() if (nprocs_realm != NProcs): print "ERROR: Non-coherent number of processors." MPI.Abort(errorcode=1) cart_comm = realm_comm.Create_cart([NPx, NPy, NPz]) CPL.cfd_init2(nsteps, dt, cart_comm, xyzL, xyz_orig, ncxyz, 1.0) ols = CPL.get_olap_limits()
from __future__ import print_function, division from mpi4py import MPI from cplpy.cpl import CPL import numpy as np import cPickle import sys lib = CPL() lib.set("output_mode", 1) # Load parameters for the run params = cPickle.load(open("cfd_params.dic", "rb")) # Parameters of the cpu topology (cartesian grid) try: NPx = params["npx"] NPy = params["npy"] NPz = params["npz"] except: print("ERROR: ", sys.exc_info()[0], file=sys.stderr) MPI.Abort() # Parameters of the mesh topology (cartesian grid) try: NCx = params["ncx"] NCy = params["ncy"] NCz = params["ncz"] except:
CPL = CPL() nsteps = 1 dt = 0.2 # Parameters of the cpu topology (cartesian grid) NPx = 3 NPy = 3 NPz = 3 NProcs = NPx*NPy*NPz # Parameters of the mesh topology (cartesian grid) ncxyz = np.array([18, 18, 18], order='F', dtype=np.int32) xyzL = np.array([10.0, 10.0, 10.0], order='F', dtype=np.float64) xyz_orig = np.array([0.0, 0.0, 0.0], order='F', dtype=np.float64) # Create communicators and check that number of processors is consistent realm_comm = CPL.create_comm(CPL.CFD_REALM) nprocs_realm = realm_comm.Get_size() if (nprocs_realm != NProcs): print "ERROR: Non-coherent number of processors." MPI.Abort(errorcode=1) cart_comm = realm_comm.Create_cart([NPx, NPy, NPz]) CPL.cfd_init2(nsteps, dt, cart_comm, xyzL, xyz_orig, ncxyz, 1.0) ols = CPL.get_olap_limits() my_coords = cart_comm.Get_coords(cart_comm.Get_rank()) my_coords = np.array(my_coords, order='F', dtype=np.int32) """ #if (True):
from mpi4py import MPI from cplpy.cpl import CPL import numpy as np comm = MPI.COMM_WORLD CPL = CPL() #lib.set("output_mode", 0) dt = 0.1 # Parameters of the cpu topology (cartesian grid) NPx = 3 NPy = 3 NPz = 3 NProcs = NPx * NPy * NPz npxyz = np.array([NPx, NPy, NPz], order='F', dtype=np.int32) # Domain topology xyzL = np.array([10.0, 10.0, 10.0], order='F', dtype=np.float64) xyz_orig = np.array([0.0, 0.0, 0.0], order='F', dtype=np.float64) # Create communicators and check that number of processors is consistent realm_comm = CPL.create_comm(CPL.MD_REALM) nprocs_realm = realm_comm.Get_size() if (nprocs_realm != NProcs): print "Non-coherent number of processes" MPI.Abort(errorcode=1) cart_comm = realm_comm.Create_cart([NPx, NPy, NPz])
dt = 0.1 # Parameters of the cpu topology (cartesian grid) NPx = 3 NPy = 3 NPz = 3 NProcs = NPx*NPy*NPz npxyz = np.array([NPx, NPy, NPz], order='F', dtype=np.int32) # Domain topology xyzL = np.array([10.0, 10.0, 10.0], order='F', dtype=np.float64) xyz_orig = np.array([0.0, 0.0, 0.0], order='F', dtype=np.float64) # Create communicators and check that number of processors is consistent realm_comm = CPL.create_comm(CPL.MD_REALM) nprocs_realm = realm_comm.Get_size() if (nprocs_realm != NProcs): print "Non-coherent number of processes" MPI.Abort(errorcode=1) cart_comm = realm_comm.Create_cart([NPx, NPy, NPz]) nsteps, initialstep = CPL.md_init2(dt, cart_comm, xyzL, xyz_orig, 1.0) """ # Scatter a 3 component array (MD processes are the receivers) my_coords = cart_comm.Get_coords(cart_comm.Get_rank()) my_coords = np.array(my_coords, order='F', dtype=np.int32) #@my_coords += 1# Fortran indices olap_limits = get_olap_limits(lib)