source: python/example_mpi.py @ 1ef52ae

Revision 1ef52ae, 371 bytes checked in by Thomas Uram <turam@…>, 5 years ago (diff)

add mpi example

  • Property mode set to 100644
Line 
1import sys
2import genericio as g
3import mpi4py.MPI as MPI
4import ctypes
5if MPI._sizeof(MPI.Comm) == ctypes.sizeof(ctypes.c_int):
6    MPI_Comm = ctypes.c_int
7else:
8    MPI_Comm = ctypes.c_void_p
9comm=MPI.COMM_WORLD
10comm_ptr = MPI._addressof(comm)
11comm_val = MPI_Comm.from_address(comm_ptr)
12x = g.read(comm_val,sys.argv[1],'fof_halo_count fof_halo_mass'.split())
13print(x)
14
Note: See TracBrowser for help on using the repository browser.