From ef9eb7c173c9c6ec271fa5132b7ad7fcaf791f5b Mon Sep 17 00:00:00 2001 From: boufaras Date: Wed, 25 May 2011 21:45:10 +0000 Subject: [PATCH] git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2262 331e1502-861f-0410-8da2-ba01fb791d7f --- .../src/neighborhood/moCudaBitNeighbor.h | 121 ------------------ .../neighborhood/moCudaKflipNeighborhood.h | 119 ----------------- .../neighborhood/moCudaKswapNeighborhood.h | 119 ----------------- .../neighborhood/moCudaOrderNeighborhood.h | 96 -------------- .../moCudaRndWithReplNeighborhood.h | 88 ------------- .../moCudaRndWithoutReplNeighborhood.h | 90 ------------- 6 files changed, 633 deletions(-) delete mode 100644 branches/ParadisEO-GPU/src/neighborhood/moCudaBitNeighbor.h delete mode 100644 branches/ParadisEO-GPU/src/neighborhood/moCudaKflipNeighborhood.h delete mode 100644 branches/ParadisEO-GPU/src/neighborhood/moCudaKswapNeighborhood.h delete mode 100644 branches/ParadisEO-GPU/src/neighborhood/moCudaOrderNeighborhood.h delete mode 100644 branches/ParadisEO-GPU/src/neighborhood/moCudaRndWithReplNeighborhood.h delete mode 100644 branches/ParadisEO-GPU/src/neighborhood/moCudaRndWithoutReplNeighborhood.h diff --git a/branches/ParadisEO-GPU/src/neighborhood/moCudaBitNeighbor.h b/branches/ParadisEO-GPU/src/neighborhood/moCudaBitNeighbor.h deleted file mode 100644 index 75cf84b88..000000000 --- a/branches/ParadisEO-GPU/src/neighborhood/moCudaBitNeighbor.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - - Jerémie Humeau, Boufaras Karima, Thé Van LUONG - - 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 _moCudaBitNeighbor_h -#define _moCudaBitNeighbor_h - -#include -#include - -/** - * Neighbor related to a solution vector of EOT (type) - */ - -template - class moCudaBitNeighbor: public moBackableNeighbor , - public moIndexNeighbor { - - public: - - using moBackableNeighbor::fitness; - using moIndexNeighbor::key; - - /** - * move the solution - * @param - * _solution the solution to move - */ - - virtual void move(EOT & _solution) { - - _solution[key] = !_solution[key]; - - } - - /** - * move back the solution (useful for the evaluation by modif) - * @param - * _solution the solution to move back - */ - - virtual void moveBack(EOT & _solution) { - - _solution[key] = !_solution[key]; - - } - - /** - * Return the class name. - * @return the class name as a std::string - */ - virtual std::string className() const { - return "moCudaBitNeighbor"; - } - - /** - * Read object.\ - * Calls base class, just in case that one had something to do. - * The read and print methods should be compatible and have the same format. - * In principle, format is "plain": they just print a number - * @param _is a std::istream. - * @throw runtime_std::exception If a valid object can't be read. - */ - - virtual void readFrom(std::istream& _is) { - std::string fitness_str; - int pos = _is.tellg(); - _is >> fitness_str; - if (fitness_str == "INVALID") { - throw std::runtime_error("invalid fitness"); - } else { - Fitness repFit; - _is.seekg(pos); - _is >> repFit; - _is >> key; - fitness(repFit); - } - } - - /** - * Write object. Called printOn since it prints the object _on_ a stream. - * @param _os A std::ostream. - */ - - virtual void printOn(std::ostream& _os) const { - _os << fitness() << ' ' << key << std::endl; - } - -}; - -#endif diff --git a/branches/ParadisEO-GPU/src/neighborhood/moCudaKflipNeighborhood.h b/branches/ParadisEO-GPU/src/neighborhood/moCudaKflipNeighborhood.h deleted file mode 100644 index c26aecd70..000000000 --- a/branches/ParadisEO-GPU/src/neighborhood/moCudaKflipNeighborhood.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - - Boufaras Karima, Thé Van Luong - - This software is governed by the CeCILL license under French law and - abiding by the rules of distribution of free software. You can ue, - 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". - - 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 _moCudaKswapNeighborhood_h -#define _moCudaKswapNeighborhood_h - -#include -#include - -/** - * K-flip Neighborhood - */ -template -class moCudaKflipNeighborhood: public moKswapNeighborhood { - - public: - - /** - * Define a Neighbor and type of a solution corresponding - */ - - typedef N Neighbor; - typedef typename Neighbor::EOT EOT; - - using moKswapNeighborhood::neighborhoodSize; - using moKswapNeighborhood::currentIndex; - using moKswapNeighborhood::indices; - using moKswapNeighborhood::mapping; - using moKswapNeighborhood::Kswap; - using moKswapNeighborhood::size; - using moKswapNeighborhood::mutex; - - /** - * Constructor - * @param _size the size of solution - * @param _size the solution size - * @param _Kflip the number of bit to flip - * @param _eval show how to evaluate neighborhood of a solution at one time - */ - - moCudaKflipNeighborhood(unsigned int _size, unsigned int _Kflip, - moCudaEval& _eval) : - moKswapNeighborhood (_size, _Kflip), eval(_eval) { - sendMapping = true; - cudaMalloc((void**) &device_Mapping, sizeof(unsigned int) - * neighborhoodSize * (_Kflip + 1)); - } - ; - - /** - *Destructor - */ - - ~moCudaKflipNeighborhood() { - - cudaFree(device_Mapping); - } - - /** - * Initialization of the neighborhood - * @param _solution the solution to explore - * @param _current the first neighbor - */ - - virtual void init(EOT& _solution, Neighbor& _current) { - - moKswapNeighborhood::init(_solution, _current); - if (sendMapping) { - cudaMemcpy(device_Mapping, mapping, (Kswap + 1) * neighborhoodSize - * sizeof(unsigned int), cudaMemcpyHostToDevice); - sendMapping = false; - } - //Compute all neighbors fitness at one time - eval.neighborhoodKflipEval(_solution, device_Mapping, Kswap); - } - - /** - * Return the class Name - * @return the class name as a std::string - */ - virtual std::string className() const { - return "moCudaKSwapNeighborhood"; - } - - protected: - - moCudaEval& eval; - bool sendMapping; - unsigned int * device_Mapping; - -}; - -#endif diff --git a/branches/ParadisEO-GPU/src/neighborhood/moCudaKswapNeighborhood.h b/branches/ParadisEO-GPU/src/neighborhood/moCudaKswapNeighborhood.h deleted file mode 100644 index b7138cd73..000000000 --- a/branches/ParadisEO-GPU/src/neighborhood/moCudaKswapNeighborhood.h +++ /dev/null @@ -1,119 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - - Boufaras Karima, Thé Van Luong - - This software is governed by the CeCILL license under French law and - abiding by the rules of distribution of free software. You can ue, - 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". - - 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 _moCudaKswapNeighborhood_h -#define _moCudaKswapNeighborhood_h - -#include -#include - -/** - * K-Swap Neighborhood - */ -template -class moCudaKswapNeighborhood: public moKswapNeighborhood { - - public: - - /** - * Define a Neighbor and type of a solution corresponding - */ - - typedef N Neighbor; - typedef typename Neighbor::EOT EOT; - - using moKswapNeighborhood::neighborhoodSize; - using moKswapNeighborhood::currentIndex; - using moKswapNeighborhood::indices; - using moKswapNeighborhood::mapping; - using moKswapNeighborhood::Kswap; - using moKswapNeighborhood::size; - using moKswapNeighborhood::mutex; - - /** - * Constructor - * @param _size the size of solution - * @param _Kswap the number of swap - * @param _eval show how to evaluate neighborhood of a solution at one time - */ - - moCudaKswapNeighborhood(unsigned int _size, unsigned int _Kswap, - moCudaEval& _eval) : - moKswapNeighborhood (_size, _Kswap), eval(_eval) { - sendMapping = true; - cudaMalloc((void**) &device_Mapping, sizeof(unsigned int) - * neighborhoodSize * (Kswap + 1)); - } - ; - - /** - *Destructor - */ - - ~moCudaKswapNeighborhood() { - - cudaFree(device_Mapping); - } - - /** - * Initialization of the neighborhood - * @param _solution the solution to explore - * @param _current the first neighbor - */ - - virtual void init(EOT& _solution, Neighbor& _current) { - - moKswapNeighborhood::init(_solution, _current); - //Send Mapping for only the first time - if (sendMapping) { - cudaMemcpy(device_Mapping, mapping, (Kswap + 1) * neighborhoodSize - * sizeof(unsigned int), cudaMemcpyHostToDevice); - sendMapping = false; - } - //Compute all neighbors fitness at one time - eval.neighborhoodKswapEval(_solution, device_Mapping, Kswap); - } - - /** - * Return the class Name - * @return the class name as a std::string - */ - virtual std::string className() const { - return "moCudaKSwapNeighborhood"; - } - - protected: - - moCudaEval& eval; - bool sendMapping; - unsigned int * device_Mapping; - -}; - -#endif diff --git a/branches/ParadisEO-GPU/src/neighborhood/moCudaOrderNeighborhood.h b/branches/ParadisEO-GPU/src/neighborhood/moCudaOrderNeighborhood.h deleted file mode 100644 index 9abb54aa0..000000000 --- a/branches/ParadisEO-GPU/src/neighborhood/moCudaOrderNeighborhood.h +++ /dev/null @@ -1,96 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - - Jerémie Humeau, Thé Van LUONG, Karima Boufaras - - 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 _moCudaOrderNeighborhood_h -#define _moCudaOrderNeighborhood_h - -#include -#include - -/** - * An ordered neighborhood with parallel evaluation - */ - -template -class moCudaOrderNeighborhood: public moOrderNeighborhood { - - public: - - /** - * Define type of a solution corresponding to Neighbor - */ - - typedef N Neighbor; - typedef typename Neighbor::EOT EOT; - - using moOrderNeighborhood::neighborhoodSize; - using moOrderNeighborhood::currentIndex; - - /** - * Constructor - * @param _neighborhoodSize the size of the neighborhood - * @param _eval show how to evaluate neighborhood of a solution at one time - */ - - moCudaOrderNeighborhood(unsigned int _neighborhoodSize, - moCudaEval& _eval) : - moOrderNeighborhood (_neighborhoodSize), eval(_eval) { - } - - /** - * Initialization of the neighborhood - *@param _solution the solution to explore - *@param _neighbor the first neighbor - */ - - virtual void init(EOT & _solution, Neighbor & _neighbor) { - - moOrderNeighborhood::init(_solution, _neighbor); - //Compute all neighbors fitness at one time - eval.neighborhoodEval(_solution); - } - - /** - * Return the class name. - * @return the class name as a std::string - */ - virtual std::string className() const { - return "moCudaOrderNeighborhood"; - } - - protected: - moCudaEval& eval; -}; - -#endif diff --git a/branches/ParadisEO-GPU/src/neighborhood/moCudaRndWithReplNeighborhood.h b/branches/ParadisEO-GPU/src/neighborhood/moCudaRndWithReplNeighborhood.h deleted file mode 100644 index bf03c8b54..000000000 --- a/branches/ParadisEO-GPU/src/neighborhood/moCudaRndWithReplNeighborhood.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - - Jerémie Humeau, Karima Boufaras, Thé Van LUONG - - 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 _moCudaRndWithReplNeighborhood_h -#define _moCudaRndWithReplNeighborhood_h - -#include -#include - -/** - * A Random With replacement Neighborhood with parallel evaluation - */ -template -class moCudaRndWithReplNeighborhood: public moRndWithReplNeighborhood { - public: - - /** - * Define type of a solution corresponding to Neighbor - */ - typedef typename Neighbor::EOT EOT; - - using moRndWithReplNeighborhood::neighborhoodSize; - - /** - * Constructor - * @param _neighborhoodSize the size of the neighborhood - * @param _eval show how to evaluate neighborhood of a solution at one time - */ - moCudaRndWithReplNeighborhood(unsigned int _neighborhoodSize, moCudaEval< - Neighbor>& _eval) : - moRndWithReplNeighborhood (_neighborhoodSize), eval(_eval) { - } - - /** - * Initialization of the neighborhood - * @param _solution the solution to explore - * @param _neighbor the first neighbor - */ - virtual void init(EOT & _solution, Neighbor & _neighbor) { - moRndWithReplNeighborhood::init(_solution, _neighbor); - //Compute all neighbors fitness at one time - eval.neighborhoodEval(_solution); - - } - - /** - * Return the class Name - * @return the class name as a std::string - */ - virtual std::string className() const { - return "moCudaRndWithReplNeighborhood"; - } - protected: - moCudaEval& eval; -}; - -#endif diff --git a/branches/ParadisEO-GPU/src/neighborhood/moCudaRndWithoutReplNeighborhood.h b/branches/ParadisEO-GPU/src/neighborhood/moCudaRndWithoutReplNeighborhood.h deleted file mode 100644 index 9ec0f4303..000000000 --- a/branches/ParadisEO-GPU/src/neighborhood/moCudaRndWithoutReplNeighborhood.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - - Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 - - Jerémie Humeau, Boufaras Karima, Thé Van LUONG - 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 _moCudaRndWithoutReplNeighborhood_h -#define _moCudaRndWithoutReplNeighborhood_h - -#include -#include - -/** - * A Random without replacement Neighborhood with parallel evaluation - */ -template -class moCudaRndWithoutReplNeighborhood: public moRndWithoutReplNeighborhood { - public: - - /** - * Define type of a solution corresponding to Neighbor - */ - typedef typename Neighbor::EOT EOT; - - using moRndWithoutReplNeighborhood::neighborhoodSize; - using moRndWithoutReplNeighborhood::maxIndex; - using moRndWithoutReplNeighborhood::indexVector; - /** - * Constructor - * @param _neighborhoodSize the size of the neighborhood - * @param _eval show how to evaluate neighborhood of a solution at one time - */ - moCudaRndWithoutReplNeighborhood(unsigned int _neighborhoodSize,moCudaEval< - Neighbor>& _eval) : - moRndWithoutReplNeighborhood (_neighborhoodSize),eval(_eval) { - for (unsigned int i = 0; i < neighborhoodSize; i++) - indexVector.push_back(i); - } - - /** - * Initialization of the neighborhood - * @param _solution the solution to explore - * @param _neighbor the first neighbor - */ - virtual void init(EOT & _solution, Neighbor & _neighbor) { - moRndWithoutReplNeighborhood::init(_solution, _neighbor); - //Compute all neighbors fitness at one time - eval.neighborhoodEval(_solution); - } - - /** - * Return the class Name - * @return the class name as a std::string - */ - virtual std::string className() const { - return "moCudaRndWithoutReplNeighborhood"; - } - - protected: - moCudaEval& eval; -}; - -#endif