update build process to include paradiseo tutorial,
fix paradiseo headers for sstream
This commit is contained in:
parent
e388461a3b
commit
3cb80bc73b
14 changed files with 139 additions and 68 deletions
|
|
@ -69,4 +69,6 @@ AC_OUTPUT(Makefile \
|
|||
tutorial/Lesson5/Makefile \
|
||||
tutorial/ParadisEO/Makefile \
|
||||
tutorial/ParadisEO/Lesson1/Makefile \
|
||||
tutorial/ParadisEO/Lesson2/Makefile \
|
||||
tutorial/ParadisEO/Lesson3/Makefile \
|
||||
win/Makefile)
|
||||
|
|
|
|||
|
|
@ -25,9 +25,10 @@
|
|||
#ifndef _EOPOP_H
|
||||
#define _EOPOP_H
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iterator> // needed for GCC 3.2
|
||||
#include <vector>
|
||||
|
||||
// EO includes
|
||||
#include <eoOp.h> // for eoInit
|
||||
|
|
|
|||
|
|
@ -24,11 +24,12 @@
|
|||
#ifndef eoListener_h
|
||||
#define eoListener_h
|
||||
|
||||
#include <mpi.h>
|
||||
#include <vector>
|
||||
|
||||
#include <paradisEO/comm/eoLocalListener.h>
|
||||
#include <paradisEO/comm/messages/to/eoPublishMessTo.h>
|
||||
#include <paradisEO/comm/messages/to/eoKillMessTo.h>
|
||||
#include <mpi.h>
|
||||
|
||||
/**
|
||||
Necessary for any use of a distributed model.
|
||||
|
|
|
|||
|
|
@ -24,16 +24,17 @@
|
|||
#ifndef eoLocalListener_h
|
||||
#define eoLocalListener_h
|
||||
|
||||
#include <mpi.h>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <paradisEO/comm/messages/from/eoHeaderMessFrom.h>
|
||||
#include <paradisEO/comm/messages/from/eoEOReceiveMessFrom.h>
|
||||
#include <paradisEO/comm/messages/from/eoEOSendMessFrom.h>
|
||||
#include <paradisEO/comm/messages/from/eoPublishMessFrom.h>
|
||||
#include <paradisEO/comm/messages/from/eoKillMessFrom.h>
|
||||
#include <eoPop.h>
|
||||
#include <mpi.h>
|
||||
#include <unistd.h>
|
||||
|
||||
/**
|
||||
A local listener to pack any coming message or, on contrary, to
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@
|
|||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <mpi.h>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#ifdef HAVE_SSTREAM
|
||||
|
|
@ -35,49 +36,47 @@
|
|||
#else
|
||||
#include <strstream.h>
|
||||
#endif
|
||||
#include <mpi.h>
|
||||
|
||||
#include <paradisEO/comm/messages/eoMessFrom.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
/**
|
||||
A message embeding a set of immigrants ...
|
||||
*/
|
||||
|
||||
template <class EOT> class eoEOSendMessFrom : public eoMessFrom <EOT> {
|
||||
template <class EOT> class eoEOSendMessFrom : public eoMessFrom <EOT>
|
||||
{
|
||||
public:
|
||||
|
||||
public :
|
||||
/**
|
||||
Constructor
|
||||
*/
|
||||
eoEOSendMessFrom (eoLocalListener <EOT> & _loc_listen)
|
||||
: eoMessFrom <EOT> (_loc_listen) {
|
||||
MPI :: Status stat ;
|
||||
comm.Probe (loc_listen.number (), 0, stat) ;
|
||||
int len = stat.Get_count (MPI :: CHAR) ;
|
||||
char buff [len] ;
|
||||
comm.Recv(buff, len, MPI::CHAR, loc_listen.number (), 0) ;
|
||||
#ifdef HAVE_SSTREAM
|
||||
std::istringstream f(buff);
|
||||
#else
|
||||
istrstream f(buff);
|
||||
#endif
|
||||
_pop.readFrom(f);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
Constructor
|
||||
*/
|
||||
void operator() () {
|
||||
loc_listen.push (_pop) ;
|
||||
// std::cout << "Reception de " << pop.size () << "individus " << std::endl ;
|
||||
}
|
||||
|
||||
eoEOSendMessFrom (eoLocalListener <EOT> & _loc_listen) :
|
||||
eoMessFrom <EOT> (_loc_listen) {
|
||||
|
||||
MPI :: Status stat ;
|
||||
comm.Probe (loc_listen.number (), 0, stat) ;
|
||||
int len = stat.Get_count (MPI :: CHAR) ;
|
||||
char buff [len] ;
|
||||
comm.Recv (buff, len, MPI :: CHAR, loc_listen.number (), 0) ;
|
||||
istrstream f (buff) ;
|
||||
pop.readFrom (f) ;
|
||||
|
||||
}
|
||||
|
||||
void operator () () {
|
||||
|
||||
loc_listen.push (pop) ;
|
||||
// std::cout << "Reception de " << pop.size () << "individus " << std::endl ;
|
||||
}
|
||||
protected:
|
||||
|
||||
private :
|
||||
|
||||
eoPop <EOT> pop ; // New immigrants !
|
||||
|
||||
} ;
|
||||
eoPop <EOT> _pop ; // New immigrants !
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -21,49 +21,59 @@
|
|||
Contact: cahon@lifl.fr
|
||||
*/
|
||||
|
||||
/**
|
||||
A message embeding immigrants to send to ...
|
||||
*/
|
||||
|
||||
#ifndef eoEOSendMessTo_h
|
||||
#define eoEOSendMessTo_h
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <mpi.h>
|
||||
#ifdef HAVE_SSTREAM
|
||||
#include <sstream>
|
||||
#else
|
||||
#include <strstream.h>
|
||||
#endif
|
||||
#include <eoPop.h>
|
||||
#include <paradisEO/comm/messages/eoMessTo.h>
|
||||
|
||||
|
||||
/** A message embeding immigrants to send to ... */
|
||||
template <class EOT> class eoEOSendMessTo : public eoMessTo <EOT> {
|
||||
|
||||
public :
|
||||
|
||||
/**
|
||||
Constructor ...
|
||||
*/
|
||||
/**
|
||||
Constructor ...
|
||||
*/
|
||||
|
||||
eoEOSendMessTo (eoPop <EOT> & _pop )
|
||||
: eoMessTo <EOT> ("eoEOSendMessTo"),
|
||||
pop (_pop)
|
||||
{}
|
||||
eoEOSendMessTo (eoPop <EOT> & _pop )
|
||||
: eoMessTo <EOT> ("eoEOSendMessTo"),
|
||||
pop (_pop)
|
||||
{}
|
||||
|
||||
/**
|
||||
To send the given population ...
|
||||
*/
|
||||
void operator () (eoLocalListener <EOT> & loc_listen) {
|
||||
eoMessTo <EOT> :: operator () (loc_listen) ;
|
||||
#ifdef HAVE_SSTREAM
|
||||
std::ostringstream f;
|
||||
pop.printOn(f);
|
||||
comm.Send(f.str().c_str(), f.str().size(), MPI::CHAR, loc_listen.number(), 0);
|
||||
#else
|
||||
std::ostrstream f;
|
||||
pop.printOn (f);
|
||||
comm.Send (f.str(), f.pcount(), MPI::CHAR, loc_listen.number(), 0);
|
||||
#endif
|
||||
loc_listen.need_immigration () = false;
|
||||
}
|
||||
|
||||
/**
|
||||
To send the given population ...
|
||||
*/
|
||||
|
||||
void operator () (eoLocalListener <EOT> & loc_listen) {
|
||||
|
||||
eoMessTo <EOT> :: operator () (loc_listen) ;
|
||||
|
||||
std::ostrstream f ;
|
||||
pop.printOn (f) ;
|
||||
comm.Send (f.str (), f.pcount (), MPI :: CHAR, loc_listen.number (), 0) ;
|
||||
loc_listen.need_immigration () = false ;
|
||||
}
|
||||
|
||||
private :
|
||||
|
||||
eoPop <EOT> & pop ; // The set of EO to send.
|
||||
protected:
|
||||
|
||||
eoPop <EOT> & pop ; // The set of EO to send.
|
||||
} ;
|
||||
|
||||
#endif
|
||||
|
|
|
|||
1
eo/tutorial/ParadisEO/Lesson2/.cvsignore
Normal file
1
eo/tutorial/ParadisEO/Lesson2/.cvsignore
Normal file
|
|
@ -0,0 +1 @@
|
|||
Makefile.in
|
||||
17
eo/tutorial/ParadisEO/Lesson2/Makefile.am
Normal file
17
eo/tutorial/ParadisEO/Lesson2/Makefile.am
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
noinst_PROGRAMS = MasterDistEvalBitEA SlaveDistEvalBitEA
|
||||
|
||||
LIBEO = $(top_builddir)/src/libeo.a
|
||||
LIBEOUTILS = $(top_builddir)/src/utils/libeoutils.a
|
||||
|
||||
CXX = $(MPICXX)
|
||||
LD = $(MPICXX)
|
||||
AM_CXXFLAGS = -I$(top_srcdir)/src
|
||||
DEPS = $(LIBEOUTILS) $(LIBEO)
|
||||
LIBS = $(LIBEOUTILS) $(LIBEO)
|
||||
|
||||
|
||||
noinst_HEADERS = binary_value.h
|
||||
|
||||
MasterDistEvalBitEA_SOURCES = MasterDistEvalBitEA.cpp
|
||||
|
||||
SlaveDistEvalBitEA_SOURCES = SlaveDistEvalBitEA.cpp
|
||||
|
|
@ -1,6 +1,13 @@
|
|||
#include <stdexcept>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#ifdef HAVE_SSTREAM
|
||||
#include <sstream>
|
||||
#else
|
||||
#include <strstream>
|
||||
#endif
|
||||
|
||||
#include <paradiseo.h>
|
||||
#include <ga.h>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <stdexcept> // runtime_error
|
||||
#include <iostream> // cout
|
||||
#include <strstream> // ostrstream, istrstream
|
||||
#ifdef HAVE_SSTREAM
|
||||
#include <sstream>
|
||||
#else
|
||||
#include <strstream>
|
||||
#endif
|
||||
|
||||
#include <paradiseo.h>
|
||||
#include <ga.h>
|
||||
|
|
|
|||
1
eo/tutorial/ParadisEO/Lesson3/.cvsignore
Normal file
1
eo/tutorial/ParadisEO/Lesson3/.cvsignore
Normal file
|
|
@ -0,0 +1 @@
|
|||
Makefile.in
|
||||
|
|
@ -1,6 +1,14 @@
|
|||
#include <stdexcept>
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <stdexcept> // runtime_error
|
||||
#ifdef HAVE_SSTREAM
|
||||
#include <sstream>
|
||||
#else
|
||||
#include <strstream>
|
||||
#endif
|
||||
|
||||
#include <eo>
|
||||
#include <ga.h>
|
||||
|
|
|
|||
15
eo/tutorial/ParadisEO/Lesson3/Makefile.am
Normal file
15
eo/tutorial/ParadisEO/Lesson3/Makefile.am
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
noinst_PROGRAMS = CellularBitEA
|
||||
|
||||
LIBEO = $(top_builddir)/src/libeo.a
|
||||
LIBEOUTILS = $(top_builddir)/src/utils/libeoutils.a
|
||||
|
||||
CXX = $(MPICXX)
|
||||
LD = $(MPICXX)
|
||||
AM_CXXFLAGS = -I$(top_srcdir)/src
|
||||
DEPS = $(LIBEOUTILS) $(LIBEO)
|
||||
LIBS = $(LIBEOUTILS) $(LIBEO)
|
||||
|
||||
|
||||
noinst_HEADERS = binary_value.h
|
||||
|
||||
CellularBitEA_SOURCES = CellularBitEA.cpp
|
||||
|
|
@ -1 +1 @@
|
|||
SUBDIRS = Lesson1
|
||||
SUBDIRS = Lesson1 Lesson2 Lesson3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue