Skip to content

Commit

Permalink
Add more comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kingcrimsontianyu committed Feb 14, 2025
1 parent fcc2fde commit 050899c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cpp/include/kvikio/parallel_operation.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ std::future<std::size_t> parallel_io(F op,
if (remaining_bytes != 0) { ++num_tasks; }
tasks_before_last.reserve(num_tasks - 1);

// 1) Submit all tasks before the last one. These are all `task_size` sized tasks.
// 1) Submit all tasks but the last one. These are all `task_size` sized tasks.
for (std::size_t i = 0; i < num_tasks - 1; ++i) {
tasks_before_last.push_back(
detail::submit_task(op, buf, task_size, file_offset, devPtr_offset));
Expand All @@ -135,7 +135,8 @@ std::future<std::size_t> parallel_io(F op,
size -= task_size;
}

// 2) Submit the last task
// 2) Submit the last task, which consists of performing the last I/O and waiting the previous
// tasks.
auto last_task_size = (remaining_bytes == 0) ? task_size : remaining_bytes;

auto last_task = [=, tasks_before_last = std::move(tasks_before_last)]() mutable -> std::size_t {
Expand Down

0 comments on commit 050899c

Please sign in to comment.