Skip to content

Commit

Permalink
use compat mode per file handle
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Aug 31, 2023
1 parent e741c24 commit 12e70ad
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cpp/include/kvikio/file_handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,8 +507,9 @@ class FileHandle {
* `stream` has been synchronized.
*
* The arguments have the same meaning as in `.read()` but some of them are deferred. That is,
* the values pointed to by `size_p`, `file_offset_p` and `devPtr_offset_p` will not be evaluated until execution
* time. Notice, this behavior can be changed using cuFile's cuFileStreamRegister API.
* the values pointed to by `size_p`, `file_offset_p` and `devPtr_offset_p` will not be evaluated
* until execution time. Notice, this behavior can be changed using cuFile's cuFileStreamRegister
* API.
*
* @param devPtr_base Base address of buffer in device memory. For registered buffers,
* `devPtr_base` must remain set to the base address used in the `buffer_register` call.
Expand All @@ -517,9 +518,9 @@ class FileHandle {
* Later the actual size can be set prior to the stream I/O execution.
* @param file_offset_p Pointer to offset in the file from which to read. Unless otherwise set
* using cuFileStreamRegister API, this value will not be evaluated until execution time.
* @param devPtr_offset_p Pointer to the offset relative to the bufPtr_base pointer from which to
* write. Unless otherwise set using cuFileStreamRegister API, this value will not be evaluated
* until execution time.
* @param devPtr_offset_p Pointer to the offset relative to the bufPtr_base from which to write.
* Unless otherwise set using cuFileStreamRegister API, this value will not be evaluated until
* execution time.
* @param bytes_read_p Pointer to the bytes read from file. This pointer should be a non-NULL
* value and *bytes_read_p set to 0. The bytes_read_p memory should be allocated with
* cuMemHostAlloc/malloc/mmap or registered with cuMemHostRegister. After successful execution of
Expand All @@ -538,7 +539,7 @@ class FileHandle {
CUstream stream)
{
#ifdef KVIKIO_CUFILE_STREAM_API_FOUND
if (kvikio::is_batch_and_stream_available() && !kvikio::defaults::compat_mode()) {
if (kvikio::is_batch_and_stream_available() && !_compat_mode) {
CUFILE_TRY(cuFileAPI::instance().ReadAsync(
_handle, devPtr_base, size_p, file_offset_p, devPtr_offset_p, bytes_read_p, stream));
return;
Expand Down Expand Up @@ -570,8 +571,9 @@ class FileHandle {
* Later the actual size can be set prior to the stream I/O execution.
* @param file_offset_p Pointer to offset in the file from which to read. Unless otherwise set
* using cuFileStreamRegister API, this value will not be evaluated until execution time.
* @param devPtr_offset_p Pointer to the offset relative to the bufPtr_base pointer from which to
* write.
* @param devPtr_offset_p Pointer to the offset relative to the bufPtr_base from which to read.
* Unless otherwise set using cuFileStreamRegister API, this value will not be evaluated until
* execution time.
* @param bytes_written_p Pointer to the bytes read from file. This pointer should be a non-NULL
* value and *bytes_written_p set to 0. The bytes_written_p memory should be allocated with
* cuMemHostAlloc/malloc/mmap or registered with cuMemHostRegister.
Expand All @@ -591,7 +593,7 @@ class FileHandle {
CUstream stream)
{
#ifdef KVIKIO_CUFILE_STREAM_API_FOUND
if (kvikio::is_batch_and_stream_available() && !kvikio::defaults::compat_mode()) {
if (kvikio::is_batch_and_stream_available() && !_compat_mode) {
CUFILE_TRY(cuFileAPI::instance().WriteAsync(
_handle, devPtr_base, size_p, file_offset_p, devPtr_offset_p, bytes_written_p, stream));
return;
Expand Down

0 comments on commit 12e70ad

Please sign in to comment.