|
From: <den...@us...> - 2009-12-28 01:33:40
|
Revision: 23
http://dsim.svn.sourceforge.net/dsim/?rev=23&view=rev
Author: denis_arnaud
Date: 2009-12-28 00:16:49 +0000 (Mon, 28 Dec 2009)
Log Message:
-----------
[Test] Added Boost.MPI tutorial simple examples.
Modified Paths:
--------------
trunk/dsim/test/boost/mpi/Makefile.am
trunk/dsim/test/boost/mpi/mpi.cpp
Added Paths:
-----------
trunk/dsim/test/boost/mpi/mpi_p2p.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
+ .deps
.libs
Makefile.in
Makefile
mpi_c
mpi
mpi_p2p
Modified: trunk/dsim/test/boost/mpi/Makefile.am
===================================================================
--- trunk/dsim/test/boost/mpi/Makefile.am 2009-12-26 01:46:01 UTC (rev 22)
+++ trunk/dsim/test/boost/mpi/Makefile.am 2009-12-28 00:16:49 UTC (rev 23)
@@ -3,7 +3,7 @@
MAINTAINERCLEANFILES = Makefile.in
-check_PROGRAMS = mpi_c mpi
+check_PROGRAMS = mpi_c mpi mpi_p2p
# mpi_c must be compiled with mpic++
# Note: mpic++/mpiCC is a wrapper around the MPI C++ compiler, and knows
@@ -17,4 +17,9 @@
mpi_LDFLAGS = $(BOOST_LIBS) $(BOOST_MPI_LIB)
mpi_LDADD =
+mpi_p2p_SOURCES = mpi_p2p.cpp
+mpi_p2p_CXXFLAGS = $(BOOST_CFLAGS) $(MPICH2_CFLAGS)
+mpi_p2p_LDFLAGS = $(BOOST_LIBS) $(BOOST_MPI_LIB)
+mpi_p2p_LDADD =
+
EXTRA_DIST =
Modified: trunk/dsim/test/boost/mpi/mpi.cpp
===================================================================
--- trunk/dsim/test/boost/mpi/mpi.cpp 2009-12-26 01:46:01 UTC (rev 22)
+++ trunk/dsim/test/boost/mpi/mpi.cpp 2009-12-28 00:16:49 UTC (rev 23)
@@ -7,14 +7,14 @@
#include <boost/mpi/environment.hpp>
#include <boost/mpi/communicator.hpp>
-// /////////// M A I N ////////////////
+
+// ///////////////////////// M A I N ///////////////////////////
int main (int argc, char* argv[]) {
- // boost::mpi::environment env (argc, argv);
- // boost::mpi::communicator world;
- //std::cout << "I am process " << world.rank() << " of " << world.size()
- // << "." << std::endl;
- std::cout << "OpenMPI should run, but not Boost.MPI yet" << std::endl;
+ boost::mpi::environment env (argc, argv);
+ boost::mpi::communicator world;
+ std::cout << "I am process " << world.rank() << " of " << world.size()
+ << "." << std::endl;
return 0;
}
Added: trunk/dsim/test/boost/mpi/mpi_p2p.cpp
===================================================================
--- trunk/dsim/test/boost/mpi/mpi_p2p.cpp (rev 0)
+++ trunk/dsim/test/boost/mpi/mpi_p2p.cpp 2009-12-28 00:16:49 UTC (rev 23)
@@ -0,0 +1,33 @@
+// 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) {
+ world.send (1, 0, std::string("Hello"));
+
+ std::string msg;
+ world.recv(1, 1, msg);
+
+ std::cout << msg << "!" << std::endl;
+
+ } else {
+ std::string msg;
+ world.recv (0, 0, msg);
+
+ std::cout << msg << ", ";
+ std::cout.flush();
+
+ world.send (0, 1, std::string ("world"));
+ }
+
+ return 0;
+}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|