import numpy as np
import cppimport
dummy_work1 = cppimport.imp("dummy_work1")

from mpi4py import MPI
comm = MPI.COMM_WORLD
comm.Barrier()
time0 = MPI.Wtime()
size = comm.Get_size()
rank = comm.Get_rank()

N = 7000
N_part = N // size

if rank == 0:
    np.random.seed(123)
    array1 = np.random.rand(2 * N, N)
    array2 = np.random.rand(2 * N, N)
else:
    array1 = None
    array2 = None
    
array1_part = np.empty((2 * N_part, N))
array2_part = np.empty((2 * N_part, N))

comm.Scatter(array1, array1_part, root=0)
comm.Scatter(array2, array2_part, root=0)

prod = np.empty(1)
prod_part = np.array(dummy_work1.scalar_prod(array1_part, array2_part))

comm.Reduce(prod_part, prod, root=0)

if rank == 0:
    print(prod[0])
61b47a2e91fd1c6d0e9a6c2db70c72c394e8682b
<mask token>

<mask token>
comm.Barrier()
<mask token>
if rank == 0:
    np.random.seed(123)
    array1 = np.random.rand(2 * N, N)
    array2 = np.random.rand(2 * N, N)
else:
    array1 = None
    array2 = None
<mask token>
comm.Scatter(array1, array1_part, root=0)
comm.Scatter(array2, array2_part, root=0)
<mask token>
comm.Reduce(prod_part, prod, root=0)
if rank == 0:
    print(prod[0])

<mask token>
dummy_work1 = cppimport.imp('dummy_work1')
<mask token>
comm = MPI.COMM_WORLD
comm.Barrier()
time0 = MPI.Wtime()
size = comm.Get_size()
rank = comm.Get_rank()
N = 7000
N_part = N // size
if rank == 0:
    np.random.seed(123)
    array1 = np.random.rand(2 * N, N)
    array2 = np.random.rand(2 * N, N)
else:
    array1 = None
    array2 = None
array1_part = np.empty((2 * N_part, N))
array2_part = np.empty((2 * N_part, N))
comm.Scatter(array1, array1_part, root=0)
comm.Scatter(array2, array2_part, root=0)
prod = np.empty(1)
prod_part = np.array(dummy_work1.scalar_prod(array1_part, array2_part))
comm.Reduce(prod_part, prod, root=0)
if rank == 0:
    print(prod[0])

import numpy as np
import cppimport
dummy_work1 = cppimport.imp('dummy_work1')
from mpi4py import MPI
comm = MPI.COMM_WORLD
comm.Barrier()
time0 = MPI.Wtime()
size = comm.Get_size()
rank = comm.Get_rank()
N = 7000
N_part = N // size
if rank == 0:
    np.random.seed(123)
    array1 = np.random.rand(2 * N, N)
    array2 = np.random.rand(2 * N, N)
else:
    array1 = None
    array2 = None
array1_part = np.empty((2 * N_part, N))
array2_part = np.empty((2 * N_part, N))
comm.Scatter(array1, array1_part, root=0)
comm.Scatter(array2, array2_part, root=0)
prod = np.empty(1)
prod_part = np.array(dummy_work1.scalar_prod(array1_part, array2_part))
comm.Reduce(prod_part, prod, root=0)
if rank == 0:
    print(prod[0])

import numpy as np
import cppimport
dummy_work1 = cppimport.imp("dummy_work1")

from mpi4py import MPI
comm = MPI.COMM_WORLD
comm.Barrier()
time0 = MPI.Wtime()
size = comm.Get_size()
rank = comm.Get_rank()

N = 7000
N_part = N // size

if rank == 0:
    np.random.seed(123)
    array1 = np.random.rand(2 * N, N)
    array2 = np.random.rand(2 * N, N)
else:
    array1 = None
    array2 = None
    
array1_part = np.empty((2 * N_part, N))
array2_part = np.empty((2 * N_part, N))

comm.Scatter(array1, array1_part, root=0)
comm.Scatter(array2, array2_part, root=0)

prod = np.empty(1)
prod_part = np.array(dummy_work1.scalar_prod(array1_part, array2_part))

comm.Reduce(prod_part, prod, root=0)

if rank == 0:
    print(prod[0])