From 5c28ac993bdf5f5a16910f0f07bace8f87724479 Mon Sep 17 00:00:00 2001 From: dkazanc Date: Mon, 2 Mar 2020 10:49:24 +0000 Subject: cudaDeviceSynchronize before exit --- src/Core/regularisers_GPU/Diffus_4thO_GPU_core.cu | 1 + src/Core/regularisers_GPU/LLT_ROF_GPU_core.cu | 2 +- src/Core/regularisers_GPU/NonlDiff_GPU_core.cu | 1 + src/Core/regularisers_GPU/PatchSelect_GPU_core.cu | 2 +- src/Core/regularisers_GPU/TGV_GPU_core.cu | 2 +- src/Core/regularisers_GPU/TV_FGP_GPU_core.cu | 2 +- src/Core/regularisers_GPU/TV_PD_GPU_core.cu | 1 + src/Core/regularisers_GPU/TV_ROF_GPU_core.cu | 3 ++- src/Core/regularisers_GPU/TV_SB_GPU_core.cu | 2 +- src/Core/regularisers_GPU/dTV_FGP_GPU_core.cu | 1 + 10 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/Core/regularisers_GPU/Diffus_4thO_GPU_core.cu b/src/Core/regularisers_GPU/Diffus_4thO_GPU_core.cu index afd2026..3cdf0a3 100644 --- a/src/Core/regularisers_GPU/Diffus_4thO_GPU_core.cu +++ b/src/Core/regularisers_GPU/Diffus_4thO_GPU_core.cu @@ -363,5 +363,6 @@ extern "C" int Diffus4th_GPU_main(float *Input, float *Output, float *infovector /*adding info into info_vector */ infovector[0] = (float)(n); /*iterations number (if stopped earlier based on tolerance)*/ infovector[1] = re; /* reached tolerance */ + cudaDeviceSynchronize(); return 0; } diff --git a/src/Core/regularisers_GPU/LLT_ROF_GPU_core.cu b/src/Core/regularisers_GPU/LLT_ROF_GPU_core.cu index 3c578f3..3109cfa 100644 --- a/src/Core/regularisers_GPU/LLT_ROF_GPU_core.cu +++ b/src/Core/regularisers_GPU/LLT_ROF_GPU_core.cu @@ -599,6 +599,6 @@ extern "C" int LLT_ROF_GPU_main(float *Input, float *Output, float *infovector, infovector[0] = (float)(n); /*iterations number (if stopped earlier based on tolerance)*/ infovector[1] = re; /* reached tolerance */ - + cudaDeviceSynchronize(); return 0; } diff --git a/src/Core/regularisers_GPU/NonlDiff_GPU_core.cu b/src/Core/regularisers_GPU/NonlDiff_GPU_core.cu index d7a6bac..1d592d6 100644 --- a/src/Core/regularisers_GPU/NonlDiff_GPU_core.cu +++ b/src/Core/regularisers_GPU/NonlDiff_GPU_core.cu @@ -545,5 +545,6 @@ extern "C" int NonlDiff_GPU_main(float *Input, float *Output, float *infovector, infovector[0] = (float)(n); /*iterations number (if stopped earlier based on tolerance)*/ infovector[1] = re; /* reached tolerance */ + cudaDeviceSynchronize(); return 0; } diff --git a/src/Core/regularisers_GPU/PatchSelect_GPU_core.cu b/src/Core/regularisers_GPU/PatchSelect_GPU_core.cu index fb6fa95..cde252e 100644 --- a/src/Core/regularisers_GPU/PatchSelect_GPU_core.cu +++ b/src/Core/regularisers_GPU/PatchSelect_GPU_core.cu @@ -505,6 +505,6 @@ extern "C" int PatchSelect_GPU_main(float *A, unsigned short *H_i, unsigned shor cudaFree(H_j_d); cudaFree(Weights_d); cudaFree(Eucl_Vec_d); - cudaDeviceReset(); + cudaDeviceSynchronize(); return 0; } diff --git a/src/Core/regularisers_GPU/TGV_GPU_core.cu b/src/Core/regularisers_GPU/TGV_GPU_core.cu index fc462fe..4e5e830 100644 --- a/src/Core/regularisers_GPU/TGV_GPU_core.cu +++ b/src/Core/regularisers_GPU/TGV_GPU_core.cu @@ -816,6 +816,6 @@ extern "C" int TGV_GPU_main(float *U0, float *U, float *infovector, float lambda /*adding info into info_vector */ infovector[0] = (float)(n); /*iterations number (if stopped earlier based on tolerance)*/ infovector[1] = re; /* reached tolerance */ - + cudaDeviceSynchronize(); return 0; } diff --git a/src/Core/regularisers_GPU/TV_FGP_GPU_core.cu b/src/Core/regularisers_GPU/TV_FGP_GPU_core.cu index cb8ba37..049dae1 100755 --- a/src/Core/regularisers_GPU/TV_FGP_GPU_core.cu +++ b/src/Core/regularisers_GPU/TV_FGP_GPU_core.cu @@ -596,6 +596,6 @@ extern "C" int TV_FGP_GPU_main(float *Input, float *Output, float *infovector, f /*adding info into info_vector */ infovector[0] = (float)(i); /*iterations number (if stopped earlier based on tolerance)*/ infovector[1] = re; /* reached tolerance */ - cudaDeviceReset(); + cudaDeviceSynchronize(); return 0; } diff --git a/src/Core/regularisers_GPU/TV_PD_GPU_core.cu b/src/Core/regularisers_GPU/TV_PD_GPU_core.cu index 01e0ab5..3fcd1e8 100644 --- a/src/Core/regularisers_GPU/TV_PD_GPU_core.cu +++ b/src/Core/regularisers_GPU/TV_PD_GPU_core.cu @@ -515,5 +515,6 @@ extern "C" int TV_PD_GPU_main(float *Input, float *Output, float *infovector, fl /*adding info into info_vector */ infovector[0] = (float)(i); /*iterations number (if stopped earlier based on tolerance)*/ infovector[1] = re; /* reached tolerance */ + cudaDeviceSynchronize(); return 0; } diff --git a/src/Core/regularisers_GPU/TV_ROF_GPU_core.cu b/src/Core/regularisers_GPU/TV_ROF_GPU_core.cu index c6c6e88..e9e6d9b 100755 --- a/src/Core/regularisers_GPU/TV_ROF_GPU_core.cu +++ b/src/Core/regularisers_GPU/TV_ROF_GPU_core.cu @@ -480,7 +480,8 @@ extern "C" int TV_ROF_GPU_main(float* Input, float* Output, float *infovector, f CHECK(cudaFree(d_D2)); CHECK(cudaFree(lambdaPar_d)); - infovector[0] = (float)(n); /*iterations number (if stopped earlier based on tolerance)*/ + infovector[0] = (float)(n); /*iterations number (if stopped earlier based on tolerance)*/ infovector[1] = re; /* reached tolerance */ + cudaDeviceSynchronize(); return 0; } diff --git a/src/Core/regularisers_GPU/TV_SB_GPU_core.cu b/src/Core/regularisers_GPU/TV_SB_GPU_core.cu index 0353868..58b1157 100755 --- a/src/Core/regularisers_GPU/TV_SB_GPU_core.cu +++ b/src/Core/regularisers_GPU/TV_SB_GPU_core.cu @@ -528,6 +528,6 @@ extern "C" int TV_SB_GPU_main(float *Input, float *Output, float *infovector, fl /*adding info into info_vector */ infovector[0] = (float)(ll); /*iterations number (if stopped earlier based on tolerance)*/ infovector[1] = re; /* reached tolerance */ - + cudaDeviceSynchronize(); return 0; } diff --git a/src/Core/regularisers_GPU/dTV_FGP_GPU_core.cu b/src/Core/regularisers_GPU/dTV_FGP_GPU_core.cu index 89fca06..12473c0 100644 --- a/src/Core/regularisers_GPU/dTV_FGP_GPU_core.cu +++ b/src/Core/regularisers_GPU/dTV_FGP_GPU_core.cu @@ -753,5 +753,6 @@ extern "C" int dTV_FGP_GPU_main(float *Input, float *InputRef, float *Output, fl /*adding info into info_vector */ infovector[0] = (float)(i); /*iterations number (if stopped earlier based on tolerance)*/ infovector[1] = re; /* reached tolerance */ + cudaDeviceSynchronize(); return 0; } -- cgit v1.2.1