|
From: <den...@us...> - 2010-01-03 17:04:44
|
Revision: 44
http://dsim.svn.sourceforge.net/dsim/?rev=44&view=rev
Author: denis_arnaud
Date: 2010-01-03 17:04:17 +0000 (Sun, 03 Jan 2010)
Log Message:
-----------
[Test] Added a Boost.MPI tutorial sample (asynchronous P2P communication).
Modified Paths:
--------------
trunk/dsim/test/boost/mpi/Makefile.am
Added Paths:
-----------
trunk/dsim/test/boost/mpi/mpi_p2p_nb.cpp
Property Changed:
----------------
trunk/dsim/test/boost/mpi/
Property changes on: trunk/dsim/test/boost/mpi
___________________________________________________________________
Modified: svn:ignore
- .deps
.libs
Makefile.in
Makefile
mpi_c
mpi
mpi_p2p
+ .deps
.libs
Makefile.in
Makefile
mpi_c
mpi
mpi_p2p
mpi_p2p_nb
Modified: trunk/dsim/test/boost/mpi/Makefile.am
===================================================================
--- trunk/dsim/test/boost/mpi/Makefile.am 2010-01-01 18:55:18 UTC (rev 43)
+++ trunk/dsim/test/boost/mpi/Makefile.am 2010-01-03 17:04:17 UTC (rev 44)
@@ -9,7 +9,7 @@
EXTRA_DIST = pympi.py
#
-check_PROGRAMS = mpi_c mpi mpi_p2p
+check_PROGRAMS = mpi_c mpi mpi_p2p mpi_p2p_nb
# mpi_c must be compiled with mpic++
@@ -31,3 +31,8 @@
mpi_p2p_LDFLAGS = $(BOOST_LIBS) $(BOOST_MPI_LIB)
mpi_p2p_LDADD =
+mpi_p2p_nb_SOURCES = mpi_p2p_nb.cpp
+mpi_p2p_nb_CXXFLAGS = $(BOOST_CFLAGS) $(MPICH2_CFLAGS)
+mpi_p2p_nb_LDFLAGS = $(BOOST_LIBS) $(BOOST_MPI_LIB)
+mpi_p2p_nb_LDADD =
+
Added: trunk/dsim/test/boost/mpi/mpi_p2p_nb.cpp
===================================================================
--- trunk/dsim/test/boost/mpi/mpi_p2p_nb.cpp (rev 0)
+++ trunk/dsim/test/boost/mpi/mpi_p2p_nb.cpp 2010-01-03 17:04:17 UTC (rev 44)
@@ -0,0 +1,37 @@
+// STL
+#include <iostream>
+#include <string>
+// Boost.MPI
+#include <boost/mpi.hpp>
+#include <boost/serialization/string.hpp>
+
+
+// ///////////////////////// M A I N ///////////////////////////
+int main (int argc, char* argv[]) {
+ boost::mpi::environment env (argc, argv);
+ boost::mpi::communicator world;
+
+ if (world.rank() == 0) {
+ boost::mpi::request reqs[2];
+ std::string msg;
+ const std::string outMsg = "Hello";
+ reqs[0] = world.isend (1, 0, outMsg);
+ reqs[1] = world.irecv (1, 1, msg);
+ boost::mpi::wait_all (reqs, reqs+2);
+
+ std::cout << msg << "!" << std::endl;
+
+ } else {
+ boost::mpi::request reqs[2];
+ std::string msg;
+ const std::string outMsg = "world";
+ reqs[0] = world.irecv (0, 0, msg);
+ reqs[1] = world.isend (0, 1, outMsg);
+ boost::mpi::wait_all (reqs, reqs+2);
+
+ std::cout << msg << ", ";
+ // std::cout.flush();
+ }
+
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|