Skip to content

Commit

Permalink
KVIKIO_CUFILE_DUMMY_BATCH_TYPEDEFS
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Aug 28, 2023
1 parent c979aef commit 109835e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 15 deletions.
6 changes: 6 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ else()
set(cuFile_BATCH_AND_STREAM_API_FOUND TRUE)
endif()
message(STATUS "Found cuFile's Batch and Stream API: ${cuFile_BATCH_AND_STREAM_API_FOUND}")

# When the batch and stream API isn't found, we might need some dummy typedefs
string(FIND "${CUFILE_H_STR}" "CUfileOpcode" CUfileOpcode_location)
endif()

# library targets
Expand All @@ -90,6 +93,9 @@ if(cuFile_FOUND)
if(cuFile_BATCH_AND_STREAM_API_FOUND)
target_compile_definitions(kvikio INTERFACE KVIKIO_CUFILE_BATCH_AND_STREAM_API_FOUND)
endif()
if(CUfileOpcode_location EQUAL "-1")
target_compile_definitions(kvikio INTERFACE KVIKIO_CUFILE_DUMMY_BATCH_TYPEDEFS)
endif()
endif()
target_link_libraries(kvikio INTERFACE ${CMAKE_DL_LIBS})
target_compile_features(kvikio INTERFACE cxx_std_17)
Expand Down
17 changes: 2 additions & 15 deletions cpp/include/kvikio/shim/cufile_h_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,24 +32,11 @@ using CUfileDriverControlFlags_t = enum CUfileDriverControlFlags {
using CUfileHandle_t = void*;
#endif

// If the Batch API isn't defined, we define some of the data types here.
// When the batch and stream API isn't found, we might need some dummy typedefs.
// Notice, this doesn't need to be ABI compatible with the cufile definitions.
#ifndef KVIKIO_CUFILE_BATCH_AND_STREAM_API_FOUND
#ifdef KVIKIO_CUFILE_DUMMY_BATCH_TYPEDEFS
typedef enum CUfileOpcode { CUFILE_READ = 0, CUFILE_WRITE } CUfileOpcode_t;

typedef enum CUFILEStatus_enum {
CUFILE_WAITING = 0x000001, /* required value prior to submission */
CUFILE_PENDING = 0x000002, /* once enqueued */
CUFILE_INVALID = 0x000004, /* request was ill-formed or could not be enqueued */
CUFILE_CANCELED = 0x000008, /* request successfully canceled */
CUFILE_COMPLETE = 0x0000010, /* request successfully completed */
CUFILE_TIMEOUT = 0x0000020, /* request timed out */
CUFILE_FAILED = 0x0000040 /* unable to complete */
} CUfileStatus_t;

typedef struct CUfileIOEvents {
void* cookie;
CUfileStatus_t status; /* status of the operation */
size_t ret; /* -ve error or amount of I/O done. */
} CUfileIOEvents_t;
#endif

0 comments on commit 109835e

Please sign in to comment.