git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@810 331e1502-861f-0410-8da2-ba01fb791d7f

This commit is contained in:
atantar 2007-11-23 16:41:23 +00:00
commit 7526792805
49 changed files with 449 additions and 420 deletions

View file

@ -46,6 +46,7 @@ static std :: map <const Communicable *, unsigned> comm_to_key; /* Map of regist
unsigned Communicable :: num_comm = 0; unsigned Communicable :: num_comm = 0;
Communicable :: Communicable () { Communicable :: Communicable () {
comm_to_key [this] = key = ++ num_comm; comm_to_key [this] = key = ++ num_comm;

View file

@ -75,6 +75,4 @@ extern void initCommunicableEnv ();
extern Communicable * getCommunicable (COMM_ID __key); extern Communicable * getCommunicable (COMM_ID __key);
//extern COMM_ID getKey (const Communicable * __comm);
#endif #endif

View file

@ -44,7 +44,14 @@
template <class F, class T> void pack (const eoVector <F, T> & __v) { template <class F, class T> void pack (const eoVector <F, T> & __v) {
pack (__v.fitness ()) ; if (__v.invalid()) {
pack((unsigned)0);
}
else {
pack((unsigned)1);
pack (__v.fitness ());
}
unsigned len = __v.size (); unsigned len = __v.size ();
pack (len); pack (len);
for (unsigned i = 0 ; i < len; i ++) for (unsigned i = 0 ; i < len; i ++)
@ -53,9 +60,16 @@ template <class F, class T> void pack (const eoVector <F, T> & __v) {
template <class F, class T> void unpack (eoVector <F, T> & __v) { template <class F, class T> void unpack (eoVector <F, T> & __v) {
F fit; unsigned valid; unpack(valid);
unpack (fit);
__v.fitness (fit); if (! valid) {
__v.invalidate();
}
else {
F fit;
unpack (fit);
__v.fitness (fit);
}
unsigned len; unsigned len;
unpack (len); unpack (len);

View file

@ -129,5 +129,4 @@ template <class U, class V> void unpack (std :: pair <U, V> & __pair) {
unpack (__pair.second); unpack (__pair.second);
} }
#endif #endif

View file

@ -50,12 +50,14 @@
#define DEBUG_PATH "./log/" #define DEBUG_PATH "./log/"
static bool debug = true; static bool debug = true;
static char host [MAX_BUFF_SIZE]; static char host [MAX_BUFF_SIZE];
std :: vector <FILE *> files; std :: vector <FILE *> files;
void setDebugMode (bool __dbg) { void setDebugMode (bool __dbg) {
debug = __dbg; debug = __dbg;

View file

@ -44,7 +44,6 @@ void peo :: finalize () {
printDebugMessage ("waiting for the termination of all threads"); printDebugMessage ("waiting for the termination of all threads");
joinRunners (); joinRunners ();
finalizeRMC (); finalizeRMC ();
printDebugMessage ("this is the end"); printDebugMessage ("this is the end");

View file

@ -38,11 +38,14 @@
#include "peo_init.h" #include "peo_init.h"
#include "peo_param.h" #include "peo_param.h"
#include "peo_debug.h" #include "peo_debug.h"
#include "rmc.h" #include "rmc.h"
#include "runner.h"
extern void initCommunicableEnv (); extern void initCommunicableEnv ();
extern void initBuffers ();
extern void initThreadsEnv (); extern void initThreadsEnv ();
extern void initReactiveThreadsEnv (); extern void initReactiveThreadsEnv ();
@ -50,10 +53,14 @@ extern void initReactiveThreadsEnv ();
extern void initRunnersEnv (); extern void initRunnersEnv ();
extern void initWorkersEnv (); extern void initWorkersEnv ();
extern void initScheduler ();
static void initExecutionEnv() { static void initExecutionEnv() {
initCommunicableEnv (); initCommunicableEnv ();
initBuffers ();
initScheduler();
initThreadsEnv (); initThreadsEnv ();
initReactiveThreadsEnv (); initReactiveThreadsEnv ();
@ -62,6 +69,7 @@ static void initExecutionEnv() {
initWorkersEnv (); initWorkersEnv ();
} }
namespace peo { namespace peo {
int * argc; int * argc;
@ -77,12 +85,12 @@ namespace peo {
/* Initializing the execution environment */ /* Initializing the execution environment */
initExecutionEnv(); initExecutionEnv();
/* Initializing the the Resource Management and Communication */
initRMC (__argc, __argv);
/* Loading the common parameters */ /* Loading the common parameters */
loadParameters (__argc, __argv); loadParameters (__argc, __argv);
/* Initializing the the Resource Management and Communication */
initRMC ( *peo::argc, *peo::argv);
/* */ /* */
initDebugging (); initDebugging ();
} }

View file

@ -40,7 +40,6 @@
#include "peo_debug.h" #include "peo_debug.h"
void peo :: loadParameters (int & __argc, char * * & __argv) { void peo :: loadParameters (int & __argc, char * * & __argv) {
eoParser parser (__argc, __argv); eoParser parser (__argc, __argv);

View file

@ -34,11 +34,11 @@
* *
*/ */
#include "peo_init.h"
#include "peo_run.h" #include "peo_run.h"
#include "rmc.h" #include "rmc.h"
#include "runner.h" #include "runner.h"
void peo :: run () { void peo :: run () {
startRunners (); startRunners ();

View file

@ -40,6 +40,7 @@ static bool the_end = false;
static std :: vector <ReactiveThread *> reac_threads; static std :: vector <ReactiveThread *> reac_threads;
ReactiveThread :: ReactiveThread () { ReactiveThread :: ReactiveThread () {
reac_threads.push_back (this); reac_threads.push_back (this);

View file

@ -62,6 +62,4 @@ extern void initReactiveThreadsEnv ();
extern void stopReactiveThreads (); extern void stopReactiveThreads ();
extern bool theEnd ();
#endif /*REAC_THREAD_H_*/ #endif /*REAC_THREAD_H_*/

View file

@ -95,50 +95,19 @@ Runner * getRunner (RUNNER_ID __key) {
return dynamic_cast <Runner *> (getCommunicable (__key)); return dynamic_cast <Runner *> (getCommunicable (__key));
} }
void packExecutionContext () {
num_local_exec_runners = 0;
for (unsigned i = 0; i < the_runners.size (); i ++)
if (the_runners [i] -> isAssignedLocally ()) num_local_exec_runners ++;
pack(num_local_exec_runners);
}
void unpackExecutionContext () {
unsigned num_remote_runners;
unpack(num_remote_runners);
num_exec_runners += num_remote_runners;
}
void initializeContext () { void initializeContext () {
initMessage (); num_local_exec_runners = 0;
packExecutionContext ();
sendMessageToAll (EXECUTION_CONTEXT_TAG);
int src, tag; // setting up the execution IDs & counting the number of local exec. runners
for (unsigned i = 0; i < getNumberOfNodes(); i ++) { for (unsigned i = 0; i < the_runners.size (); i ++) {
the_runners [i] -> setExecutionID ( my_node -> execution_id_run[ i ] );
cleanBuffers (); if (the_runners [i] -> isAssignedLocally ()) num_local_exec_runners ++;
waitMessage ();
probeMessage ( src, tag );
receiveMessage( src, tag );
initMessage ();
unpackExecutionContext ();
} }
cleanBuffers (); collectiveCountOfRunners( &num_local_exec_runners, &num_exec_runners );
// setting up the execution IDs // synchronizeNodes ();
for (unsigned i = 0; i < the_runners.size (); i ++)
the_runners [i] -> setExecutionID ( my_node -> execution_id_run[ i ] );
// synchronizing - all the nodes have to finish initializing
// the context before actually executing the runners
synchronizeNodes ();
for (unsigned i = 0; i < the_runners.size (); i ++) for (unsigned i = 0; i < the_runners.size (); i ++)
if (the_runners [i] -> isAssignedLocally ()) the_runners [i] -> notifyContextInitialized (); if (the_runners [i] -> isAssignedLocally ()) the_runners [i] -> notifyContextInitialized ();
@ -217,6 +186,7 @@ void unpackTerminationOfRunner () {
printDebugMessage ("All the runners have terminated - now stopping the reactive threads."); printDebugMessage ("All the runners have terminated - now stopping the reactive threads.");
stopReactiveThreads (); stopReactiveThreads ();
printDebugMessage ("Reactive threads stopped!");
} }
} }

Some files were not shown because too many files have changed in this diff Show more