]> AND Private Git Repository - book_gpu.git/blobdiff - BookGPU/Chapters/chapter2/ex1.cu
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
fin correct ch14
[book_gpu.git] / BookGPU / Chapters / chapter2 / ex1.cu
index cae3c9c57fee76a271412be32a79edfa88fd9f18..64c08dd68b68857d8ae2a15e9d3c8147eb18ec52 100644 (file)
@@ -42,7 +42,7 @@ int main( int argc, char** argv)
 
        unsigned int timer_cpu = 0;
        cutilCheckError(cutCreateTimer(&timer_cpu));
-  cutilCheckError(cutStartTimer(timer_cpu));
+       cutilCheckError(cutStartTimer(timer_cpu));
        for(i=0;i<size;i++) {
                h_arrayC[i]=h_arrayA[i]+h_arrayB[i];
        }
@@ -52,7 +52,7 @@ int main( int argc, char** argv)
 
        unsigned int timer_gpu = 0;
        cutilCheckError(cutCreateTimer(&timer_gpu));
-  cutilCheckError(cutStartTimer(timer_gpu));
+       cutilCheckError(cutStartTimer(timer_gpu));
        cudaMemcpy(d_arrayA,h_arrayA, size * sizeof(int), cudaMemcpyHostToDevice);
        cudaMemcpy(d_arrayB,h_arrayB, size * sizeof(int), cudaMemcpyHostToDevice);
        
@@ -64,9 +64,9 @@ int main( int argc, char** argv)
        printf("GPU processing time : %f (ms) \n", cutGetTimerValue(timer_gpu));
        cutDeleteTimer(timer_gpu);
 
-       for(i=0;i<size;i++)
+       for(i=0;i<size;i++) {
                assert(h_arrayC[i]==h_arrayCgpu[i]);
-
+       }
        cudaFree(d_arrayA);
        cudaFree(d_arrayB);
        cudaFree(d_arrayC);