]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpi/test/python/all_to_all_test.py
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / mpi / test / python / all_to_all_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_to_all() collective.
8
9 import boost.parallel.mpi as mpi
10 from generators import *
11
12 def all_to_all_test(comm, generator, kind):
13 if comm.rank == 0:
14 print ("All-to-all transmission of %s..." % (kind,)),
15
16 values = list()
17 for p in range(0, comm.size):
18 values.append(generator(p))
19 result = mpi.all_to_all(comm, values)
20
21 for p in range(0, comm.size):
22 assert result[p] == generator(comm.rank)
23
24 if comm.rank == 0: print "OK."
25 return
26
27 all_to_all_test(mpi.world, int_generator, "integers")
28 all_to_all_test(mpi.world, gps_generator, "GPS positions")
29 all_to_all_test(mpi.world, string_generator, "strings")
30 all_to_all_test(mpi.world, string_list_generator, "list of strings")