git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2089 331e1502-861f-0410-8da2-ba01fb791d7f

This commit is contained in:
boufaras 2011-01-28 16:35:00 +00:00
commit 815c992a25

View file

@ -38,19 +38,19 @@
#include <memory/moCudaSpecificData.h> #include <memory/moCudaSpecificData.h>
template<class ElemType> template<class ElemType>
class QAPData: public moCudaSpecificData<ElemType> { class QAPData: public moCudaSpecificData {
public: public:
using moCudaSpecificData<ElemType>::sizeData; using moCudaSpecificData::sizeData;
using moCudaSpecificData<ElemType>::cudaObject; using moCudaSpecificData::cudaObject;
/** /**
* Default Constructor * Default Constructor
*/ */
QAPData() : QAPData() :
moCudaSpecificData<ElemType> () { moCudaSpecificData() {
} }
/** /**
@ -131,22 +131,24 @@ public:
void load(char* _fileName) { void load(char* _fileName) {
FILE *f; FILE *f;
unsigned int i,j;
int r;
f = fopen(_fileName, "r"); f = fopen(_fileName, "r");
if (f != NULL) if (f != NULL)
fscanf(f, "%d", &(*this).sizeData); r=fscanf(f, "%d", &(*this).sizeData);
else else
printf("Le Fichier est vide\n"); printf("Le Fichier est vide\n");
a_h = new ElemType[sizeData * sizeData]; a_h = new ElemType[sizeData * sizeData];
b_h = new ElemType[sizeData * sizeData]; b_h = new ElemType[sizeData * sizeData];
for (int i = 0; i < sizeData; i++) for (i = 0; i < sizeData; i++)
for (int j = 0; j < sizeData; j++) for (j = 0; j < sizeData; j++)
fscanf(f, "%d", &a_h[i * sizeData + j]); r=fscanf(f, "%d", &a_h[i * sizeData + j]);
for (int i = 0; i < sizeData; i++) for (i = 0; i < sizeData; i++)
for (int j = 0; j < sizeData; j++) for (j = 0; j < sizeData; j++)
fscanf(f, "%d", &b_h[i * sizeData + j]); fscanf(f, "%d", &b_h[i * sizeData + j]);
//Allocate and copy QAP data from CPU memory to GPU global memory //Allocate and copy QAP data from CPU memory to GPU global memory
@ -154,7 +156,7 @@ public:
cudaObject.memCopy(b_d, b_h, sizeData * sizeData); cudaObject.memCopy(b_d, b_h, sizeData * sizeData);
} }
public:
public: public:
ElemType* a_h; ElemType* a_h;