Skip to content

Commit

Permalink
#5 Added progress printing
Browse files Browse the repository at this point in the history
  • Loading branch information
carljohnsen committed Apr 10, 2024
1 parent d38fa70 commit 230359a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib/cpp/gpu/diffusion.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ namespace gpu {
float *buffer_dst = (float *) aligned_alloc(disk_block_size, chunk_size*sizeof(float));

for (int64_t chunk = 0; chunk < total_flat_size; chunk += chunk_size) {
std::cout << "\rConverting: " << chunk / chunk_size << "/" << total_flat_size / chunk_size << std::flush;
int64_t size = std::min(chunk_size, total_flat_size - chunk);
load_partial(file_src, buffer_src, chunk_size, chunk, size, total_flat_size, 0);
#pragma acc data copyin(buffer_src[0:chunk_size]) create(buffer_dst[0:chunk_size]) copyout(buffer_dst[0:chunk_size])
Expand All @@ -212,6 +213,7 @@ namespace gpu {
}
store_partial(file_dst, buffer_dst, chunk, size, 0);
}
std::cout << "\rConversion is complete!" << std::endl;

free(buffer_dst);
free(buffer_src);
Expand Down Expand Up @@ -315,6 +317,7 @@ namespace gpu {
{
for (int64_t rep = 0; rep < repititions; rep++) {
for (int64_t global_block = 0; global_block < global_blocks; global_block++) {
std::cout << "\rDiffusion: " << rep*global_blocks + global_block << "/" << repititions*global_blocks << std::flush;
int64_t this_block_size = std::min(global_shape.z, total_shape.z - global_block*global_shape.z) * layer_flat_size;

// Load the global block
Expand All @@ -334,6 +337,7 @@ namespace gpu {
std::swap(temp0, temp1);
std::swap(tmp0, tmp1);
}
std::cout << "\rDiffusion is complete!" << std::endl;
}

// Convert to uint16
Expand Down

0 comments on commit 230359a

Please sign in to comment.