Skip to content

Commit

Permalink
Minor README fixes (#517)
Browse files Browse the repository at this point in the history
Minor cosmetic fixes for README :)

Authors:
  - Jacob Faibussowitsch (https://github.com/Jacobfaib)

Approvers:
  - Mads R. B. Kristensen (https://github.com/madsbk)

URL: #517
  • Loading branch information
Jacobfaib authored Oct 25, 2024
1 parent dde7115 commit 40dced5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ if __name__ == "__main__":
#### C++
```c++
#include <cstddef>
#include <future>
#include <cuda_runtime.h>
#include <kvikio/file_handle.hpp>
using namespace std;

int main()
{
Expand All @@ -85,21 +85,21 @@ int main()

// Write `a` to file
kvikio::FileHandle fw("test-file", "w");
size_t written = fw.write(a, size);
std::size_t written = fw.write(a, size);
fw.close();

// Read file into `b`
kvikio::FileHandle fr("test-file", "r");
size_t read = fr.read(b, size);
std::size_t read = fr.read(b, size);
fr.close();

// Read file into `b` in parallel using 16 threads
kvikio::default_thread_pool::reset(16);
{
// FileHandles have RAII semantics
kvikio::FileHandle f("test-file", "r");
future<size_t> future = f.pread(b_dev, sizeof(a), 0); // Non-blocking
size_t read = future.get(); // Blocking
std::future<std::size_t> future = f.pread(b_dev, sizeof(a), 0); // Non-blocking
std::size_t read = future.get(); // Blocking
// Notice, `f` closes automatically on destruction.
}
}
Expand Down

0 comments on commit 40dced5

Please sign in to comment.