git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@790 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
9c87b3b0c0
commit
adb6419766
60 changed files with 1017 additions and 1095 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <communicable.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -46,8 +46,7 @@ static std :: map <const Communicable *, unsigned> comm_to_key; /* Map of regist
|
|||
|
||||
unsigned Communicable :: num_comm = 0;
|
||||
|
||||
Communicable :: Communicable ()
|
||||
{
|
||||
Communicable :: Communicable () {
|
||||
|
||||
comm_to_key [this] = key = ++ num_comm;
|
||||
key_to_comm.push_back (this);
|
||||
|
|
@ -55,48 +54,41 @@ Communicable :: Communicable ()
|
|||
sem_init (& sem_stop, 0, 0);
|
||||
}
|
||||
|
||||
Communicable :: ~ Communicable ()
|
||||
{
|
||||
Communicable :: ~ Communicable () {
|
||||
|
||||
}
|
||||
|
||||
COMM_ID Communicable :: getKey ()
|
||||
{
|
||||
COMM_ID Communicable :: getKey () {
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
Communicable * getCommunicable (COMM_ID __key)
|
||||
{
|
||||
Communicable * getCommunicable (COMM_ID __key) {
|
||||
|
||||
assert (__key < key_to_comm.size ());
|
||||
return key_to_comm [__key];
|
||||
return key_to_comm [__key];
|
||||
}
|
||||
|
||||
COMM_ID getKey (const Communicable * __comm)
|
||||
{
|
||||
|
||||
COMM_ID getKey (const Communicable * __comm) {
|
||||
|
||||
return comm_to_key [__comm];
|
||||
}
|
||||
|
||||
void Communicable :: lock ()
|
||||
{
|
||||
void Communicable :: lock () {
|
||||
|
||||
sem_wait (& sem_lock);
|
||||
}
|
||||
sem_wait (& sem_lock);
|
||||
}
|
||||
|
||||
void Communicable :: unlock ()
|
||||
{
|
||||
void Communicable :: unlock () {
|
||||
|
||||
sem_post (& sem_lock);
|
||||
}
|
||||
|
||||
void Communicable :: stop ()
|
||||
{
|
||||
void Communicable :: stop () {
|
||||
sem_wait (& sem_stop);
|
||||
}
|
||||
|
||||
void Communicable :: resume ()
|
||||
{
|
||||
void Communicable :: resume () {
|
||||
|
||||
sem_post (& sem_stop);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <communicable.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -41,35 +41,34 @@
|
|||
|
||||
typedef unsigned COMM_ID;
|
||||
|
||||
class Communicable
|
||||
{
|
||||
class Communicable {
|
||||
|
||||
public :
|
||||
public :
|
||||
|
||||
Communicable ();
|
||||
Communicable ();
|
||||
|
||||
virtual ~ Communicable ();
|
||||
|
||||
virtual ~ Communicable ();
|
||||
COMM_ID getKey ();
|
||||
|
||||
COMM_ID getKey ();
|
||||
void lock (); /* It suspends the current process if the semaphore is locked */
|
||||
void unlock (); /* It unlocks the shared semaphore */
|
||||
|
||||
void lock (); /* It suspends the current process if the semaphore is locked */
|
||||
void unlock (); /* It unlocks the shared semaphore */
|
||||
void stop (); /* It suspends the current process */
|
||||
void resume (); /* It resumes ___________ */
|
||||
|
||||
protected :
|
||||
|
||||
void stop (); /* It suspends the current process */
|
||||
void resume (); /* It resumes ___________ */
|
||||
COMM_ID key;
|
||||
|
||||
protected :
|
||||
sem_t sem_lock;
|
||||
|
||||
sem_t sem_stop;
|
||||
|
||||
COMM_ID key;
|
||||
static unsigned num_comm;
|
||||
};
|
||||
|
||||
sem_t sem_lock;
|
||||
|
||||
sem_t sem_stop;
|
||||
|
||||
static unsigned num_comm;
|
||||
};
|
||||
|
||||
extern Communicable * getCommunicable (COMM_ID __key);
|
||||
extern Communicable * getCommunicable (COMM_ID __key);
|
||||
|
||||
//extern COMM_ID getKey (const Communicable * __comm);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <cooperative.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -42,29 +42,28 @@
|
|||
|
||||
typedef unsigned COOP_ID;
|
||||
|
||||
class Cooperative : public Communicable
|
||||
{
|
||||
class Cooperative : public Communicable {
|
||||
|
||||
public :
|
||||
public :
|
||||
|
||||
Runner * getOwner ();
|
||||
Runner * getOwner ();
|
||||
|
||||
void setOwner (Runner & __runner);
|
||||
void setOwner (Runner & __runner);
|
||||
|
||||
virtual void pack () = 0;
|
||||
virtual void pack () = 0;
|
||||
|
||||
virtual void unpack () = 0;
|
||||
|
||||
virtual void unpack () = 0;
|
||||
void send (Cooperative * __coop);
|
||||
|
||||
void send (Cooperative * __coop);
|
||||
virtual void notifySending ();
|
||||
|
||||
virtual void notifySending ();
|
||||
private :
|
||||
|
||||
private :
|
||||
Runner * owner;
|
||||
|
||||
Runner * owner;
|
||||
};
|
||||
|
||||
};
|
||||
|
||||
extern Cooperative * getCooperative (COOP_ID __key);
|
||||
extern Cooperative * getCooperative (COOP_ID __key);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
60
trunk/paradiseo-peo/src/core/eoPop_mesg.h
Normal file
60
trunk/paradiseo-peo/src/core/eoPop_mesg.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* <eoPop_comm.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __eoPop_mesg_h
|
||||
#define __eoPop_mesg_h
|
||||
|
||||
#include <eoPop.h>
|
||||
|
||||
#include "messaging.h"
|
||||
|
||||
template <class EOT> void pack (const eoPop <EOT> & __pop) {
|
||||
|
||||
pack ((unsigned) __pop.size ());
|
||||
for (unsigned i = 0; i < __pop.size (); i ++)
|
||||
pack (__pop [i]);
|
||||
}
|
||||
|
||||
template <class EOT> void unpack (eoPop <EOT> & __pop) {
|
||||
|
||||
unsigned n;
|
||||
|
||||
unpack (n);
|
||||
__pop.resize (n);
|
||||
for (unsigned i = 0; i < n; i ++)
|
||||
unpack (__pop [i]);
|
||||
}
|
||||
#endif
|
||||
98
trunk/paradiseo-peo/src/core/eoVector_mesg.h
Normal file
98
trunk/paradiseo-peo/src/core/eoVector_mesg.h
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
* <eoVector_comm.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
*
|
||||
* Sebastien Cahon, Alexandru-Adrian Tantar, Clive Canape
|
||||
*
|
||||
* This software is governed by the CeCILL license under French law and
|
||||
* abiding by the rules of distribution of free software. You can use,
|
||||
* modify and/ or redistribute the software under the terms of the CeCILL
|
||||
* license as circulated by CEA, CNRS and INRIA at the following URL
|
||||
* "http://www.cecill.info".
|
||||
*
|
||||
* As a counterpart to the access to the source code and rights to copy,
|
||||
* modify and redistribute granted by the license, users are provided only
|
||||
* with a limited warranty and the software's author, the holder of the
|
||||
* economic rights, and the successive licensors have only limited liability.
|
||||
*
|
||||
* In this respect, the user's attention is drawn to the risks associated
|
||||
* with loading, using, modifying and/or developing or reproducing the
|
||||
* software by the user in light of its specific status of free software,
|
||||
* that may mean that it is complicated to manipulate, and that also
|
||||
* therefore means that it is reserved for developers and experienced
|
||||
* professionals having in-depth computer knowledge. Users are therefore
|
||||
* encouraged to load and test the software's suitability as regards their
|
||||
* requirements in conditions enabling the security of their systems and/or
|
||||
* data to be ensured and, more generally, to use and operate it in the
|
||||
* same conditions as regards security.
|
||||
* The fact that you are presently reading this means that you have had
|
||||
* knowledge of the CeCILL license and that you accept its terms.
|
||||
*
|
||||
* ParadisEO WebSite : http://paradiseo.gforge.inria.fr
|
||||
* Contact: paradiseo-help@lists.gforge.inria.fr
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef __eoVector_mesg_h
|
||||
#define __eoVector_mesg_h
|
||||
|
||||
#include <eoVector.h>
|
||||
|
||||
#include "messaging.h"
|
||||
|
||||
template <class F, class T> void pack (const eoVector <F, T> & __v) {
|
||||
|
||||
pack (__v.fitness ()) ;
|
||||
unsigned len = __v.size ();
|
||||
pack (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
pack (__v [i]);
|
||||
}
|
||||
|
||||
template <class F, class T> void unpack (eoVector <F, T> & __v) {
|
||||
|
||||
F fit;
|
||||
unpack (fit);
|
||||
__v.fitness (fit);
|
||||
|
||||
unsigned len;
|
||||
unpack (len);
|
||||
__v.resize (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
unpack (__v [i]);
|
||||
}
|
||||
|
||||
template <class F, class T, class V> void pack (const eoVectorParticle <F, T, V> & __v) {
|
||||
|
||||
pack (__v.fitness ()) ;
|
||||
pack (__v.best());
|
||||
unsigned len = __v.size ();
|
||||
pack (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
pack (__v [i]);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
pack (__v.bestPositions[i]);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
pack (__v.velocities[i]);
|
||||
}
|
||||
|
||||
template <class F, class T, class V> void unpack (eoVectorParticle <F, T, V> & __v) {
|
||||
|
||||
F fit;
|
||||
unpack(fit);
|
||||
__v.fitness (fit);
|
||||
unpack(fit);
|
||||
__v.best(fit);
|
||||
unsigned len;
|
||||
unpack (len);
|
||||
__v.resize (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
unpack (__v [i]);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
unpack (__v.bestPositions[i]);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
unpack (__v.velocities[i]);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <messaging.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -40,46 +40,44 @@
|
|||
#include <utility>
|
||||
|
||||
/* Char */
|
||||
extern void pack (const char & __c);
|
||||
extern void pack (const char & __c);
|
||||
|
||||
/* Float */
|
||||
extern void pack (const float & __f, int __nitem = 1);
|
||||
extern void pack (const float & __f, int __nitem = 1);
|
||||
|
||||
/* Double */
|
||||
extern void pack (const double & __d, int __nitem = 1);
|
||||
extern void pack (const double & __d, int __nitem = 1);
|
||||
|
||||
/* Integer */
|
||||
extern void pack (const int & __i, int __nitem = 1);
|
||||
extern void pack (const int & __i, int __nitem = 1);
|
||||
|
||||
/* Unsigned int. */
|
||||
extern void pack (const unsigned int & __ui, int __nitem = 1);
|
||||
extern void pack (const unsigned int & __ui, int __nitem = 1);
|
||||
|
||||
/* Short int. */
|
||||
extern void pack (const short & __sh, int __nitem = 1);
|
||||
extern void pack (const short & __sh, int __nitem = 1);
|
||||
|
||||
/* Unsigned short */
|
||||
extern void pack (const unsigned short & __ush, int __nitem = 1);
|
||||
|
||||
/* Long */
|
||||
extern void pack (const long & __l, int __nitem = 1);
|
||||
extern void pack (const long & __l, int __nitem = 1);
|
||||
|
||||
/* Unsigned long */
|
||||
extern void pack (const unsigned long & __ul, int __nitem = 1);
|
||||
extern void pack (const unsigned long & __ul, int __nitem = 1);
|
||||
|
||||
/* String */
|
||||
extern void pack (const char * __str);
|
||||
extern void pack (const char * __str);
|
||||
|
||||
/* Pointer */
|
||||
template <class T> void pack (const T * __ptr)
|
||||
{
|
||||
|
||||
pack ((unsigned long) __ptr);
|
||||
template <class T> void pack (const T * __ptr) {
|
||||
|
||||
pack ((unsigned long) __ptr);
|
||||
}
|
||||
|
||||
/* Pair */
|
||||
template <class U, class V> void pack (const std :: pair <U, V> & __pair)
|
||||
{
|
||||
|
||||
template <class U, class V> void pack (const std :: pair <U, V> & __pair) {
|
||||
|
||||
pack (__pair.first);
|
||||
pack (__pair.second);
|
||||
}
|
||||
|
|
@ -88,48 +86,46 @@ template <class U, class V> void pack (const std :: pair <U, V> & __pair)
|
|||
//
|
||||
|
||||
/* Char */
|
||||
extern void unpack (char & __c);
|
||||
extern void unpack (char & __c);
|
||||
|
||||
/* Float */
|
||||
extern void unpack (float & __f, int __nitem = 1);
|
||||
extern void unpack (float & __f, int __nitem = 1);
|
||||
|
||||
/* Double */
|
||||
extern void unpack (double & __d, int __nitem = 1);
|
||||
extern void unpack (double & __d, int __nitem = 1);
|
||||
|
||||
/* Integer */
|
||||
extern void unpack (int & __i, int __nitem = 1);
|
||||
extern void unpack (int & __i, int __nitem = 1);
|
||||
|
||||
/* Unsigned int. */
|
||||
extern void unpack (unsigned int & __ui, int __nitem = 1);
|
||||
extern void unpack (unsigned int & __ui, int __nitem = 1);
|
||||
|
||||
/* Short int. */
|
||||
extern void unpack (short & __sh, int __nitem = 1);
|
||||
extern void unpack (short & __sh, int __nitem = 1);
|
||||
|
||||
/* Unsigned short */
|
||||
extern void unpack (unsigned short & __ush, int __nitem = 1);
|
||||
|
||||
/* Long */
|
||||
extern void unpack (long & __l, int __nitem = 1);
|
||||
extern void unpack (long & __l, int __nitem = 1);
|
||||
|
||||
/* Unsigned long */
|
||||
extern void unpack (unsigned long & __ul, int __nitem = 1);
|
||||
extern void unpack (unsigned long & __ul, int __nitem = 1);
|
||||
|
||||
/* String */
|
||||
extern void unpack (char * __str);
|
||||
extern void unpack (char * __str);
|
||||
|
||||
/* Pointer */
|
||||
template <class T> void unpack (T * & __ptr)
|
||||
{
|
||||
|
||||
template <class T> void unpack (T * & __ptr) {
|
||||
|
||||
unsigned long p;
|
||||
unpack (p);
|
||||
__ptr = (T *) p;
|
||||
}
|
||||
|
||||
/* Pair */
|
||||
template <class U, class V> void unpack (std :: pair <U, V> & __pair)
|
||||
{
|
||||
|
||||
template <class U, class V> void unpack (std :: pair <U, V> & __pair) {
|
||||
|
||||
unpack (__pair.first);
|
||||
unpack (__pair.second);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <peo_debug.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -56,8 +56,7 @@ static char host [MAX_BUFF_SIZE];
|
|||
|
||||
std :: vector <FILE *> files;
|
||||
|
||||
void setDebugMode (bool __dbg)
|
||||
{
|
||||
void setDebugMode (bool __dbg) {
|
||||
|
||||
debug = __dbg;
|
||||
gethostname (host, MAX_BUFF_SIZE);
|
||||
|
|
@ -65,9 +64,8 @@ void setDebugMode (bool __dbg)
|
|||
|
||||
extern int getNodeRank ();
|
||||
|
||||
void initDebugging ()
|
||||
{
|
||||
|
||||
void initDebugging () {
|
||||
|
||||
mkdir (DEBUG_PATH, S_IRWXU);
|
||||
// files.push_back (stdout);
|
||||
char buff [MAX_BUFF_SIZE];
|
||||
|
|
@ -75,37 +73,33 @@ void initDebugging ()
|
|||
files.push_back (fopen (buff, "w"));
|
||||
}
|
||||
|
||||
void endDebugging ()
|
||||
{
|
||||
void endDebugging () {
|
||||
|
||||
for (unsigned i = 0; i < files.size (); i ++)
|
||||
if (files [i] != stdout)
|
||||
fclose (files [i]);
|
||||
}
|
||||
|
||||
void printDebugMessage (const char * __mess)
|
||||
{
|
||||
void printDebugMessage (const char * __mess) {
|
||||
return;
|
||||
if (debug) {
|
||||
|
||||
if (debug)
|
||||
{
|
||||
char buff [MAX_BUFF_SIZE];
|
||||
time_t t = time (0);
|
||||
|
||||
char buff [MAX_BUFF_SIZE];
|
||||
time_t t = time (0);
|
||||
/* Date */
|
||||
sprintf (buff, "[%s][%s: ", host, ctime (& t));
|
||||
* strchr (buff, '\n') = ']';
|
||||
for (unsigned i = 0; i < files.size (); i ++)
|
||||
fprintf (files [i], buff);
|
||||
|
||||
/* Date */
|
||||
sprintf (buff, "[%s][%s: ", host, ctime (& t));
|
||||
* strchr (buff, '\n') = ']';
|
||||
for (unsigned i = 0; i < files.size (); i ++)
|
||||
fprintf (files [i], buff);
|
||||
|
||||
/* Message */
|
||||
sprintf (buff, "%s", __mess);
|
||||
|
||||
for (unsigned i = 0; i < files.size (); i ++)
|
||||
{
|
||||
fputs (buff, files [i]);
|
||||
fputs ("\n", files [i]);
|
||||
fflush (files [i]);
|
||||
}
|
||||
/* Message */
|
||||
sprintf (buff, "%s", __mess);
|
||||
|
||||
for (unsigned i = 0; i < files.size (); i ++) {
|
||||
fputs (buff, files [i]);
|
||||
fputs ("\n", files [i]);
|
||||
fflush (files [i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <peo_debug.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <peo_fin.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -39,8 +39,8 @@
|
|||
#include "runner.h"
|
||||
#include "rmc.h"
|
||||
|
||||
void peo :: finalize ()
|
||||
{
|
||||
|
||||
void peo :: finalize () {
|
||||
|
||||
printDebugMessage ("waiting for the termination of all threads");
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <peo_fin.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -37,9 +37,8 @@
|
|||
#ifndef __peo_finalize_h
|
||||
#define __peo_finalize_h
|
||||
|
||||
namespace peo
|
||||
{
|
||||
|
||||
namespace peo {
|
||||
|
||||
extern void finalize ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <peo_init.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -41,26 +41,24 @@
|
|||
#include "peo_debug.h"
|
||||
#include "rmc.h"
|
||||
|
||||
namespace peo
|
||||
{
|
||||
namespace peo {
|
||||
|
||||
int * argc;
|
||||
|
||||
|
||||
char * * * argv;
|
||||
|
||||
void init (int & __argc, char * * & __argv)
|
||||
{
|
||||
void init (int & __argc, char * * & __argv) {
|
||||
|
||||
argc = & __argc;
|
||||
|
||||
|
||||
argv = & __argv;
|
||||
|
||||
|
||||
/* Initializing the the Resource Management and Communication */
|
||||
initRMC (__argc, __argv);
|
||||
|
||||
/* Loading the common parameters */
|
||||
/* Loading the common parameters */
|
||||
loadParameters (__argc, __argv);
|
||||
|
||||
|
||||
/* */
|
||||
initDebugging ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <peo_init.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -37,13 +37,12 @@
|
|||
#ifndef __peo_init_h
|
||||
#define __peo_init_h
|
||||
|
||||
namespace peo
|
||||
{
|
||||
namespace peo {
|
||||
|
||||
extern int * argc;
|
||||
|
||||
|
||||
extern char * * * argv;
|
||||
|
||||
|
||||
extern void init (int & __argc, char * * & __argv);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <peo_param.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -41,8 +41,7 @@
|
|||
|
||||
|
||||
|
||||
void peo :: loadParameters (int & __argc, char * * & __argv)
|
||||
{
|
||||
void peo :: loadParameters (int & __argc, char * * & __argv) {
|
||||
|
||||
eoParser parser (__argc, __argv);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <peo_param.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -37,9 +37,8 @@
|
|||
#ifndef __peo_param_h
|
||||
#define __peo_param_h
|
||||
|
||||
namespace peo
|
||||
{
|
||||
|
||||
namespace peo {
|
||||
|
||||
extern void loadParameters (int & __argc, char * * & __argv);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <peo_run.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -39,9 +39,8 @@
|
|||
#include "rmc.h"
|
||||
#include "runner.h"
|
||||
|
||||
void peo :: run ()
|
||||
{
|
||||
|
||||
void peo :: run () {
|
||||
|
||||
startRunners ();
|
||||
|
||||
runRMC ();
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <peo_run.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -37,9 +37,8 @@
|
|||
#ifndef __peo_run_h
|
||||
#define __peo_run_h
|
||||
|
||||
namespace peo
|
||||
{
|
||||
|
||||
namespace peo {
|
||||
|
||||
extern void run ();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <reac_thread.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -40,29 +40,25 @@ static bool the_end = false;
|
|||
|
||||
static std :: vector <ReactiveThread *> reac_threads;
|
||||
|
||||
ReactiveThread :: ReactiveThread ()
|
||||
{
|
||||
ReactiveThread :: ReactiveThread () {
|
||||
|
||||
reac_threads.push_back (this);
|
||||
sem_init (& sem, 0, 0);
|
||||
}
|
||||
|
||||
void ReactiveThread :: sleep ()
|
||||
{
|
||||
void ReactiveThread :: sleep () {
|
||||
|
||||
sem_wait (& sem);
|
||||
sem_wait (& sem);
|
||||
}
|
||||
|
||||
void ReactiveThread :: wakeUp ()
|
||||
{
|
||||
void ReactiveThread :: wakeUp () {
|
||||
|
||||
sem_post (& sem);
|
||||
sem_post (& sem);
|
||||
}
|
||||
|
||||
void stopReactiveThreads ()
|
||||
{
|
||||
void stopReactiveThreads () {
|
||||
|
||||
the_end = true;
|
||||
for (unsigned i = 0; i < reac_threads.size (); i ++)
|
||||
reac_threads [i] -> wakeUp ();
|
||||
reac_threads [i] -> wakeUp ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <reac_thread.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -41,23 +41,22 @@
|
|||
|
||||
#include "thread.h"
|
||||
|
||||
class ReactiveThread : public Thread
|
||||
{
|
||||
class ReactiveThread : public Thread {
|
||||
|
||||
public:
|
||||
|
||||
public:
|
||||
/* Ctor */
|
||||
ReactiveThread ();
|
||||
|
||||
/* Ctor */
|
||||
ReactiveThread ();
|
||||
void sleep ();
|
||||
|
||||
void wakeUp ();
|
||||
|
||||
private:
|
||||
|
||||
void sleep ();
|
||||
|
||||
void wakeUp ();
|
||||
|
||||
private:
|
||||
|
||||
sem_t sem;
|
||||
|
||||
};
|
||||
sem_t sem;
|
||||
|
||||
};
|
||||
|
||||
extern void stopReactiveThreads ();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <ring_topo.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -37,19 +37,17 @@
|
|||
#include "ring_topo.h"
|
||||
|
||||
void RingTopology :: setNeighbors (Cooperative * __mig,
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to)
|
||||
{
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to) {
|
||||
__from.clear () ;
|
||||
__to.clear () ;
|
||||
|
||||
int len = mig.size () ;
|
||||
|
||||
for (int i = 0 ; i < len ; i ++)
|
||||
if (mig [i] == __mig)
|
||||
{
|
||||
__from.push_back (mig [(i - 1 + len) % len]) ;
|
||||
__to.push_back (mig [(i + 1) % len]) ;
|
||||
break;
|
||||
int len = mig.size () ;
|
||||
|
||||
for (int i = 0 ; i < len ; i ++)
|
||||
if (mig [i] == __mig) {
|
||||
__from.push_back (mig [(i - 1 + len) % len]) ;
|
||||
__to.push_back (mig [(i + 1) % len]) ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
/*
|
||||
/*
|
||||
* <ring_topo.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2007
|
||||
* (C) OPAC Team, LIFL, 2002-2007
|
||||
|
|
@ -39,15 +39,14 @@
|
|||
|
||||
#include "topology.h"
|
||||
|
||||
class RingTopology : public Topology
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
void setNeighbors (Cooperative * __mig,
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to);
|
||||
|
||||
};
|
||||
class RingTopology : public Topology {
|
||||
|
||||
public :
|
||||
|
||||
void setNeighbors (Cooperative * __mig,
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue