~ubuntu-branches/ubuntu/raring/rheolef/raring-proposed

« back to all changes in this revision

Viewing changes to skit/ptst2/mpi_boost_nonblocking_idxset_tst.cc

  • Committer: Package Import Robot
  • Author(s): Pierre Saramito, Pierre Saramito, Sylvestre Ledru
  • Date: 2012-05-14 14:02:09 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120514140209-dzbdlidkotyflf9e
Tags: 6.1-1
[ Pierre Saramito ]
* New upstream release 6.1 (minor changes):
  - support arbitrarily polynomial order Pk
  - source code supports g++-4.7 (closes: #671996)

[ Sylvestre Ledru ]
* update of the watch file

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
using namespace rheolef;
30
30
int main(int argc, char** argv) {
31
31
  mpi::environment rheolef(argc, argv);
32
 
  mpi::communicator world;
33
 
  if (world.rank() == 0) {
 
32
  mpi::communicator comm;
 
33
  check_macro (comm.size() == 2, "expect np=2");
 
34
  index_set msg;
 
35
  if (comm.rank() == 0) {
34
36
    mpi::request reqs[2];
35
 
    index_set msg;
36
37
    index_set out_msg;
37
38
    out_msg += 100;
38
39
    out_msg += 200;
39
 
    reqs[0] = world.isend(1, 0, out_msg);
40
 
    reqs[1] = world.irecv(1, 1, msg);
 
40
    reqs[0] = comm.isend(1, 0, out_msg);
 
41
    reqs[1] = comm.irecv(1, 1, msg);
41
42
    mpi::wait_all(reqs, reqs + 2);
42
 
    std::cout << "proc 0 : " << msg << std::endl;
43
43
  } else {
44
44
    mpi::request reqs[2];
45
 
    index_set msg;
46
45
    index_set out_msg;
47
46
    out_msg += 101;
48
47
    out_msg += 201;
49
 
    reqs[0] = world.isend(0, 1, out_msg);
50
 
    reqs[1] = world.irecv(0, 0, msg);
 
48
    reqs[0] = comm.isend(0, 1, out_msg);
 
49
    reqs[1] = comm.irecv(0, 0, msg);
51
50
    mpi::wait_all(reqs, reqs + 2);
52
 
    std::cout << "proc 1 : " << msg << std::endl;
53
51
  }
54
 
  return 0;
 
52
  std::string filename = "mpi_boost_nonblocking_idxset_tst-" + itos(comm.rank());
 
53
  std::ofstream out (filename.c_str());
 
54
  out << "proc " << comm.rank() << ": " << msg << std::endl;
55
55
}
56
56
#endif // _RHEOLEF_HAVE_MPI