git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2104 331e1502-861f-0410-8da2-ba01fb791d7f
This commit is contained in:
parent
379c333733
commit
fad9840aed
1 changed files with 43 additions and 45 deletions
|
|
@ -74,13 +74,13 @@ public:
|
||||||
moCudaKswapEval(unsigned int _neighborhoodSize, IncrementEval & _incrEval) :
|
moCudaKswapEval(unsigned int _neighborhoodSize, IncrementEval & _incrEval) :
|
||||||
moCudaEval<Neighbor> (_neighborhoodSize), incrEval(_incrEval) {
|
moCudaEval<Neighbor> (_neighborhoodSize), incrEval(_incrEval) {
|
||||||
mutex = false;
|
mutex = false;
|
||||||
mutex_kswap=false;
|
mutex_kswap = false;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Destructor
|
* Destructor
|
||||||
*/
|
*/
|
||||||
~moCudaKswapEval() {
|
~moCudaKswapEval() {
|
||||||
if(mutex_kswap){
|
if (mutex_kswap) {
|
||||||
cudaFree(&device_setSolution);
|
cudaFree(&device_setSolution);
|
||||||
cudaFree(&device_tmp);
|
cudaFree(&device_tmp);
|
||||||
delete[] vect;
|
delete[] vect;
|
||||||
|
|
@ -131,7 +131,6 @@ public:
|
||||||
//Case Kswap
|
//Case Kswap
|
||||||
else if (_Kswap > 1) {
|
else if (_Kswap > 1) {
|
||||||
if (!mutex_kswap) {
|
if (!mutex_kswap) {
|
||||||
|
|
||||||
vect = new T[neighborhoodSize * _size];
|
vect = new T[neighborhoodSize * _size];
|
||||||
//Allocate the space for set of solution in the device global memory
|
//Allocate the space for set of solution in the device global memory
|
||||||
cudaMalloc((void**) &device_setSolution.vect, neighborhoodSize
|
cudaMalloc((void**) &device_setSolution.vect, neighborhoodSize
|
||||||
|
|
@ -140,7 +139,6 @@ public:
|
||||||
cudaMalloc((void**) &device_tmp.vect, neighborhoodSize
|
cudaMalloc((void**) &device_tmp.vect, neighborhoodSize
|
||||||
* sizeof(T));
|
* sizeof(T));
|
||||||
mutex_kswap = true;
|
mutex_kswap = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < neighborhoodSize; i++) {
|
for (int i = 0; i < neighborhoodSize; i++) {
|
||||||
|
|
@ -169,14 +167,14 @@ public:
|
||||||
* @param _Kflip the number of flip to do
|
* @param _Kflip the number of flip to do
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void neighborhoodKflipEval(EOT & _sol, unsigned * _mapping, unsigned _Kflip) {
|
void neighborhoodKflipEval(EOT & _sol, unsigned * _mapping,
|
||||||
|
unsigned _Kflip) {
|
||||||
|
|
||||||
// the solution size
|
// the solution size
|
||||||
unsigned _size = _sol.size();
|
unsigned _size = _sol.size();
|
||||||
|
|
||||||
// Get Current solution fitness
|
// Get Current solution fitness
|
||||||
Fitness fitness = _sol.fitness();
|
Fitness fitness = _sol.fitness();
|
||||||
|
|
||||||
if (!mutex) {
|
if (!mutex) {
|
||||||
//Allocate the space for solution in the device global memory
|
//Allocate the space for solution in the device global memory
|
||||||
cudaMalloc((void**) &device_solution.vect, _size * sizeof(T));
|
cudaMalloc((void**) &device_solution.vect, _size * sizeof(T));
|
||||||
|
|
@ -195,7 +193,7 @@ public:
|
||||||
* sizeof(Fitness), cudaMemcpyDeviceToHost);
|
* sizeof(Fitness), cudaMemcpyDeviceToHost);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
IncrementEval & incrEval;
|
IncrementEval & incrEval;
|
||||||
//NeighborhoodSize copy of solution
|
//NeighborhoodSize copy of solution
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue