Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify batch and stream API check #271

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
dummy CUFILE_CHECK_STREAM_IO
  • Loading branch information
madsbk committed Aug 28, 2023
commit 5358b3529873eb1d54bf40b8991e50a6d2c50a56
6 changes: 1 addition & 5 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ rapids_find_package(
INSTALL_EXPORT_SET kvikio-exports
)

rapids_find_package(
cuFile
BUILD_EXPORT_SET kvikio-exports
INSTALL_EXPORT_SET kvikio-exports
)
# rapids_find_package( cuFile BUILD_EXPORT_SET kvikio-exports INSTALL_EXPORT_SET kvikio-exports )
if(NOT cuFile_FOUND)
message(WARNING "Building KvikIO without cuFile")
else()
Expand Down
9 changes: 7 additions & 2 deletions cpp/include/kvikio/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ struct CUfileException : public std::runtime_error {
#endif
#endif

#ifdef KVIKIO_CUFILE_FOUND
#ifndef CUFILE_CHECK_STREAM_IO
#define CUFILE_CHECK_STREAM_IO(...) \
GET_CUFILE_CHECK_STREAM_IO_MACRO( \
__VA_ARGS__, CUFILE_CHECK_STREAM_IO_2, CUFILE_CHECK_STREAM_IO_1) \
(__VA_ARGS__)
#define GET_CUFILE_CHECK_STREAM_IO_MACRO(_1, _2, NAME, ...) NAME
#ifdef KVIKIO_CUFILE_FOUND
#define CUFILE_CHECK_STREAM_IO_2(_nbytes_done, _exception_type) \
do { \
int const _nbytes = (_nbytes_done); \
Expand All @@ -95,8 +95,13 @@ struct CUfileException : public std::runtime_error {
cufileop_status_error((CUfileOpError)(CUFILEOP_BASE_ERR - _nbytes))}; \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the documentation says that this returns:

  • The number of bytes successfully written. or;
  • -1 on IO errors. or;
  • All other errors will return a negative integer value of the CUfileOpError enum value.

But this code suggests that it returns -(some_cufile_op_error - CUFILEOP_BASE_ERR). Which can't be right given the above because it value-puns CU_FILE_DRIVER_NOT_INITIALIZED with an IO error.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the docs are correct. I now just print the raw value of _nbytes. Let's fix this in a follow-up when we know the intended behavior :)

} \
} while (0)
#define CUFILE_CHECK_STREAM_IO_1(_call) CUFILE_CHECK_STREAM_IO_2(_call, kvikio::CUfileException)
#else
// if cufile isn't available, we don't do anything in the body
#define CUFILE_CHECK_STREAM_IO_2(_nbytes_done, _exception_type) \
do { \
} while (0)
#endif
#define CUFILE_CHECK_STREAM_IO_1(_call) CUFILE_CHECK_STREAM_IO_2(_call, kvikio::CUfileException)
#endif

} // namespace kvikio