Skip to content

Commit c10225d

Browse files
committed
Some debug prints removed
1 parent 9ff0580 commit c10225d

File tree

4 files changed

+17
-24
lines changed

4 files changed

+17
-24
lines changed

src/algorithm/ComputeGradientCuda.cu

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,9 @@ class GpuProcessingTask<U>::GpuProcessingTaskImpl {
247247

248248
public:
249249

250+
// TODO: Remove need for passing 'levels' to GpuProcessingTask
251+
// It was used during development to control internal computation like filters, gradient, levels etc. but
252+
// once all is done there is no need for it anymore
250253
GpuProcessingTaskImpl(const PixelData<ImgType> &inputImage, PixelData<float> &levels, const APRParameters &parameters, float bspline_offset, int maxLevel) :
251254
iCpuImage(inputImage),
252255
iCpuLevels(levels),
@@ -272,16 +275,16 @@ public:
272275
y_vec(nullptr, iAprInfo.getSize(), iStream)
273276
{
274277
// std::cout << "\n=============== GpuProcessingTaskImpl ===================\n\n";
275-
std::cout << iCpuImage << std::endl;
276-
std::cout << iCpuLevels << std::endl;
278+
// std::cout << iCpuImage << std::endl;
279+
// std::cout << iCpuLevels << std::endl;
277280
}
278281

279282
void sendDataToGpu() {
280-
CurrentTime ct;
281-
uint64_t start = ct.microseconds();
283+
// CurrentTime ct;
284+
// uint64_t start = ct.microseconds();
282285
image.copyH2D();
283-
checkCuda(cudaStreamSynchronize(iStream));
284-
std::cout << "SEND time: " << ct.microseconds() - start << std::endl;
286+
// checkCuda(cudaStreamSynchronize(iStream));
287+
// std::cout << "SEND time: " << ct.microseconds() - start << std::endl;
285288
}
286289

287290
LinearAccessCudaStructs getDataFromGpu() {
@@ -313,18 +316,14 @@ public:
313316
getGradientCuda(iCpuImage, iCpuLevels, image.get(), gradient.get(), local_scale_temp.get(),
314317
splineCudaX, splineCudaY, splineCudaZ, boundary.get(),
315318
iBsplineOffset, iParameters, iStream);
316-
std::cout << "1: " << ct.microseconds() - start << std::endl;
317319
runLocalIntensityScalePipeline(iCpuLevels, iParameters, local_scale_temp.get(), local_scale_temp2.get(), iStream);
318-
std::cout << "2: " << ct.microseconds() - start << std::endl;
319320
float min_dim = std::min(iParameters.dy, std::min(iParameters.dx, iParameters.dz));
320321
float level_factor = pow(2, iMaxLevel) * min_dim;
321322
const float mult_const = level_factor/iParameters.rel_error;
322323
runComputeLevels(gradient.get(), local_scale_temp.get(), iCpuLevels.mesh.size(), mult_const, iStream);
323-
std::cout << "3: " << ct.microseconds() - start << std::endl;
324324

325325
computeOvpcCuda(local_scale_temp.get(), pctc, iAprInfo, iStream);
326326
computeLinearStructureCuda(y_vec.get(), pctc, iAprInfo, iParameters, lacs, iStream);
327-
std::cout << iAprInfo << std::endl;
328327
}
329328

330329
~GpuProcessingTaskImpl() {
@@ -335,10 +334,10 @@ public:
335334

336335
template <typename ImgType>
337336
GpuProcessingTask<ImgType>::GpuProcessingTask(const PixelData<ImgType> &image, PixelData<float> &levels, const APRParameters &parameters, float bspline_offset, int maxLevel)
338-
: impl{new GpuProcessingTaskImpl<ImgType>(image, levels, parameters, bspline_offset, maxLevel)} {std::cout << "GpuProcessingTask\n";}
337+
: impl{new GpuProcessingTaskImpl<ImgType>(image, levels, parameters, bspline_offset, maxLevel)} { }
339338

340339
template <typename ImgType>
341-
GpuProcessingTask<ImgType>::~GpuProcessingTask() {std::cout << "~GpuProcessingTask\n";}
340+
GpuProcessingTask<ImgType>::~GpuProcessingTask() { }
342341

343342
template <typename ImgType>
344343
GpuProcessingTask<ImgType>::GpuProcessingTask(GpuProcessingTask&&) = default;

src/algorithm/OVPC.cu

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,4 @@ void computeOvpcCuda(ImgType *in, ParticleCellTreeCuda &pct, const GenInfo &gi,
182182
for (int l = levelMax - 1; l >= levelMin; --l) {
183183
runSecondStep(pct[l], pct[l+1], gi.x_num[l], gi.y_num[l], gi.z_num[l], gi.x_num[l + 1], gi.y_num[l + 1], gi.z_num[l + 1], l == levelMin, stream);
184184
}
185-
186-
std::cout << "------- RUN --------------\n";
187185
}

src/data_structures/APR/access/LinearAccessCuda.cu

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -627,10 +627,6 @@ void computeLinearStructureCuda(uint16_t *y_vec_cuda, ParticleCellTreeCuda &p_ma
627627
}
628628
}
629629

630-
// auto prt = [&](const auto& v){ std::cout << "size=" << v.size() << " data="; for (size_t i = 0; i < v.size(); i++) std::cout << v[i] << ", "; std::cout << std::endl; };
631-
// prt(y_vec);
632-
// prt(xz_end_vec);
633-
// prt(level_xz_vec);
634630
VectorData<uint16_t> y_vec(true);
635631
y_vec.resize(gi.total_number_particles);
636632
checkCuda(cudaMemcpyAsync(y_vec.begin(), y_vec_cuda, gi.total_number_particles * sizeof(uint16_t), cudaMemcpyDeviceToHost, aStream));

test/FullPipelineCudaTest.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,7 @@ namespace {
310310

311311
// Initialize GPU data structures to same values as CPU
312312
PixelData<ImageType> mGpuImage(input_image, true);
313-
PixelData<ImageType> grad_temp_GPU(grad_temp, true);
314-
PixelData<float> local_scale_temp_GPU(local_scale_temp, true);
315-
PixelData<float> local_scale_temp2_GPU(local_scale_temp2, true);
313+
PixelData<float> local_scale_temp_GPU(local_scale_temp, false);
316314

317315
// Prepare parameters
318316
APRParameters par;
@@ -346,14 +344,16 @@ namespace {
346344

347345

348346
// Calculate pipeline on GPU
349-
timer.start_timer(">>>>>>>>>>>>>>>>> GPU PIPELINE");
350-
// {
351347
GpuProcessingTask<ImageType> gpt(mGpuImage, local_scale_temp_GPU, par, 0, maxLevel);
348+
cudaDeviceSynchronize();
349+
350+
timer.start_timer(">>>>>>>>>>>>>>>>> GPU PIPELINE");
351+
// {
352352
gpt.sendDataToGpu();
353353
gpt.processOnGpu();
354354
auto linearAccessGpu = gpt.getDataFromGpu();
355355
giGpu.total_number_particles = linearAccessGpu.y_vec.size();
356-
356+
cudaDeviceSynchronize();
357357
// }
358358
timer.stop_timer();
359359

0 commit comments

Comments
 (0)