コード例 #1
0
ファイル: split.py プロジェクト: noushi/pyccel
from pyccel.stdlib.internal.mpi import mpi_bcast
from pyccel.stdlib.internal.mpi import MPI_INTEGER8

import numpy as np

# we need to declare these variables somehow,
# since we are calling mpi subroutines
ierr = np.int32(-1)
size = np.int32(-1)
rank_in_world = np.int32(-1)

mpi_init(ierr)

comm = mpi_comm_world
mpi_comm_size(comm, size, ierr)
mpi_comm_rank(comm, rank_in_world, ierr)

master = np.int32(0)
m = np.int32(8)

a = np.zeros(m, 'int')

if rank_in_world == 1:
    a[:] = 1
if rank_in_world == 2:
    a[:] = 2

key = rank_in_world
if rank_in_world == 1:
    key = np.int32(-1)
if rank_in_world == 2:
コード例 #2
0
ファイル: point_to_point_2.py プロジェクト: noushi/pyccel
from pyccel.stdlib.internal.mpi import mpi_recv
from pyccel.stdlib.internal.mpi import MPI_REAL8

import numpy as np

# we need to declare these variables somehow,
# since we are calling mpi subroutines
ierr = np.int32(-1)
size = np.int32(-1)
rank = np.int32(-1)

mpi_init(ierr)

comm = mpi_comm_world
mpi_comm_size(comm, size, ierr)
mpi_comm_rank(comm, rank, ierr)

nx = np.int32(4)
ny = np.int32(3 * 2)
x = np.zeros(nx)
y = np.zeros((3, 2))

if rank == 0:
    x[:] = 1.0
    y[:, :] = 1.0

source = np.int32(0)
dest = np.int32(1)
status = np.zeros(mpi_status_size, 'int32')

# ...
コード例 #3
0
ファイル: mpiext.py プロジェクト: noushi/pyccel
def mpiext_get_rank(comm):
    rank = int32(-1)
    ierr = int32(-1)
    mpi_comm_rank(comm, rank, ierr)
    return int(rank)