git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2162 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
a7c2197185
commit
58ac35bed7
2 changed files with 48 additions and 21 deletions
|
|
@ -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})
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,39 @@
|
|||
/*
|
||||
<testSimpleHC.cu>
|
||||
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 <iostream>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
|
|
@ -48,7 +82,7 @@ typedef moCudaKswapNeighborhood<Neighbor> 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<unsigned int> KSwapParam(0, "KSwap", "swap number", 'N');
|
||||
// Swap number
|
||||
eoValueParam<unsigned int> 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<int> _data(argv[1]);
|
||||
vecSize=_data.sizeData;
|
||||
QAPData<int> _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<vecSize;i++)
|
||||
std::cout << sol[i] << " " ;
|
||||
std::cout<< std::endl;*/
|
||||
_data.cudaObject.memCopyGlobalVariable(dev_a,_data.a_d);
|
||||
_data.cudaObject.memCopyGlobalVariable(dev_b,_data.b_d);
|
||||
|
||||
/* =========================================================
|
||||
/* =========================================================
|
||||
*
|
||||
* Evaluation of a solution neighbor's
|
||||
*
|
||||
* ========================================================= */
|
||||
QAPEval<solution> eval(_data);
|
||||
unsigned long int sizeMap=sizeMapping(vecSize,KSwap);
|
||||
std::cout<<"sizeMap : "<<sizeMap<<std::endl;
|
||||
QAPIncrEval<Neighbor> incr_eval;
|
||||
moCudaKswapEval<Neighbor,QAPIncrEval<Neighbor> > 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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue