From 58ac35bed76ab1630db4f6c591ab7ce69c3f0bac Mon Sep 17 00:00:00 2001 From: boufaras Date: Thu, 10 Feb 2011 14:07:27 +0000 Subject: [PATCH] git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2162 331e1502-861f-0410-8da2-ba01fb791d7f --- ParadisEO-GPU/tutoriel/QAP/CMakeLists.txt | 4 +- ParadisEO-GPU/tutoriel/QAP/testSimpleHC.cu | 65 +++++++++++++++------- 2 files changed, 48 insertions(+), 21 deletions(-) diff --git a/ParadisEO-GPU/tutoriel/QAP/CMakeLists.txt b/ParadisEO-GPU/tutoriel/QAP/CMakeLists.txt index fb5335309..ed7931e38 100644 --- a/ParadisEO-GPU/tutoriel/QAP/CMakeLists.txt +++ b/ParadisEO-GPU/tutoriel/QAP/CMakeLists.txt @@ -44,8 +44,8 @@ LINK_DIRECTORIES(${PARADISEO_EO_BIN_DIR}/lib ${NVIDIA_LIB_DIR} ${CUDA_LIB_DIR} CUDA_ADD_EXECUTABLE(CutestSimpleHC_GPU testSimpleHC.cu) CUDA_ADD_EXECUTABLE(CutestSimpleTS_GPU testSimpleTS.cu) -TARGET_LINK_LIBRARIES(CutestSimpleHC_GPU eoutils ga eo libcutil.a) -TARGET_LINK_LIBRARIES(CutestSimpleTS_GPU eoutils ga eo libcutil.a) +TARGET_LINK_LIBRARIES(CutestSimpleHC_GPU eoutils ga eo ${cutil}) +TARGET_LINK_LIBRARIES(CutestSimpleTS_GPU eoutils ga eo ${cutil}) diff --git a/ParadisEO-GPU/tutoriel/QAP/testSimpleHC.cu b/ParadisEO-GPU/tutoriel/QAP/testSimpleHC.cu index 49870240b..863f62e95 100644 --- a/ParadisEO-GPU/tutoriel/QAP/testSimpleHC.cu +++ b/ParadisEO-GPU/tutoriel/QAP/testSimpleHC.cu @@ -1,5 +1,39 @@ +/* + + Copyright (C) DOLPHIN Project-Team, INRIA Lille - Nord Europe, 2006-2010 + + 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 +*/ + //Init the number of threads per block -#define BLOCK_SIZE 64 +#define BLOCK_SIZE 256 #include #include #include @@ -48,7 +82,7 @@ typedef moCudaKswapNeighborhood Neighborhood; int main(int argc, char **argv) { - /* ========================================================= + /* ========================================================= * * Parameters * @@ -73,8 +107,8 @@ int main(int argc, char **argv) parser.processParam( vecSizeParam, "Representation" ); unsigned vecSize = vecSizeParam.value(); -// Swap number - eoValueParam KSwapParam(0, "KSwap", "swap number", 'N'); + // Swap number + eoValueParam KSwapParam(1, "KSwap", "swap number", 'N'); parser.processParam(KSwapParam, "KSwap" ); unsigned KSwap = KSwapParam.value(); @@ -110,8 +144,8 @@ int main(int argc, char **argv) * * ========================================================= */ - QAPData _data(argv[1]); - vecSize=_data.sizeData; + QAPData _data(argv[1]); + vecSize=_data.sizeData; /* ========================================================= * * Initilisation of the solution @@ -119,21 +153,16 @@ int main(int argc, char **argv) * ========================================================= */ solution sol(vecSize); - - /*for (int i=0;i eval(_data); unsigned long int sizeMap=sizeMapping(vecSize,KSwap); - std::cout<<"sizeMap : "< incr_eval; moCudaKswapEval > cueval(sizeMap,incr_eval); @@ -191,20 +220,18 @@ int main(int argc, char **argv) //Can be eval here, else it will be done at the beginning of the localSearch eval(sol); - std::cout << "initial: " << sol.fitness()<< std::endl; + std::cout << "initial: " << sol<< std::endl; // Create timer for timing CUDA calculation moCudaTimer timer; timer.start(); localSearch(sol); - std::cout << "final: " << sol.fitness() << std::endl; + std::cout << "final: " << sol << std::endl; timer.stop(); printf("CUDA execution time = %f ms\n",timer.getTime()); timer.deleteTimer(); - /* simpleHC(sol); - std::cout << "final: " << sol.fitness() << std::endl;*/ - _data.cudaObject.free(dev_a); - _data.cudaObject.free(dev_b); + _data.cudaObject.free(dev_a); + _data.cudaObject.free(dev_b); -return 0; + return 0; }