Skip to content

Commit c9d3e59

Browse files
committed
fix synchronization
1 parent e5f3d56 commit c9d3e59

File tree

4 files changed

+8
-4
lines changed

4 files changed

+8
-4
lines changed

tsne/CUDA/src/kernels/perplexity_search.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,12 @@ void tsnecuda::SearchPerplexity(
153153

154154
// compute entropy of current row
155155
row_sum = tsnecuda::utils::ReduceSum(handle, pij, num_neighbors, num_points, 0);
156-
GpuErrorCheck(cudaDeviceSynchronize());
156+
// GpuErrorCheck(cudaDeviceSynchronize());
157157

158158
// compute negative entropy
159159
thrust::transform(pij.begin(), pij.end(), entropy.begin(), tsnecuda::utils::FunctionalEntropy());
160160
neg_entropy = tsnecuda::utils::ReduceAlpha(handle, entropy, num_neighbors, num_points, -1.0f, 0);
161-
GpuErrorCheck(cudaDeviceSynchronize());
161+
// GpuErrorCheck(cudaDeviceSynchronize());
162162

163163
// binary search for beta
164164
PerplexitySearchKernel<<<NBLOCKS2, BLOCKSIZE2>>>(

tsne/CUDA/src/utils/reduce_utils.cu

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ thrust::device_vector<float> tsnecuda::utils::ReduceAlpha(
5757
thrust::raw_pointer_cast(d_matrix.data()), N,
5858
thrust::raw_pointer_cast(ones.data()), 1, &kBeta,
5959
thrust::raw_pointer_cast(means.data()), 1));
60+
GpuErrorCheck(cudaDeviceSynchronize());
6061
return means;
6162
} else if (axis == 1) {
6263
thrust::device_vector<float> ones(M, 1.f);
@@ -67,6 +68,7 @@ thrust::device_vector<float> tsnecuda::utils::ReduceAlpha(
6768
thrust::raw_pointer_cast(d_matrix.data()), N,
6869
thrust::raw_pointer_cast(ones.data()), 1, &kBeta,
6970
thrust::raw_pointer_cast(means.data()), 1));
71+
GpuErrorCheck(cudaDeviceSynchronize());
7072
return means;
7173
} else {
7274
throw std::runtime_error("Axis must be 0 or 1.");

tsne/HIP/src/kernels/perplexity_search.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ void tsnecuda::SearchPerplexity(
154154

155155
// compute entropy of current row
156156
row_sum = tsnecuda::utils::ReduceSum(handle, pij, num_neighbors, num_points, 0);
157-
GpuErrorCheck(hipDeviceSynchronize());
157+
// GpuErrorCheck(hipDeviceSynchronize());
158158

159159
// compute negative entropy
160160
thrust::transform(pij.begin(), pij.end(), entropy.begin(), tsnecuda::utils::FunctionalEntropy());
161161
neg_entropy = tsnecuda::utils::ReduceAlpha(handle, entropy, num_neighbors, num_points, -1.0f, 0);
162-
GpuErrorCheck(hipDeviceSynchronize());
162+
// GpuErrorCheck(hipDeviceSynchronize());
163163

164164
// binary search for beta
165165
hipLaunchKernelGGL(PerplexitySearchKernel, NBLOCKS2, BLOCKSIZE2, 0, 0,

tsne/HIP/src/utils/reduce_utils.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ thrust::device_vector<float> tsnecuda::utils::ReduceAlpha(
5757
thrust::raw_pointer_cast(d_matrix.data()), N,
5858
thrust::raw_pointer_cast(ones.data()), 1, &kBeta,
5959
thrust::raw_pointer_cast(means.data()), 1));
60+
GpuErrorCheck(hipDeviceSynchronize());
6061
return means;
6162
} else if (axis == 1) {
6263
thrust::device_vector<float> ones(M, 1.f);
@@ -67,6 +68,7 @@ thrust::device_vector<float> tsnecuda::utils::ReduceAlpha(
6768
thrust::raw_pointer_cast(d_matrix.data()), N,
6869
thrust::raw_pointer_cast(ones.data()), 1, &kBeta,
6970
thrust::raw_pointer_cast(means.data()), 1));
71+
GpuErrorCheck(hipDeviceSynchronize());
7072
return means;
7173
} else {
7274
throw std::runtime_error("Axis must be 0 or 1.");

0 commit comments

Comments
 (0)