From 050899c931ac26d83e7b57dbec32c61f3af58bf9 Mon Sep 17 00:00:00 2001 From: Tianyu Liu Date: Thu, 13 Feb 2025 00:41:17 -0500 Subject: [PATCH] Add more comments --- cpp/include/kvikio/parallel_operation.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cpp/include/kvikio/parallel_operation.hpp b/cpp/include/kvikio/parallel_operation.hpp index 9efc4053c2..e1c29d392e 100644 --- a/cpp/include/kvikio/parallel_operation.hpp +++ b/cpp/include/kvikio/parallel_operation.hpp @@ -126,7 +126,7 @@ std::future 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)); @@ -135,7 +135,8 @@ std::future 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 {