projects
/
GPU.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Ajout des cas de tests pour les TP non-graphiques. Cleanage en tous genres.
[GPU.git]
/
WCudaMSE
/
Student_Cuda
/
src
/
cpp
/
core
/
01c_Saucisson
/
Saucisson.cu
diff --git
a/WCudaMSE/Student_Cuda/src/cpp/core/01c_Saucisson/Saucisson.cu
b/WCudaMSE/Student_Cuda/src/cpp/core/01c_Saucisson/Saucisson.cu
index
3ec1cd3
..
4d887a9
100644
(file)
--- a/
WCudaMSE/Student_Cuda/src/cpp/core/01c_Saucisson/Saucisson.cu
+++ b/
WCudaMSE/Student_Cuda/src/cpp/core/01c_Saucisson/Saucisson.cu
@@
-27,7
+27,7
@@
void reductionIntraThread(int n, float deltaX, float* tabSM)
{
const float i = s + 1;
const float xi = -1 + i * deltaX;
{
const float i = s + 1;
const float xi = -1 + i * deltaX;
- threadResult += sqrtf(1
-xi*
xi);
+ threadResult += sqrtf(1
- xi *
xi);
s += NB_THREAD;
}
s += NB_THREAD;
}
@@
-78,7
+78,7
@@
void reductionInterBlock(float* tabSM, float* ptrResult)
const int TID_LOCAL = Indice1D::tidLocal();
if (TID_LOCAL == 0)
{
const int TID_LOCAL = Indice1D::tidLocal();
if (TID_LOCAL == 0)
{
- atomicAdd(ptrResult,
float(tabSM[0])
);
+ atomicAdd(ptrResult,
tabSM[0]
);
}
}
}
}
@@
-107,13
+107,13
@@
void saucisson(int n, float deltaX, float* ptrResult)
bool saucisson()
{
bool saucisson()
{
- cout << "saucisson() ..." << endl;
+ cout <<
endl <<
"saucisson() ..." << endl;
// Nombre d'échantillon. Au-delà, la qualité du résultat n'est pas meilleure. Il faudrait employé des doubles à la place de floats.
const int N = 100000;
// Allocation coté GPU en global memory (GM).
// Nombre d'échantillon. Au-delà, la qualité du résultat n'est pas meilleure. Il faudrait employé des doubles à la place de floats.
const int N = 100000;
// Allocation coté GPU en global memory (GM).
- float* ptrDevResult
= 0
;
+ float* ptrDevResult;
HANDLE_ERROR(cudaMalloc(&ptrDevResult, sizeof(float)));
HANDLE_ERROR(cudaMemset(ptrDevResult, 0, sizeof(float)));
HANDLE_ERROR(cudaMalloc(&ptrDevResult, sizeof(float)));
HANDLE_ERROR(cudaMemset(ptrDevResult, 0, sizeof(float)));