modif cmake configuration
git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@1277 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
1432128e88
commit
350bdfc7de
1261 changed files with 144616 additions and 0 deletions
48
branches/cmakemodif/paradiseo-peo/src/core/CMakeLists.txt
Normal file
48
branches/cmakemodif/paradiseo-peo/src/core/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
|
||||
######################################################################################
|
||||
### 1) Include the sources
|
||||
######################################################################################
|
||||
|
||||
INCLUDE_DIRECTORIES(${EO_SRC_DIR}/src)
|
||||
INCLUDE_DIRECTORIES(${MOEO_SRC_DIR}/src)
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 2) Define your target(s): just the peo library here
|
||||
######################################################################################
|
||||
|
||||
SET(CORE_LIB_OUTPUT_PATH ${ParadisEO-PEO_BINARY_DIR}/lib)
|
||||
SET(LIBRARY_OUTPUT_PATH ${CORE_LIB_OUTPUT_PATH})
|
||||
|
||||
SET (CORE_SOURCES peo_init.cpp
|
||||
peo_fin.cpp
|
||||
peo_run.cpp
|
||||
peo_param.cpp
|
||||
peo_debug.cpp
|
||||
thread.cpp
|
||||
reac_thread.cpp
|
||||
service.cpp
|
||||
runner.cpp
|
||||
communicable.cpp
|
||||
topology.cpp
|
||||
ring_topo.cpp
|
||||
star_topo.cpp
|
||||
random_topo.cpp
|
||||
complete_topo.cpp)
|
||||
|
||||
|
||||
|
||||
ADD_LIBRARY(peo STATIC ${CORE_SOURCES})
|
||||
|
||||
######################################################################################
|
||||
|
||||
|
||||
######################################################################################
|
||||
### 3) Optionnal: define your target(s)'s version: no effect for windows
|
||||
######################################################################################
|
||||
|
||||
SET(CORE_VERSION ${GLOBAL_VERSION})
|
||||
SET_TARGET_PROPERTIES(peo PROPERTIES VERSION "${CORE_VERSION}")
|
||||
######################################################################################
|
||||
|
||||
111
branches/cmakemodif/paradiseo-peo/src/core/communicable.cpp
Normal file
111
branches/cmakemodif/paradiseo-peo/src/core/communicable.cpp
Normal file
|
|
@ -0,0 +1,111 @@
|
|||
/*
|
||||
* <communicable.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <cassert>
|
||||
|
||||
#include "communicable.h"
|
||||
|
||||
static std :: vector <Communicable *> key_to_comm (1); /* Vector of registered cooperators */
|
||||
|
||||
static std :: map <const Communicable *, unsigned> comm_to_key; /* Map of registered cooperators */
|
||||
|
||||
unsigned Communicable :: num_comm = 0;
|
||||
|
||||
|
||||
Communicable :: Communicable ()
|
||||
{
|
||||
|
||||
comm_to_key [this] = key = ++ num_comm;
|
||||
key_to_comm.push_back (this);
|
||||
sem_init (& sem_lock, 0, 1);
|
||||
sem_init (& sem_stop, 0, 0);
|
||||
}
|
||||
|
||||
Communicable :: ~ Communicable ()
|
||||
{
|
||||
}
|
||||
|
||||
COMM_ID Communicable :: getKey ()
|
||||
{
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
Communicable * getCommunicable (COMM_ID __key)
|
||||
{
|
||||
|
||||
assert (__key < key_to_comm.size ());
|
||||
return key_to_comm [__key];
|
||||
}
|
||||
|
||||
COMM_ID getKey (const Communicable * __comm)
|
||||
{
|
||||
|
||||
return comm_to_key [__comm];
|
||||
}
|
||||
|
||||
void Communicable :: lock ()
|
||||
{
|
||||
|
||||
sem_wait (& sem_lock);
|
||||
}
|
||||
|
||||
void Communicable :: unlock ()
|
||||
{
|
||||
|
||||
sem_post (& sem_lock);
|
||||
}
|
||||
|
||||
void Communicable :: stop ()
|
||||
{
|
||||
sem_wait (& sem_stop);
|
||||
}
|
||||
|
||||
void Communicable :: resume ()
|
||||
{
|
||||
|
||||
sem_post (& sem_stop);
|
||||
}
|
||||
|
||||
void initCommunicableEnv ()
|
||||
{
|
||||
|
||||
key_to_comm.resize (1);
|
||||
comm_to_key.clear ();
|
||||
Communicable :: num_comm = 0;
|
||||
}
|
||||
79
branches/cmakemodif/paradiseo-peo/src/core/communicable.h
Normal file
79
branches/cmakemodif/paradiseo-peo/src/core/communicable.h
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* <communicable.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __communicable_h
|
||||
#define __communicable_h
|
||||
|
||||
#include <semaphore.h>
|
||||
|
||||
|
||||
typedef unsigned COMM_ID;
|
||||
|
||||
class Communicable
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
Communicable ();
|
||||
|
||||
virtual ~ Communicable ();
|
||||
|
||||
COMM_ID getKey ();
|
||||
|
||||
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 ___________ */
|
||||
|
||||
public :
|
||||
|
||||
static unsigned num_comm;
|
||||
|
||||
protected :
|
||||
|
||||
COMM_ID key;
|
||||
|
||||
sem_t sem_lock;
|
||||
|
||||
sem_t sem_stop;
|
||||
};
|
||||
|
||||
extern void initCommunicableEnv ();
|
||||
|
||||
extern Communicable * getCommunicable (COMM_ID __key);
|
||||
|
||||
#endif
|
||||
56
branches/cmakemodif/paradiseo-peo/src/core/complete_topo.cpp
Normal file
56
branches/cmakemodif/paradiseo-peo/src/core/complete_topo.cpp
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* <complete_topo.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include "complete_topo.h"
|
||||
|
||||
void CompleteTopology :: setNeighbors (Cooperative * __mig,
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to)
|
||||
{
|
||||
|
||||
__from.clear () ;
|
||||
__to.clear () ;
|
||||
|
||||
for (unsigned i = 0; i < mig.size (); i ++)
|
||||
{
|
||||
if (mig [i] != __mig)
|
||||
{
|
||||
__from.push_back (mig [i]);
|
||||
__to.push_back (mig [i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
52
branches/cmakemodif/paradiseo-peo/src/core/complete_topo.h
Normal file
52
branches/cmakemodif/paradiseo-peo/src/core/complete_topo.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* <complete_topo.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __complete_topo_h
|
||||
#define __complete_topo_h
|
||||
|
||||
#include "topology.h"
|
||||
|
||||
class CompleteTopology : public Topology
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
void setNeighbors (Cooperative * __mig,
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to);
|
||||
};
|
||||
|
||||
#endif
|
||||
81
branches/cmakemodif/paradiseo-peo/src/core/cooperative.h
Normal file
81
branches/cmakemodif/paradiseo-peo/src/core/cooperative.h
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
/*
|
||||
* <cooperative.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __cooperative_h
|
||||
#define __cooperative_h
|
||||
|
||||
#include <vector>
|
||||
#include "communicable.h"
|
||||
#include "runner.h"
|
||||
|
||||
typedef unsigned COOP_ID;
|
||||
|
||||
class Cooperative : public Communicable
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
Runner * getOwner ();
|
||||
|
||||
void setOwner (Runner & __runner);
|
||||
|
||||
virtual void pack () = 0;
|
||||
|
||||
virtual void unpack () = 0;
|
||||
|
||||
virtual void packSynchronizeReq () = 0;
|
||||
|
||||
void send (Cooperative * __coop);
|
||||
|
||||
void synchronizeCoopEx ();
|
||||
|
||||
virtual void notifySending ();
|
||||
|
||||
virtual void notifyReceiving ();
|
||||
|
||||
virtual void notifySendingSyncReq ();
|
||||
|
||||
virtual void notifySynchronized ();
|
||||
|
||||
private :
|
||||
|
||||
Runner * owner;
|
||||
|
||||
};
|
||||
|
||||
extern Cooperative * getCooperative (COOP_ID __key);
|
||||
|
||||
#endif
|
||||
83
branches/cmakemodif/paradiseo-peo/src/core/eoPop_mesg.h
Normal file
83
branches/cmakemodif/paradiseo-peo/src/core/eoPop_mesg.h
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
/*
|
||||
* <eoPop_comm.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __eoPop_mesg_h
|
||||
#define __eoPop_mesg_h
|
||||
|
||||
#include <eoPop.h>
|
||||
|
||||
#include "messaging.h"
|
||||
|
||||
|
||||
template <class EOT> void pack (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]);
|
||||
}
|
||||
|
||||
template <class MOEOT> void pack (moeoArchive < MOEOT > & __pop)
|
||||
{
|
||||
|
||||
pack ((unsigned) __pop.size ());
|
||||
for (unsigned i = 0; i < __pop.size (); i ++)
|
||||
pack (__pop [i]);
|
||||
}
|
||||
|
||||
template <class MOEOT> void unpack (moeoArchive < MOEOT > & __pop)
|
||||
{
|
||||
|
||||
unsigned n;
|
||||
|
||||
unpack (n);
|
||||
__pop.resize (n);
|
||||
for (unsigned i = 0; i < n; i ++)
|
||||
unpack (__pop [i]);
|
||||
}
|
||||
|
||||
#endif
|
||||
218
branches/cmakemodif/paradiseo-peo/src/core/eoVector_mesg.h
Normal file
218
branches/cmakemodif/paradiseo-peo/src/core/eoVector_mesg.h
Normal file
|
|
@ -0,0 +1,218 @@
|
|||
/*
|
||||
* <eoVector_comm.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 <core/moeoVector.h>
|
||||
|
||||
#include "messaging.h"
|
||||
|
||||
|
||||
template <class F, class T> void pack (const eoVector <F, T> & __v)
|
||||
{
|
||||
|
||||
if (__v.invalid())
|
||||
{
|
||||
pack((unsigned)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
pack((unsigned)1);
|
||||
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)
|
||||
{
|
||||
|
||||
unsigned valid;
|
||||
unpack(valid);
|
||||
|
||||
if (! valid)
|
||||
{
|
||||
__v.invalidate();
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
if (__v.invalid())
|
||||
{
|
||||
pack((unsigned)0);
|
||||
}
|
||||
else
|
||||
{
|
||||
pack((unsigned)1);
|
||||
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)
|
||||
{
|
||||
|
||||
unsigned valid;
|
||||
unpack(valid);
|
||||
|
||||
if (! valid)
|
||||
{
|
||||
__v.invalidate();
|
||||
}
|
||||
else
|
||||
{
|
||||
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]);
|
||||
}
|
||||
|
||||
template <class F, class T, class V, class W> void unpack (moeoVector <F,T,V,W> &_v)
|
||||
{
|
||||
unsigned valid;
|
||||
unpack(valid);
|
||||
if (! valid)
|
||||
_v.invalidate();
|
||||
else
|
||||
{
|
||||
T fit;
|
||||
unpack (fit);
|
||||
_v.fitness (fit);
|
||||
}
|
||||
unpack(valid);
|
||||
if (! valid)
|
||||
_v.invalidateDiversity();
|
||||
else
|
||||
{
|
||||
V diver;
|
||||
unpack(diver);
|
||||
_v.diversity(diver);
|
||||
}
|
||||
unsigned len;
|
||||
unpack (len);
|
||||
_v.resize (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
unpack (_v [i]);
|
||||
unpack(valid);
|
||||
if (! valid)
|
||||
_v.invalidateObjectiveVector();
|
||||
else
|
||||
{
|
||||
F object;
|
||||
unpack (len);
|
||||
object.resize(len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
unpack (object[i]);
|
||||
_v.objectiveVector(object);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class F, class T, class V, class W> void pack (moeoVector <F,T,V,W> &_v)
|
||||
{
|
||||
if (_v.invalid())
|
||||
pack((unsigned)0);
|
||||
else
|
||||
{
|
||||
pack((unsigned)1);
|
||||
pack (_v.fitness ());
|
||||
}
|
||||
if (_v.invalidDiversity())
|
||||
pack((unsigned)0);
|
||||
else
|
||||
{
|
||||
pack((unsigned)1);
|
||||
pack(_v.diversity());
|
||||
}
|
||||
unsigned len = _v.size ();
|
||||
pack (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
pack (_v[i]);
|
||||
if (_v.invalidObjectiveVector())
|
||||
pack((unsigned)0);
|
||||
else
|
||||
{
|
||||
pack((unsigned)1);
|
||||
F object;
|
||||
object=_v.objectiveVector();
|
||||
len=object.nObjectives();
|
||||
pack (len);
|
||||
for (unsigned i = 0 ; i < len; i ++)
|
||||
pack (object[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
145
branches/cmakemodif/paradiseo-peo/src/core/messaging.h
Normal file
145
branches/cmakemodif/paradiseo-peo/src/core/messaging.h
Normal file
|
|
@ -0,0 +1,145 @@
|
|||
/*
|
||||
* <messaging.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __mess_h
|
||||
#define __mess_h
|
||||
|
||||
#include <utility>
|
||||
#include <string>
|
||||
|
||||
/* Char */
|
||||
extern void pack (const char & __c);
|
||||
|
||||
/* Boolean */
|
||||
extern void pack (const bool & __b, int __nitem = 1);
|
||||
|
||||
/* Float */
|
||||
extern void pack (const float & __f, int __nitem = 1);
|
||||
|
||||
/* Double */
|
||||
extern void pack (const double & __d, int __nitem = 1);
|
||||
|
||||
/* Integer */
|
||||
extern void pack (const int & __i, int __nitem = 1);
|
||||
|
||||
/* Unsigned int. */
|
||||
extern void pack (const unsigned int & __ui, int __nitem = 1);
|
||||
|
||||
/* Short int. */
|
||||
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);
|
||||
|
||||
/* Unsigned long */
|
||||
extern void pack (const unsigned long & __ul, int __nitem = 1);
|
||||
|
||||
/* String */
|
||||
extern void pack (const char * __str);
|
||||
extern void pack (const std::string & __str);
|
||||
|
||||
/* Pointer */
|
||||
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)
|
||||
{
|
||||
|
||||
pack (__pair.first);
|
||||
pack (__pair.second);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* Char */
|
||||
extern void unpack (char & __c);
|
||||
|
||||
/* Boolean */
|
||||
extern void unpack (bool & __b, int __nitem = 1);
|
||||
|
||||
/* Float */
|
||||
extern void unpack (float & __f, int __nitem = 1);
|
||||
|
||||
/* Double */
|
||||
extern void unpack (double & __d, int __nitem = 1);
|
||||
|
||||
/* Integer */
|
||||
extern void unpack (int & __i, int __nitem = 1);
|
||||
|
||||
/* Unsigned int. */
|
||||
extern void unpack (unsigned int & __ui, int __nitem = 1);
|
||||
|
||||
/* Short int. */
|
||||
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);
|
||||
|
||||
/* Unsigned long */
|
||||
extern void unpack (unsigned long & __ul, int __nitem = 1);
|
||||
|
||||
/* String */
|
||||
extern void unpack (char * __str);
|
||||
extern void unpack (std::string & __str);
|
||||
|
||||
/* Pointer */
|
||||
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)
|
||||
{
|
||||
|
||||
unpack (__pair.first);
|
||||
unpack (__pair.second);
|
||||
}
|
||||
|
||||
#endif
|
||||
289
branches/cmakemodif/paradiseo-peo/src/core/peoAbstractDefs.h
Executable file
289
branches/cmakemodif/paradiseo-peo/src/core/peoAbstractDefs.h
Executable file
|
|
@ -0,0 +1,289 @@
|
|||
/*
|
||||
* <peoAbstractDefs.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#if !defined __peoAbstractDefs_h
|
||||
#define __peoAbstractDefs_h
|
||||
|
||||
|
||||
#include <queue>
|
||||
|
||||
#include "core/messaging.h"
|
||||
|
||||
|
||||
|
||||
template < typename Type > struct Entity;
|
||||
|
||||
struct AbstractEntity
|
||||
{
|
||||
|
||||
virtual ~AbstractEntity() {}
|
||||
|
||||
template < typename EntityType > operator EntityType& ()
|
||||
{
|
||||
|
||||
return ( dynamic_cast< Entity< EntityType >& >( *this ) ).entity;
|
||||
}
|
||||
};
|
||||
|
||||
struct AbstractFunctor : virtual public AbstractEntity
|
||||
{
|
||||
|
||||
virtual ~AbstractFunctor() {}
|
||||
|
||||
virtual void operator()() {}
|
||||
};
|
||||
|
||||
struct AbstractUnaryFunctor : virtual public AbstractEntity
|
||||
{
|
||||
|
||||
virtual ~AbstractUnaryFunctor() {}
|
||||
|
||||
virtual void operator()( AbstractEntity& dataEntity ) {}
|
||||
};
|
||||
|
||||
struct AbstractBinaryFunctor : virtual public AbstractEntity
|
||||
{
|
||||
|
||||
virtual ~AbstractBinaryFunctor() {}
|
||||
|
||||
virtual void operator()( AbstractEntity& dataEntityA, AbstractEntity& dataEntityB ) {};
|
||||
};
|
||||
|
||||
|
||||
|
||||
template < typename EntityType > struct Entity : virtual public AbstractEntity
|
||||
{
|
||||
|
||||
Entity( EntityType& externalEntityRef ) : entity( externalEntityRef ) {}
|
||||
|
||||
EntityType& entity;
|
||||
};
|
||||
|
||||
template < typename FunctorType, typename DataType > struct FunctorEx : public Entity< DataType >, public AbstractFunctor
|
||||
{
|
||||
|
||||
FunctorEx( FunctorType& externalFunctorRef, DataType& externalDataRef )
|
||||
: externalFunctor( externalFunctorRef ), Entity< DataType >( externalDataRef ) {}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
|
||||
externalFunctor( Entity< DataType > :: entity );
|
||||
}
|
||||
|
||||
FunctorType& externalFunctor;
|
||||
};
|
||||
|
||||
template < typename FunctorType > struct FunctorEx< FunctorType, void > : public Entity< AbstractEntity >, public AbstractFunctor
|
||||
{
|
||||
|
||||
FunctorEx( FunctorType& externalFunctorRef )
|
||||
: externalFunctor( externalFunctorRef ), Entity< AbstractEntity >( *this ) {}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
|
||||
externalFunctor();
|
||||
}
|
||||
|
||||
FunctorType& externalFunctor;
|
||||
};
|
||||
|
||||
template < typename ReturnType, typename DataType > struct FnFunctorEx
|
||||
: public Entity< DataType >, public AbstractFunctor
|
||||
{
|
||||
|
||||
FnFunctorEx( ReturnType (*externalFunctorRef)( DataType& ), DataType& externalDataRef )
|
||||
: externalFunctor( externalFunctorRef ), Entity< DataType >( externalDataRef ) {}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
|
||||
externalFunctor( Entity< DataType > :: entity );
|
||||
}
|
||||
|
||||
ReturnType (*externalFunctor)( DataType& );
|
||||
};
|
||||
|
||||
template < typename ReturnType > struct FnFunctorEx< ReturnType, void >
|
||||
: public Entity< AbstractEntity >, public AbstractFunctor
|
||||
{
|
||||
|
||||
FnFunctorEx( ReturnType (*externalFunctorRef)() )
|
||||
: externalFunctor( externalFunctorRef ), Entity< AbstractEntity >( *this ) {}
|
||||
|
||||
void operator()()
|
||||
{
|
||||
|
||||
externalFunctor();
|
||||
}
|
||||
|
||||
ReturnType (*externalFunctor)();
|
||||
};
|
||||
|
||||
|
||||
|
||||
template < typename FunctorType > struct UnaryFunctor : public Entity< FunctorType >, public AbstractUnaryFunctor
|
||||
{
|
||||
|
||||
UnaryFunctor( FunctorType& externalFunctorRef ) : Entity< FunctorType >( externalFunctorRef ) {}
|
||||
|
||||
void operator()( AbstractEntity& dataEntity )
|
||||
{
|
||||
|
||||
Entity< FunctorType > :: entity( dataEntity );
|
||||
}
|
||||
};
|
||||
|
||||
template < typename ReturnType, typename DataType > struct UnaryFnFunctor
|
||||
: public Entity< AbstractEntity >, public AbstractUnaryFunctor
|
||||
{
|
||||
|
||||
UnaryFnFunctor( ReturnType (*externalFnRef)( DataType& ) ) : Entity< AbstractEntity >( *this ), externalFn( externalFnRef )
|
||||
{
|
||||
}
|
||||
|
||||
void operator()( AbstractEntity& dataEntity )
|
||||
{
|
||||
|
||||
externalFn( dataEntity );
|
||||
}
|
||||
|
||||
ReturnType (*externalFn)( DataType& );
|
||||
};
|
||||
|
||||
template < typename FunctorType > struct BinaryFunctor : public Entity< FunctorType >, public AbstractBinaryFunctor
|
||||
{
|
||||
|
||||
BinaryFunctor( FunctorType& externalFunctorRef ) : Entity< FunctorType >( externalFunctorRef ) {}
|
||||
|
||||
void operator()( AbstractEntity& dataEntityA, AbstractEntity& dataEntityB )
|
||||
{
|
||||
|
||||
Entity< FunctorType > :: entity( dataEntityA, dataEntityB );
|
||||
}
|
||||
};
|
||||
|
||||
struct AbstractMsgTransferQueue : virtual public AbstractEntity
|
||||
{
|
||||
|
||||
virtual ~AbstractMsgTransferQueue() {}
|
||||
|
||||
virtual void pushMessage() {}
|
||||
virtual void popMessage() {}
|
||||
|
||||
virtual bool empty()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void packMessage() {}
|
||||
virtual void unpackMessage() {}
|
||||
};
|
||||
|
||||
template < typename EntityType > struct MsgTransferQueue : public Entity< EntityType >, public AbstractMsgTransferQueue
|
||||
{
|
||||
|
||||
MsgTransferQueue( EntityType& externalDataRef )
|
||||
: Entity< EntityType >( externalDataRef )
|
||||
{
|
||||
|
||||
aggregationFunctor = new BinaryFunctor< AssignmentFunctor >( assignmentFunctor );
|
||||
}
|
||||
|
||||
template < typename FunctorType >
|
||||
MsgTransferQueue( EntityType& externalDataRef, FunctorType& externalFunctorRef )
|
||||
: Entity< EntityType >( externalDataRef )
|
||||
{
|
||||
|
||||
aggregationFunctor = new BinaryFunctor< FunctorType >( externalFunctorRef );
|
||||
}
|
||||
|
||||
~MsgTransferQueue()
|
||||
{
|
||||
delete aggregationFunctor;
|
||||
}
|
||||
|
||||
void pushMessage()
|
||||
{
|
||||
|
||||
transferQueue.push( Entity< EntityType > :: entity );
|
||||
}
|
||||
|
||||
void popMessage()
|
||||
{
|
||||
|
||||
Entity< EntityType > message( transferQueue.front() );
|
||||
aggregationFunctor->operator()( *this, message );
|
||||
|
||||
transferQueue.pop();
|
||||
}
|
||||
|
||||
bool empty()
|
||||
{
|
||||
return transferQueue.empty();
|
||||
}
|
||||
|
||||
void packMessage()
|
||||
{
|
||||
|
||||
pack( transferQueue.front() );
|
||||
transferQueue.pop();
|
||||
}
|
||||
|
||||
void unpackMessage()
|
||||
{
|
||||
|
||||
EntityType transferredData;
|
||||
unpack( transferredData );
|
||||
transferQueue.push( transferredData );
|
||||
}
|
||||
|
||||
struct AssignmentFunctor
|
||||
{
|
||||
void operator()( EntityType& A, EntityType& B )
|
||||
{
|
||||
A = B;
|
||||
}
|
||||
} assignmentFunctor;
|
||||
|
||||
std::queue< EntityType > transferQueue;
|
||||
AbstractBinaryFunctor* aggregationFunctor;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
117
branches/cmakemodif/paradiseo-peo/src/core/peo_debug.cpp
Normal file
117
branches/cmakemodif/paradiseo-peo/src/core/peo_debug.cpp
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
/*
|
||||
* <peo_debug.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "peo_debug.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <vector>
|
||||
|
||||
#include "peo_debug.h"
|
||||
|
||||
#define MAX_BUFF_SIZE 1000
|
||||
|
||||
#define DEBUG_PATH "./log/"
|
||||
|
||||
|
||||
static bool debug = false;
|
||||
|
||||
static char host [MAX_BUFF_SIZE];
|
||||
|
||||
std :: vector <FILE *> files;
|
||||
|
||||
|
||||
void setDebugMode (bool __dbg)
|
||||
{
|
||||
|
||||
debug = __dbg;
|
||||
gethostname (host, MAX_BUFF_SIZE);
|
||||
}
|
||||
|
||||
extern int getNodeRank ();
|
||||
|
||||
void initDebugging ()
|
||||
{
|
||||
|
||||
mkdir (DEBUG_PATH, S_IRWXU);
|
||||
// files.push_back (stdout);
|
||||
char buff [MAX_BUFF_SIZE];
|
||||
sprintf (buff, "%s/%d", DEBUG_PATH, getNodeRank ());
|
||||
files.push_back (fopen (buff, "w"));
|
||||
}
|
||||
|
||||
void endDebugging ()
|
||||
{
|
||||
|
||||
for (unsigned i = 0; i < files.size (); i ++)
|
||||
if (files [i] != stdout)
|
||||
fclose (files [i]);
|
||||
files.clear();
|
||||
}
|
||||
|
||||
void printDebugMessage (const char * __mess)
|
||||
{
|
||||
|
||||
if (debug)
|
||||
{
|
||||
|
||||
char buff [MAX_BUFF_SIZE];
|
||||
char localTime [MAX_BUFF_SIZE];
|
||||
time_t t = time (0);
|
||||
|
||||
/* Date */
|
||||
strcpy( localTime, ctime (& t) );
|
||||
localTime[ strlen( localTime )-1 ] = ']';
|
||||
sprintf (buff, "[%s][%s: ", host, localTime );
|
||||
|
||||
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]);
|
||||
}
|
||||
}
|
||||
}
|
||||
50
branches/cmakemodif/paradiseo-peo/src/core/peo_debug.h
Normal file
50
branches/cmakemodif/paradiseo-peo/src/core/peo_debug.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* <peo_debug.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __peo_debug_h
|
||||
#define __peo_debug_h
|
||||
|
||||
extern void initDebugging ();
|
||||
|
||||
extern void endDebugging ();
|
||||
|
||||
extern void setDebugMode (bool __dbg = true); /* (Des)activating the Debugging mode */
|
||||
|
||||
extern void printDebugMessage (const char * __mess); /* Print a new message both on the
|
||||
standard output and a target
|
||||
text-file in a subdirectory) */
|
||||
|
||||
#endif
|
||||
52
branches/cmakemodif/paradiseo-peo/src/core/peo_fin.cpp
Normal file
52
branches/cmakemodif/paradiseo-peo/src/core/peo_fin.cpp
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* <peo_fin.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "peo_fin.h"
|
||||
#include "peo_debug.h"
|
||||
#include "runner.h"
|
||||
#include "rmc.h"
|
||||
|
||||
void peo :: finalize ()
|
||||
{
|
||||
|
||||
printDebugMessage ("waiting for the termination of all threads");
|
||||
|
||||
joinRunners ();
|
||||
finalizeRMC ();
|
||||
|
||||
printDebugMessage ("this is the end");
|
||||
endDebugging ();
|
||||
}
|
||||
46
branches/cmakemodif/paradiseo-peo/src/core/peo_fin.h
Normal file
46
branches/cmakemodif/paradiseo-peo/src/core/peo_fin.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* <peo_fin.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __peo_finalize_h
|
||||
#define __peo_finalize_h
|
||||
|
||||
namespace peo
|
||||
{
|
||||
|
||||
extern void finalize ();
|
||||
}
|
||||
|
||||
#endif
|
||||
102
branches/cmakemodif/paradiseo-peo/src/core/peo_init.cpp
Normal file
102
branches/cmakemodif/paradiseo-peo/src/core/peo_init.cpp
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
/*
|
||||
* <peo_init.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "peo_init.h"
|
||||
#include "peo_param.h"
|
||||
|
||||
#include "peo_debug.h"
|
||||
#include "rmc.h"
|
||||
#include "runner.h"
|
||||
|
||||
|
||||
extern void initCommunicableEnv ();
|
||||
extern void initBuffers ();
|
||||
|
||||
extern void initThreadsEnv ();
|
||||
extern void initReactiveThreadsEnv ();
|
||||
|
||||
extern void initRunnersEnv ();
|
||||
extern void initWorkersEnv ();
|
||||
|
||||
extern void initScheduler ();
|
||||
extern void initSynchron ();
|
||||
|
||||
|
||||
static void initExecutionEnv()
|
||||
{
|
||||
|
||||
initCommunicableEnv ();
|
||||
initBuffers ();
|
||||
initScheduler();
|
||||
initSynchron ();
|
||||
|
||||
initThreadsEnv ();
|
||||
initReactiveThreadsEnv ();
|
||||
|
||||
initRunnersEnv ();
|
||||
initWorkersEnv ();
|
||||
}
|
||||
|
||||
|
||||
namespace peo
|
||||
{
|
||||
|
||||
int * argc;
|
||||
|
||||
char * * * argv;
|
||||
|
||||
void init (int & __argc, char * * & __argv)
|
||||
{
|
||||
|
||||
argc = & __argc;
|
||||
|
||||
argv = & __argv;
|
||||
|
||||
/* Initializing the execution environment */
|
||||
initExecutionEnv();
|
||||
|
||||
/* Loading the common parameters */
|
||||
loadParameters (__argc, __argv);
|
||||
|
||||
/* Initializing the the Resource Management and Communication */
|
||||
initRMC ( *peo::argc, *peo::argv);
|
||||
|
||||
/* */
|
||||
initDebugging ();
|
||||
}
|
||||
}
|
||||
50
branches/cmakemodif/paradiseo-peo/src/core/peo_init.h
Normal file
50
branches/cmakemodif/paradiseo-peo/src/core/peo_init.h
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
* <peo_init.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __peo_init_h
|
||||
#define __peo_init_h
|
||||
|
||||
namespace peo
|
||||
{
|
||||
|
||||
extern int * argc;
|
||||
|
||||
extern char * * * argv;
|
||||
|
||||
extern void init (int & __argc, char * * & __argv);
|
||||
}
|
||||
|
||||
#endif
|
||||
53
branches/cmakemodif/paradiseo-peo/src/core/peo_param.cpp
Normal file
53
branches/cmakemodif/paradiseo-peo/src/core/peo_param.cpp
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* <peo_param.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <utils/eoParser.h>
|
||||
|
||||
#include "peo_param.h"
|
||||
#include "peo_debug.h"
|
||||
|
||||
|
||||
void peo :: loadParameters (int & __argc, char * * & __argv)
|
||||
{
|
||||
|
||||
eoParser parser (__argc, __argv);
|
||||
|
||||
/* Debug */
|
||||
eoValueParam <std :: string> debug_param ("false", "debug", "?");
|
||||
parser.processParam (debug_param);
|
||||
if (debug_param.value () == "true")
|
||||
setDebugMode ();
|
||||
}
|
||||
46
branches/cmakemodif/paradiseo-peo/src/core/peo_param.h
Normal file
46
branches/cmakemodif/paradiseo-peo/src/core/peo_param.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* <peo_param.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __peo_param_h
|
||||
#define __peo_param_h
|
||||
|
||||
namespace peo
|
||||
{
|
||||
|
||||
extern void loadParameters (int & __argc, char * * & __argv);
|
||||
}
|
||||
|
||||
#endif
|
||||
48
branches/cmakemodif/paradiseo-peo/src/core/peo_run.cpp
Normal file
48
branches/cmakemodif/paradiseo-peo/src/core/peo_run.cpp
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* <peo_run.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "peo_run.h"
|
||||
#include "rmc.h"
|
||||
#include "runner.h"
|
||||
|
||||
|
||||
void peo :: run ()
|
||||
{
|
||||
|
||||
startRunners ();
|
||||
|
||||
runRMC ();
|
||||
}
|
||||
46
branches/cmakemodif/paradiseo-peo/src/core/peo_run.h
Normal file
46
branches/cmakemodif/paradiseo-peo/src/core/peo_run.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* <peo_run.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __peo_run_h
|
||||
#define __peo_run_h
|
||||
|
||||
namespace peo
|
||||
{
|
||||
|
||||
extern void run ();
|
||||
}
|
||||
|
||||
#endif
|
||||
58
branches/cmakemodif/paradiseo-peo/src/core/random_topo.cpp
Normal file
58
branches/cmakemodif/paradiseo-peo/src/core/random_topo.cpp
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* <random_topo.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include "random_topo.h"
|
||||
|
||||
#include <utils/eoRNG.h>
|
||||
|
||||
void RandomTopology :: setNeighbors (Cooperative * __mig,
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to)
|
||||
{
|
||||
|
||||
__from.clear () ;
|
||||
__to.clear () ;
|
||||
|
||||
for (unsigned i = 0; i < mig.size (); i ++)
|
||||
{
|
||||
if (mig [i] != __mig && rng.uniform() < 0.5 )
|
||||
{
|
||||
__from.push_back (mig [i]);
|
||||
__to.push_back (mig [i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
52
branches/cmakemodif/paradiseo-peo/src/core/random_topo.h
Normal file
52
branches/cmakemodif/paradiseo-peo/src/core/random_topo.h
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* <random_topo.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __random_topo_h
|
||||
#define __random_topo_h
|
||||
|
||||
#include "topology.h"
|
||||
|
||||
class RandomTopology : public Topology
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
void setNeighbors (Cooperative * __mig,
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to);
|
||||
};
|
||||
|
||||
#endif
|
||||
82
branches/cmakemodif/paradiseo-peo/src/core/reac_thread.cpp
Normal file
82
branches/cmakemodif/paradiseo-peo/src/core/reac_thread.cpp
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
/*
|
||||
* <reac_thread.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "reac_thread.h"
|
||||
|
||||
static bool the_end = false;
|
||||
|
||||
static std :: vector <ReactiveThread *> reac_threads;
|
||||
|
||||
|
||||
ReactiveThread :: ReactiveThread ()
|
||||
{
|
||||
|
||||
reac_threads.push_back (this);
|
||||
sem_init (& sem, 0, 0);
|
||||
}
|
||||
|
||||
void ReactiveThread :: sleep ()
|
||||
{
|
||||
|
||||
sem_wait (& sem);
|
||||
}
|
||||
|
||||
void ReactiveThread :: wakeUp ()
|
||||
{
|
||||
|
||||
sem_post (& sem);
|
||||
}
|
||||
|
||||
void initReactiveThreadsEnv ()
|
||||
{
|
||||
|
||||
the_end = false;
|
||||
reac_threads.clear ();
|
||||
}
|
||||
|
||||
void stopReactiveThreads ()
|
||||
{
|
||||
|
||||
the_end = true;
|
||||
for (unsigned i = 0; i < reac_threads.size (); i ++)
|
||||
reac_threads [i] -> wakeUp ();
|
||||
reac_threads.clear ();
|
||||
}
|
||||
|
||||
bool theEnd ()
|
||||
{
|
||||
return the_end;
|
||||
}
|
||||
66
branches/cmakemodif/paradiseo-peo/src/core/reac_thread.h
Normal file
66
branches/cmakemodif/paradiseo-peo/src/core/reac_thread.h
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
* <reac_thread.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 REAC_THREAD_H_
|
||||
#define REAC_THREAD_H_
|
||||
|
||||
#include <semaphore.h>
|
||||
|
||||
#include "thread.h"
|
||||
|
||||
|
||||
class ReactiveThread : public Thread
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/* Ctor */
|
||||
ReactiveThread ();
|
||||
|
||||
void sleep ();
|
||||
|
||||
void wakeUp ();
|
||||
|
||||
private:
|
||||
|
||||
sem_t sem;
|
||||
};
|
||||
|
||||
extern void initReactiveThreadsEnv ();
|
||||
|
||||
extern void stopReactiveThreads ();
|
||||
|
||||
#endif /*REAC_THREAD_H_*/
|
||||
55
branches/cmakemodif/paradiseo-peo/src/core/ring_topo.cpp
Normal file
55
branches/cmakemodif/paradiseo-peo/src/core/ring_topo.cpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* <ring_topo.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ring_topo.h"
|
||||
|
||||
void RingTopology :: setNeighbors (Cooperative * __mig,
|
||||
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;
|
||||
}
|
||||
}
|
||||
53
branches/cmakemodif/paradiseo-peo/src/core/ring_topo.h
Normal file
53
branches/cmakemodif/paradiseo-peo/src/core/ring_topo.h
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* <ring_topo.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __ring_topo_h
|
||||
#define __ring_topo_h
|
||||
|
||||
#include "topology.h"
|
||||
|
||||
class RingTopology : public Topology
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
void setNeighbors (Cooperative * __mig,
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
46
branches/cmakemodif/paradiseo-peo/src/core/rmc.h
Normal file
46
branches/cmakemodif/paradiseo-peo/src/core/rmc.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/*
|
||||
* <rmc.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __rmc_h
|
||||
#define __rmc_h
|
||||
|
||||
extern void initRMC (int & __argc, char * * & __argv);
|
||||
|
||||
extern void runRMC (); /* Resource Management and Communication */
|
||||
|
||||
extern void finalizeRMC ();
|
||||
|
||||
#endif
|
||||
225
branches/cmakemodif/paradiseo-peo/src/core/runner.cpp
Normal file
225
branches/cmakemodif/paradiseo-peo/src/core/runner.cpp
Normal file
|
|
@ -0,0 +1,225 @@
|
|||
/*
|
||||
* <runner.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "runner.h"
|
||||
#include "reac_thread.h"
|
||||
#include "peo_debug.h"
|
||||
#include "messaging.h"
|
||||
|
||||
#include "../rmc/mpi/mess.h"
|
||||
#include "../rmc/mpi/tags.h"
|
||||
|
||||
#include "../rmc/mpi/node.h"
|
||||
#include "../rmc/mpi/schema.h"
|
||||
|
||||
|
||||
static std :: vector <pthread_t *> ll_threads; /* Low-level runner threads */
|
||||
|
||||
static std :: vector <Runner *> the_runners;
|
||||
|
||||
static unsigned num_def_runners = 0; /* Number of defined runners */
|
||||
|
||||
static unsigned num_local_exec_runners = 0; /* Number of locally executing runners */
|
||||
|
||||
static unsigned num_exec_runners = 0; /* Number of globally executing runners */
|
||||
|
||||
|
||||
extern int getNodeRank ();
|
||||
|
||||
extern int getNumberOfNodes ();
|
||||
|
||||
extern void wakeUpCommunicator ();
|
||||
|
||||
|
||||
Runner :: Runner ()
|
||||
{
|
||||
|
||||
exec_id = 0;
|
||||
def_id = ++ num_def_runners;
|
||||
|
||||
the_runners.push_back (this);
|
||||
|
||||
sem_init (& sem_start, 0, 0);
|
||||
sem_init (& sem_cntxt, 0, 0);
|
||||
}
|
||||
|
||||
RUNNER_ID Runner :: getDefinitionID ()
|
||||
{
|
||||
|
||||
return def_id;
|
||||
}
|
||||
|
||||
RUNNER_ID Runner :: getExecutionID ()
|
||||
{
|
||||
|
||||
return exec_id;
|
||||
}
|
||||
|
||||
void Runner :: setExecutionID (const RUNNER_ID& execution_id)
|
||||
{
|
||||
|
||||
exec_id = execution_id;
|
||||
}
|
||||
|
||||
Runner * getRunner (RUNNER_ID __key)
|
||||
{
|
||||
|
||||
return dynamic_cast <Runner *> (getCommunicable (__key));
|
||||
}
|
||||
|
||||
void initializeContext ()
|
||||
{
|
||||
|
||||
num_local_exec_runners = 0;
|
||||
|
||||
// setting up the execution IDs & counting the number of local exec. runners
|
||||
for (unsigned i = 0; i < the_runners.size (); i ++)
|
||||
{
|
||||
the_runners [i] -> setExecutionID ( my_node -> execution_id_run[ i ] );
|
||||
if (the_runners [i] -> isAssignedLocally ()) num_local_exec_runners ++;
|
||||
}
|
||||
|
||||
collectiveCountOfRunners( &num_local_exec_runners, &num_exec_runners );
|
||||
|
||||
// synchronizeNodes ();
|
||||
|
||||
for (unsigned i = 0; i < the_runners.size (); i ++)
|
||||
if (the_runners [i] -> isAssignedLocally ()) the_runners [i] -> notifyContextInitialized ();
|
||||
}
|
||||
|
||||
void Runner :: waitStarting ()
|
||||
{
|
||||
|
||||
sem_wait (& sem_start);
|
||||
}
|
||||
|
||||
void Runner :: waitContextInitialization ()
|
||||
{
|
||||
|
||||
sem_wait (& sem_cntxt);
|
||||
}
|
||||
|
||||
void Runner :: start ()
|
||||
{
|
||||
|
||||
setActive ();
|
||||
|
||||
sem_post (& sem_start);
|
||||
|
||||
waitContextInitialization ();
|
||||
run ();
|
||||
terminate ();
|
||||
}
|
||||
|
||||
void startRunners ()
|
||||
{
|
||||
|
||||
/* Runners */
|
||||
for (unsigned i = 0; i < the_runners.size (); i ++)
|
||||
if (the_runners [i] -> isAssignedLocally ())
|
||||
{
|
||||
addThread (the_runners [i], ll_threads);
|
||||
the_runners [i] -> waitStarting ();
|
||||
}
|
||||
|
||||
printDebugMessage ("launched the parallel runners");
|
||||
}
|
||||
|
||||
void joinRunners ()
|
||||
{
|
||||
|
||||
joinThreads (ll_threads);
|
||||
the_runners.clear();
|
||||
}
|
||||
|
||||
bool atLeastOneActiveRunner ()
|
||||
{
|
||||
|
||||
return num_exec_runners;
|
||||
}
|
||||
|
||||
unsigned numberOfActiveRunners ()
|
||||
{
|
||||
|
||||
return num_exec_runners;
|
||||
}
|
||||
|
||||
void Runner :: notifyContextInitialized ()
|
||||
{
|
||||
|
||||
sem_post (& sem_cntxt);
|
||||
}
|
||||
|
||||
void Runner :: notifySendingTermination ()
|
||||
{
|
||||
|
||||
printDebugMessage ("I am informed that everyone received my termination notification.");
|
||||
setPassive ();
|
||||
}
|
||||
|
||||
void unpackTerminationOfRunner ()
|
||||
{
|
||||
|
||||
RUNNER_ID finished_id;
|
||||
unpack (finished_id);
|
||||
|
||||
num_exec_runners --;
|
||||
|
||||
printDebugMessage ("I'm noticed of the termination of a runner");
|
||||
|
||||
if (!num_exec_runners)
|
||||
{
|
||||
|
||||
printDebugMessage ("All the runners have terminated - now stopping the reactive threads.");
|
||||
stopReactiveThreads ();
|
||||
printDebugMessage ("Reactive threads stopped!");
|
||||
}
|
||||
|
||||
wakeUpCommunicator ();
|
||||
}
|
||||
|
||||
void initRunnersEnv ()
|
||||
{
|
||||
|
||||
ll_threads.clear ();
|
||||
the_runners.clear ();
|
||||
|
||||
num_def_runners = 0;
|
||||
num_local_exec_runners = 0;
|
||||
num_exec_runners = 0;
|
||||
}
|
||||
106
branches/cmakemodif/paradiseo-peo/src/core/runner.h
Normal file
106
branches/cmakemodif/paradiseo-peo/src/core/runner.h
Normal file
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* <runner.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __runner_h
|
||||
#define __runner_h
|
||||
|
||||
#include <eoFunctor.h>
|
||||
|
||||
#include "communicable.h"
|
||||
#include "thread.h"
|
||||
|
||||
|
||||
typedef unsigned RUNNER_ID;
|
||||
|
||||
|
||||
class Runner : public Communicable, public Thread
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
Runner ();
|
||||
|
||||
RUNNER_ID getDefinitionID ();
|
||||
|
||||
RUNNER_ID getExecutionID ();
|
||||
|
||||
void setExecutionID (const RUNNER_ID& execution_id);
|
||||
|
||||
bool isAssignedLocally ();
|
||||
|
||||
void waitStarting ();
|
||||
|
||||
void waitContextInitialization ();
|
||||
|
||||
void start ();
|
||||
|
||||
virtual void run () = 0;
|
||||
|
||||
void terminate ();
|
||||
|
||||
void notifyContextInitialized ();
|
||||
|
||||
void notifySendingTermination ();
|
||||
|
||||
void packTermination ();
|
||||
|
||||
private :
|
||||
|
||||
sem_t sem_start;
|
||||
sem_t sem_cntxt;
|
||||
|
||||
unsigned def_id;
|
||||
unsigned exec_id;
|
||||
};
|
||||
|
||||
|
||||
extern void initRunnersEnv ();
|
||||
|
||||
extern Runner * getRunner (RUNNER_ID __key);
|
||||
|
||||
extern void initializeContext ();
|
||||
|
||||
extern void startRunners ();
|
||||
|
||||
extern void joinRunners ();
|
||||
|
||||
extern bool atLeastOneActiveRunner ();
|
||||
|
||||
extern unsigned numberOfActiveRunners ();
|
||||
|
||||
extern void unpackTerminationOfRunner ();
|
||||
|
||||
#endif
|
||||
84
branches/cmakemodif/paradiseo-peo/src/core/service.cpp
Normal file
84
branches/cmakemodif/paradiseo-peo/src/core/service.cpp
Normal file
|
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* <service.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "service.h"
|
||||
|
||||
void Service :: setOwner (Thread & __owner)
|
||||
{
|
||||
|
||||
owner = & __owner;
|
||||
}
|
||||
|
||||
Thread * Service :: getOwner ()
|
||||
{
|
||||
|
||||
return owner;
|
||||
}
|
||||
|
||||
Service * getService (SERVICE_ID __key)
|
||||
{
|
||||
|
||||
return dynamic_cast <Service *> (getCommunicable (__key));
|
||||
}
|
||||
|
||||
void Service :: notifySendingData ()
|
||||
{ }
|
||||
|
||||
void Service :: notifySendingResourceRequest ()
|
||||
{
|
||||
|
||||
num_sent_rr --;
|
||||
if (! num_sent_rr)
|
||||
notifySendingAllResourceRequests ();
|
||||
}
|
||||
|
||||
void Service :: notifySendingAllResourceRequests ()
|
||||
{ }
|
||||
|
||||
void Service :: packData ()
|
||||
{}
|
||||
|
||||
void Service :: unpackData ()
|
||||
{}
|
||||
|
||||
void Service :: execute ()
|
||||
{}
|
||||
|
||||
void Service :: packResult ()
|
||||
{}
|
||||
|
||||
void Service :: unpackResult ()
|
||||
{}
|
||||
80
branches/cmakemodif/paradiseo-peo/src/core/service.h
Normal file
80
branches/cmakemodif/paradiseo-peo/src/core/service.h
Normal file
|
|
@ -0,0 +1,80 @@
|
|||
/*
|
||||
* <service.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __service_h
|
||||
#define __service_h
|
||||
|
||||
#include "communicable.h"
|
||||
#include "thread.h"
|
||||
|
||||
|
||||
typedef unsigned SERVICE_ID;
|
||||
|
||||
class Service : public Communicable
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
void setOwner (Thread & __owner);
|
||||
|
||||
Thread * getOwner ();
|
||||
|
||||
void requestResourceRequest (unsigned __how_many = 1);
|
||||
void packResourceRequest ();
|
||||
|
||||
virtual void packData ();
|
||||
virtual void unpackData ();
|
||||
|
||||
virtual void execute ();
|
||||
|
||||
virtual void packResult ();
|
||||
virtual void unpackResult ();
|
||||
|
||||
virtual void notifySendingData ();
|
||||
virtual void notifySendingResourceRequest ();
|
||||
virtual void notifySendingAllResourceRequests ();
|
||||
|
||||
private :
|
||||
|
||||
Thread * owner; /* Owner thread (i.e. 'uses' that service) */
|
||||
|
||||
unsigned num_sent_rr; /* Number of RR not really sent (i.e. still in the sending queue)*/
|
||||
|
||||
};
|
||||
|
||||
extern Service * getService (SERVICE_ID __key);
|
||||
|
||||
#endif
|
||||
75
branches/cmakemodif/paradiseo-peo/src/core/star_topo.cpp
Normal file
75
branches/cmakemodif/paradiseo-peo/src/core/star_topo.cpp
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* <star_topo.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <cassert>
|
||||
#include "star_topo.h"
|
||||
|
||||
StarTopology :: StarTopology () : center( NULL ) {}
|
||||
|
||||
void StarTopology :: setNeighbors (Cooperative * __mig,
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to)
|
||||
{
|
||||
|
||||
assert( center != NULL );
|
||||
|
||||
__from.clear () ;
|
||||
__to.clear () ;
|
||||
|
||||
if ( __mig == center )
|
||||
{
|
||||
|
||||
for (unsigned i = 0; i < mig.size (); i ++)
|
||||
{
|
||||
if (mig [i] != center)
|
||||
{
|
||||
__from.push_back (mig [i]);
|
||||
__to.push_back (mig [i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
__from.push_back (center);
|
||||
__to.push_back (center);
|
||||
}
|
||||
}
|
||||
|
||||
void StarTopology :: setCenter (Cooperative& __center)
|
||||
{
|
||||
|
||||
center = &__center;
|
||||
}
|
||||
60
branches/cmakemodif/paradiseo-peo/src/core/star_topo.h
Normal file
60
branches/cmakemodif/paradiseo-peo/src/core/star_topo.h
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* <star_topo.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __star_topo_h
|
||||
#define __star_topo_h
|
||||
|
||||
#include "topology.h"
|
||||
|
||||
class StarTopology : public Topology
|
||||
{
|
||||
|
||||
public :
|
||||
|
||||
StarTopology ();
|
||||
|
||||
void setNeighbors (Cooperative * __mig,
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to);
|
||||
|
||||
void setCenter (Cooperative& __center);
|
||||
|
||||
private :
|
||||
|
||||
Cooperative* center;
|
||||
};
|
||||
|
||||
#endif
|
||||
120
branches/cmakemodif/paradiseo-peo/src/core/thread.cpp
Normal file
120
branches/cmakemodif/paradiseo-peo/src/core/thread.cpp
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
/*
|
||||
* <thread.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "thread.h"
|
||||
|
||||
static std :: vector <Thread *> threads;
|
||||
|
||||
unsigned num_act = 0;
|
||||
|
||||
|
||||
Thread :: Thread ()
|
||||
{
|
||||
|
||||
threads.push_back (this);
|
||||
act = false;
|
||||
}
|
||||
|
||||
Thread :: ~ Thread ()
|
||||
{
|
||||
|
||||
/* Nothing ! */
|
||||
}
|
||||
|
||||
void Thread :: setActive ()
|
||||
{
|
||||
|
||||
if (! act)
|
||||
{
|
||||
|
||||
act = true;
|
||||
num_act ++;
|
||||
}
|
||||
}
|
||||
|
||||
void Thread :: setPassive ()
|
||||
{
|
||||
|
||||
if (act)
|
||||
{
|
||||
|
||||
act = false;
|
||||
num_act --;
|
||||
}
|
||||
}
|
||||
|
||||
void initThreadsEnv ()
|
||||
{
|
||||
|
||||
threads.clear ();
|
||||
num_act = 0;
|
||||
}
|
||||
|
||||
bool atLeastOneActiveThread ()
|
||||
{
|
||||
|
||||
return num_act;
|
||||
}
|
||||
|
||||
static void * launch (void * __arg)
|
||||
{
|
||||
|
||||
Thread * thr = (Thread *) __arg;
|
||||
thr -> start ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void addThread (Thread * __hl_thread, std :: vector <pthread_t *> & __ll_threads)
|
||||
{
|
||||
|
||||
pthread_t * ll_thr = new pthread_t;
|
||||
__ll_threads.push_back (ll_thr);
|
||||
pthread_create (ll_thr, 0, launch, __hl_thread);
|
||||
}
|
||||
|
||||
void joinThreads (std :: vector <pthread_t *> & __threads)
|
||||
{
|
||||
|
||||
for (unsigned i = 0; i < __threads.size (); i ++)
|
||||
{
|
||||
pthread_join (* __threads [i], 0);
|
||||
delete __threads [i];
|
||||
}
|
||||
__threads.clear();
|
||||
}
|
||||
76
branches/cmakemodif/paradiseo-peo/src/core/thread.h
Normal file
76
branches/cmakemodif/paradiseo-peo/src/core/thread.h
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* <thread.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 THREAD_H_
|
||||
#define THREAD_H_
|
||||
|
||||
#include <vector>
|
||||
#include <pthread.h>
|
||||
|
||||
/* A high-level thread */
|
||||
class Thread
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
/* Ctor */
|
||||
Thread ();
|
||||
|
||||
/* Dtor */
|
||||
virtual ~ Thread ();
|
||||
|
||||
/* Go ! */
|
||||
virtual void start () = 0;
|
||||
|
||||
void setActive ();/* It means the current process is going to send messages soon */
|
||||
void setPassive ();/* The current process is not going to perform send operations
|
||||
(but it may receive messages) */
|
||||
|
||||
private :
|
||||
|
||||
bool act;
|
||||
};
|
||||
|
||||
extern void initThreadsEnv ();
|
||||
|
||||
extern void addThread (Thread * __hl_thread, std :: vector <pthread_t *> & __ll_threads);
|
||||
|
||||
extern void joinThreads (std :: vector <pthread_t *> & __ll_threads);
|
||||
|
||||
extern bool atLeastOneActiveThread (); /* It returns 'true' iff at least one process is going
|
||||
to send messages */
|
||||
|
||||
#endif /*THREAD_H_*/
|
||||
55
branches/cmakemodif/paradiseo-peo/src/core/topology.cpp
Normal file
55
branches/cmakemodif/paradiseo-peo/src/core/topology.cpp
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* <topology.cpp>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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
|
||||
*
|
||||
*/
|
||||
|
||||
#include "topology.h"
|
||||
|
||||
Topology :: ~ Topology ()
|
||||
{
|
||||
|
||||
/* Nothing ! */
|
||||
}
|
||||
|
||||
void Topology :: add (Cooperative & __mig)
|
||||
{
|
||||
|
||||
mig.push_back (& __mig) ;
|
||||
}
|
||||
|
||||
Topology :: operator std :: vector <Cooperative *>& ()
|
||||
{
|
||||
|
||||
return mig;
|
||||
}
|
||||
64
branches/cmakemodif/paradiseo-peo/src/core/topology.h
Normal file
64
branches/cmakemodif/paradiseo-peo/src/core/topology.h
Normal file
|
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* <topology.h>
|
||||
* Copyright (C) DOLPHIN Project-Team, INRIA Futurs, 2006-2008
|
||||
* (C) OPAC Team, LIFL, 2002-2008
|
||||
*
|
||||
* 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 __topology_h
|
||||
#define __topology_h
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include "cooperative.h"
|
||||
|
||||
class Topology
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
virtual ~Topology ();
|
||||
|
||||
void add (Cooperative & __mig);
|
||||
|
||||
virtual void setNeighbors (Cooperative * __mig,
|
||||
std :: vector <Cooperative *> & __from,
|
||||
std :: vector <Cooperative *> & __to) = 0;
|
||||
|
||||
operator std :: vector <Cooperative *>& ();
|
||||
|
||||
protected:
|
||||
|
||||
std :: vector <Cooperative *> mig;
|
||||
};
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue