]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpi/test/python/all_gather_test.py
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / mpi / test / python / all_gather_test.py
1 # Copyright (C) 2006 Douglas Gregor <doug.gregor -at- gmail.com>.
2
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)
6
7 # Test all_gather() collective.
8
9 import boost.parallel.mpi as mpi
10 from generators import *
11
12 def all_gather_test(comm, generator, kind):
13 if comm.rank == 0: print ("Gathering %s..." % (kind,)),
14 my_value = generator(comm.rank)
15 result = mpi.all_gather(comm, my_value)
16 for p in range(0, comm.size):
17 assert result[p] == generator(p)
18 if comm.rank == 0: print "OK."
19
20 return
21
22 all_gather_test(mpi.world, int_generator, "integers")
23 all_gather_test(mpi.world, gps_generator, "GPS positions")
24 all_gather_test(mpi.world, string_generator, "strings")
25 all_gather_test(mpi.world, string_list_generator, "list of strings")