]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/mpi/test/python/all_to_all_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 all_to_all() collective.
9 import boost
.parallel
.mpi
as mpi
10 from generators
import *
12 def all_to_all_test(comm
, generator
, kind
):
14 print ("All-to-all transmission of %s..." % (kind
,)),
17 for p
in range(0, comm
.size
):
18 values
.append(generator(p
))
19 result
= mpi
.all_to_all(comm
, values
)
21 for p
in range(0, comm
.size
):
22 assert result
[p
] == generator(comm
.rank
)
24 if comm
.rank
== 0: print "OK."
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")