Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import sys
- try:
- from ctypes import CDLL, pythonapi, c_int, POINTER, c_char_p, byref, RTLD_GLOBAL
- from ctypes.util import find_library
- except ImportError:
- print 'ERROR! La libreria *ctypes* para Python no esta disponible!'
- sys.exit(-1)
- libc = CDLL('libc.so.6')
- print libc._handle, libc._name
- f = pythonapi.Py_GetArgcArgv
- argc = c_int()
- argv = POINTER(c_char_p)()
- f(byref(argc), byref(argv))
- mpi = CDLL(find_library('mpi'), RTLD_GLOBAL)
- print mpi._handle, mpi._name
- myrank = c_int();
- nprocs = c_int();
- opt_flag = c_int.in_dll(pythonapi, "MPI_COMM_WORLD") # Aqui falla al acceder a MPI_COMM_WORLD
- #mpi.MPI_Comm_size(mpi.MPI_COMM_WORLD, byref(nprocs)); # Lo necesito aqui, pero no funciona MPI_COMM_WORLD
- libc.printf("Hello from processor %d of %d\n", myrank, nprocs);
- mpi.MPI_Finalize()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement