]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpi/test/python/scatter_test.py
1 # Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.com>.
3 # Use, modification and distribution is subject to the Boost Software
4 # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
5 # http://www.boost.org/LICENSE_1_0.txt)
7 # Test scatter() collective.
9 from __future__
import print_function
11 from generators
import *
13 def scatter_test(comm
, generator
, kind
, root
):
15 print ("Scattering %s from root %d..." % (kind
, root
)),
19 for p
in range(0, comm
.size
):
20 values
.append(generator(p
))
21 result
= mpi
.scatter(comm
, values
, root
= root
)
23 result
= mpi
.scatter(comm
, root
= root
);
25 assert result
== generator(comm
.rank
)
27 if comm
.rank
== root
: print ("OK.")
30 scatter_test(mpi
.world
, int_generator
, "integers", 0)
31 scatter_test(mpi
.world
, int_generator
, "integers", 1)
32 scatter_test(mpi
.world
, gps_generator
, "GPS positions", 0)
33 scatter_test(mpi
.world
, gps_generator
, "GPS positions", 1)
34 scatter_test(mpi
.world
, string_generator
, "strings", 0)
35 scatter_test(mpi
.world
, string_generator
, "strings", 1)
36 scatter_test(mpi
.world
, string_list_generator
, "list of strings", 0)
37 scatter_test(mpi
.world
, string_list_generator
, "list of strings", 1)