Commit afb02be6 authored by Roberto Cavicchioli's avatar Roberto Cavicchioli

Fixed CUDA graph test methodology

parent 0a708490
......@@ -144,12 +144,11 @@ dim3 dimGrid(ceil(((float)INW) / threadDim.x),
std::cout << threadDim.x << " " << threadDim.y << " " << threadDim.z << std::endl;
std::cout << dimGrid.x << " " << dimGrid.y << " " << dimGrid.z << std::endl;
for (int j=0; j<samples; j++)
{
switch(method){
case BASELINE:
for (int j=0; j<samples; j++)
{
std::cout << "Executing BASELINE methodology..." << std::endl;
//time here!
......@@ -192,10 +191,19 @@ switch(method){
elapsed_time = std::chrono::duration_cast<std::chrono::duration<double>>(tEnd-tStart).count();
std::cout << "ELAPSED : " << elapsed_time << std::endl;
CUDA_ERR_CHECK(cudaDeviceSynchronize());
times_sub[j] = elapsed_time;
}
break;
case DYNPAR:
for (int j=0; j<samples; j++)
{
std::cout << "Executing DYNPAR methodology..." << std::endl;
//time here
......@@ -217,6 +225,12 @@ switch(method){
elapsed_time = std::chrono::duration_cast<std::chrono::duration<double>>(tEnd-tStart).count();
std::cout << "ELAPSED : " << elapsed_time << std::endl;
CUDA_ERR_CHECK(cudaDeviceSynchronize());
times_sub[j] = elapsed_time;
}
break;
case CUDAGRAPH:
......@@ -261,6 +275,10 @@ switch(method){
CUDA_ERR_CHECK(cudaGraphInstantiate(&graphExec, graph, NULL, NULL, 0));
//set up graph-stream operations done.
for (int j=0; j<samples; j++)
{
std::cout << "Executing CUDAGRAPH methodology..." << std::endl;
//set Timer here
tStart = std::chrono::high_resolution_clock::now();
......@@ -273,6 +291,12 @@ switch(method){
elapsed_time = std::chrono::duration_cast<std::chrono::duration<double>>(tEnd-tStart).count();
std::cout << "ELAPSED : " << elapsed_time << std::endl;
CUDA_ERR_CHECK(cudaDeviceSynchronize());
times_sub[j] = elapsed_time;
}
CUDA_ERR_CHECK(cudaGraphDestroy(graph));
CUDA_ERR_CHECK(cudaGraphExecDestroy(graphExec));
......@@ -282,11 +306,6 @@ switch(method){
default: break;
}
CUDA_ERR_CHECK(cudaDeviceSynchronize());
times_sub[j] = elapsed_time;
}
for (int i=0; i< samples; i++)
std::cout<< times_sub[i] << std::endl;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment