Skip to content

Commit

Permalink
Merge branch 'branch-23.08' into cuda-12-test
Browse files Browse the repository at this point in the history
  • Loading branch information
bdice authored Jun 21, 2023
2 parents 0f934e7 + 56d48ef commit 5451cda
Show file tree
Hide file tree
Showing 21 changed files with 258 additions and 94 deletions.
19 changes: 19 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#cpp code owners
cpp/ @rapidsai/kvikio-cpp-codeowners

#python code owners
python/ @rapidsai/kvikio-python-codeowners

#legate code owners
legate/ @rapidsai/kvikio-cpp-codeowners @rapidsai/kvikio-python-codeowners

#cmake code owners
**/CMakeLists.txt @rapidsai/kvikio-cmake-codeowners
**/cmake/ @rapidsai/kvikio-cmake-codeowners
build.sh @rapidsai/kvikio-cmake-codeowners
python/setup.py @rapidsai/kvikio-cmake-codeowners @rapidsai/kvikio-python-codeowners

#build/ops code owners
.github/ @rapidsai/ops-codeowners
ci/ @rapidsai/ops-codeowners
conda/ @rapidsai/ops-codeowners
21 changes: 21 additions & 0 deletions .github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Documentation for config - https://github.com/actions/labeler#common-examples

KvikIO (Python):
- 'python/**'
- 'notebooks/**'

libkvikio:
- 'cpp/**'

legate:
- 'legate/**'

CMake:
- '**/CMakeLists.txt'
- '**/cmake/**'

ci:
- 'ci/**'

conda:
- 'conda/**'
3 changes: 0 additions & 3 deletions ci/release/update-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ for DEP in "${DEPENDENCIES[@]}"; do
for FILE in dependencies.yaml conda/environments/*.yaml; do
sed_runner "/-.* ${DEP}==/ s/==.*/==${NEXT_SHORT_TAG_PEP440}.*/g" ${FILE}
done
for FILE in python/pyproject.toml legate/pyproject.toml; do
sed_runner "/\"${DEP}==/ s/==.*\"/==${NEXT_SHORT_TAG_PEP440}.*\"/g" ${FILE}
done
done

# CI files
Expand Down
1 change: 1 addition & 0 deletions conda/environments/all_cuda-118_arch-x86_64.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ dependencies:
- libcufile=1.4.0.31
- ninja
- numpy>=1.21
- packaging
- pre-commit
- pydata-sphinx-theme
- pytest
Expand Down
1 change: 1 addition & 0 deletions conda/recipes/kvikio/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ requirements:
- numpy >=1.20
- cupy >=12.0.0
- zarr
- packaging
- cuda-version {{ cuda_spec }}
{% if cuda_major == "11" %}
- {{ pin_compatible('cudatoolkit', max_pin='x', min_pin='x') }}
Expand Down
4 changes: 3 additions & 1 deletion cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,10 @@ target_link_libraries(kvikio INTERFACE Threads::Threads)
target_link_libraries(kvikio INTERFACE CUDA::toolkit)
if(cuFile_FOUND)
target_link_libraries(kvikio INTERFACE cufile::cuFile_interface)
target_compile_definitions(kvikio INTERFACE KVIKIO_CUFILE_FOUND)

if(cuFile_BATCH_API_FOUND)
target_compile_definitions(kvikio INTERFACE CUFILE_BATCH_API_FOUND)
target_compile_definitions(kvikio INTERFACE KVIKIO_CUFILE_BATCH_API_FOUND)
endif()
endif()
target_link_libraries(kvikio INTERFACE ${CMAKE_DL_LIBS})
Expand Down
3 changes: 0 additions & 3 deletions cpp/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ target_link_libraries(BASIC_IO_TEST PRIVATE kvikio CUDA::cudart)

if(CMAKE_COMPILER_IS_GNUCXX)
set(KVIKIO_CXX_FLAGS "-Wall;-Werror;-Wno-unknown-pragmas")
if(NOT cuFile_FOUND)
set(KVIKIO_CXX_FLAGS "${KVIKIO_CXX_FLAGS};-DKVIKIO_DISABLE_CUFILE")
endif()
target_compile_options(BASIC_IO_TEST PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${KVIKIO_CXX_FLAGS}>")
endif()

Expand Down
2 changes: 1 addition & 1 deletion cpp/include/kvikio/batch.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ struct BatchOp {
CUfileOpcode_t opcode;
};

#ifdef CUFILE_BATCH_API_FOUND
#ifdef KVIKIO_CUFILE_BATCH_API_FOUND

/**
* @brief Handle of an cuFile batch using semantic.
Expand Down
6 changes: 3 additions & 3 deletions cpp/include/kvikio/buffer.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021-2022, NVIDIA CORPORATION.
* Copyright (c) 2021-2023, NVIDIA CORPORATION.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,7 +50,7 @@ inline void buffer_register(const void* devPtr_base,
const std::vector<int>& errors_to_ignore = std::vector<int>())
{
if (defaults::compat_mode()) { return; }
#ifdef KVIKIO_CUFILE_EXIST
#ifdef KVIKIO_CUFILE_FOUND
CUfileError_t status = cuFileAPI::instance().BufRegister(devPtr_base, size, flags);
if (status.err != CU_FILE_SUCCESS) {
// Check if `status.err` is in `errors_to_ignore`
Expand All @@ -70,7 +70,7 @@ inline void buffer_register(const void* devPtr_base,
inline void buffer_deregister(const void* devPtr_base)
{
if (defaults::compat_mode()) { return; }
#ifdef KVIKIO_CUFILE_EXIST
#ifdef KVIKIO_CUFILE_FOUND
CUFILE_TRY(cuFileAPI::instance().BufDeregister(devPtr_base));
#endif
}
Expand Down
4 changes: 2 additions & 2 deletions cpp/include/kvikio/driver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ inline void set_driver_flag(unsigned int& prop, unsigned int flag, bool val) noe
}
} // namespace detail

#ifdef KVIKIO_CUFILE_EXIST
#ifdef KVIKIO_CUFILE_FOUND

class DriverInitializer {
// Optional, if not used cuFiles opens the driver automatically
Expand Down Expand Up @@ -178,7 +178,7 @@ class DriverProperties {

[[nodiscard]] std::size_t get_max_batch_io_size()
{
#ifdef CUFILE_BATCH_API_FOUND
#ifdef KVIKIO_CUFILE_BATCH_API_FOUND
lazy_init();
return _props.max_batch_io_size;
#else
Expand Down
2 changes: 1 addition & 1 deletion cpp/include/kvikio/error.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ struct CUfileException : public std::runtime_error {
#define CUDA_DRIVER_TRY_1(_call) CUDA_DRIVER_TRY_2(_call, CUfileException)
#endif

#ifdef KVIKIO_CUFILE_EXIST
#ifdef KVIKIO_CUFILE_FOUND
#ifndef CUFILE_TRY
#define CUFILE_TRY(...) \
GET_CUFILE_TRY_MACRO(__VA_ARGS__, CUFILE_TRY_2, CUFILE_TRY_1) \
Expand Down
8 changes: 4 additions & 4 deletions cpp/include/kvikio/file_handle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class FileHandle {
}

if (_compat_mode) { return; }
#ifdef KVIKIO_CUFILE_EXIST
#ifdef KVIKIO_CUFILE_FOUND
CUfileDescr_t desc{}; // It is important to set to zero!
desc.type = CU_FILE_HANDLE_TYPE_OPAQUE_FD;
// NOLINTNEXTLINE(cppcoreguidelines-pro-type-union-access)
Expand Down Expand Up @@ -213,7 +213,7 @@ class FileHandle {
if (closed()) { return; }

if (!_compat_mode) {
#ifdef KVIKIO_CUFILE_EXIST
#ifdef KVIKIO_CUFILE_FOUND
cuFileAPI::instance().HandleDeregister(_handle);
#endif
}
Expand Down Expand Up @@ -308,7 +308,7 @@ class FileHandle {
if (_compat_mode) {
return posix_device_read(_fd_direct_off, devPtr_base, size, file_offset, devPtr_offset);
}
#ifdef KVIKIO_CUFILE_EXIST
#ifdef KVIKIO_CUFILE_FOUND
ssize_t ret = cuFileAPI::instance().Read(
_handle, devPtr_base, size, convert_size2off(file_offset), convert_size2off(devPtr_offset));
if (ret == -1) {
Expand Down Expand Up @@ -358,7 +358,7 @@ class FileHandle {
if (_compat_mode) {
return posix_device_write(_fd_direct_off, devPtr_base, size, file_offset, devPtr_offset);
}
#ifdef KVIKIO_CUFILE_EXIST
#ifdef KVIKIO_CUFILE_FOUND
ssize_t ret = cuFileAPI::instance().Write(
_handle, devPtr_base, size, convert_size2off(file_offset), convert_size2off(devPtr_offset));
if (ret == -1) {
Expand Down
10 changes: 5 additions & 5 deletions cpp/include/kvikio/shim/cufile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

namespace kvikio {

#ifdef KVIKIO_CUFILE_EXIST
#ifdef KVIKIO_CUFILE_FOUND

/**
* @brief Shim layer of the cuFile C-API
Expand All @@ -47,7 +47,7 @@ class cuFileAPI {
decltype(cuFileDriverSetMaxCacheSize)* DriverSetMaxCacheSize{nullptr};
decltype(cuFileDriverSetMaxPinnedMemSize)* DriverSetMaxPinnedMemSize{nullptr};

#ifdef CUFILE_BATCH_API_FOUND
#ifdef KVIKIO_CUFILE_BATCH_API_FOUND
decltype(cuFileBatchIOSetUp)* BatchIOSetUp{nullptr};
decltype(cuFileBatchIOSubmit)* BatchIOSubmit{nullptr};
decltype(cuFileBatchIOGetStatus)* BatchIOGetStatus{nullptr};
Expand Down Expand Up @@ -83,7 +83,7 @@ class cuFileAPI {
get_symbol(DriverSetMaxCacheSize, lib, KVIKIO_STRINGIFY(cuFileDriverSetMaxCacheSize));
get_symbol(DriverSetMaxPinnedMemSize, lib, KVIKIO_STRINGIFY(cuFileDriverSetMaxPinnedMemSize));

#ifdef CUFILE_BATCH_API_FOUND
#ifdef KVIKIO_CUFILE_BATCH_API_FOUND
get_symbol(BatchIOSetUp, lib, KVIKIO_STRINGIFY(cuFileBatchIOSetUp));
get_symbol(BatchIOSubmit, lib, KVIKIO_STRINGIFY(cuFileBatchIOSubmit));
get_symbol(BatchIOGetStatus, lib, KVIKIO_STRINGIFY(cuFileBatchIOGetStatus));
Expand Down Expand Up @@ -141,7 +141,7 @@ class cuFileAPI {
*
* @return The boolean answer
*/
#ifdef KVIKIO_CUFILE_EXIST
#ifdef KVIKIO_CUFILE_FOUND
inline bool is_cufile_library_available()
{
try {
Expand Down Expand Up @@ -173,7 +173,7 @@ inline bool is_cufile_available()
*
* @return The boolean answer
*/
#ifdef CUFILE_BATCH_API_FOUND
#ifdef KVIKIO_CUFILE_BATCH_API_FOUND
inline bool is_batch_available()
{
try {
Expand Down
13 changes: 4 additions & 9 deletions cpp/include/kvikio/shim/cufile_h_wrapper.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,14 @@

/**
* In order to support compilation when `cufile.h` isn't available, we
* wrap all use of cufile in a `#ifdef KVIKIO_CUFILE_EXIST` guard.
* wrap all use of cufile in a `#ifdef KVIKIO_CUFILE_FOUND` guard.
*
* The motivation here is to make KvikIO work in all circumstances so
* that libraries doesn't have to implement there own fallback solutions.
*/
#ifndef KVIKIO_DISABLE_CUFILE
#if __has_include(<cufile.h>)
#ifdef KVIKIO_CUFILE_FOUND
#include <cufile.h>
#define KVIKIO_CUFILE_EXIST
#endif
#endif

#ifndef KVIKIO_CUFILE_EXIST
#else
using CUfileDriverControlFlags_t = enum CUfileDriverControlFlags {
CU_FILE_USE_POLL_MODE = 0, /*!< use POLL mode. properties.use_poll_mode*/
CU_FILE_ALLOW_COMPAT_MODE = 1 /*!< allow COMPATIBILITY mode. properties.allow_compat_mode*/
Expand All @@ -39,7 +34,7 @@ using CUfileHandle_t = void*;

// If the Batch API isn't defined, we define some of the data types here.
// Notice, this doesn't need to be ABI compatible with the cufile definitions.
#ifndef CUFILE_BATCH_API_FOUND
#ifndef KVIKIO_CUFILE_BATCH_API_FOUND
typedef enum CUfileOpcode { CUFILE_READ = 0, CUFILE_WRITE } CUfileOpcode_t;

typedef enum CUFILEStatus_enum {
Expand Down
12 changes: 10 additions & 2 deletions dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ files:
- py_version
- run
- test_python
- test_python_legate
test_cpp:
output: none
includes:
Expand Down Expand Up @@ -79,6 +80,7 @@ files:
key: test
includes:
- test_python
- test_python_legate
channels:
- rapidsai
- rapidsai-nightly
Expand Down Expand Up @@ -211,6 +213,7 @@ dependencies:
packages:
- numpy>=1.21
- zarr
- packaging
- output_types: conda
packages:
- cupy>=12.0.0
Expand All @@ -229,8 +232,7 @@ dependencies:
common:
- output_types: [conda, requirements, pyproject]
packages:
- dask>=2022.05.2
- distributed>=2022.05.2
- &dask dask>=2022.05.2
- pytest
- pytest-cov
specific:
Expand All @@ -243,6 +245,12 @@ dependencies:
- matrix: # All CUDA 11 versions
packages:
- cuda-python>=11.7.1,<12.0
test_python_legate:
common:
- output_types: [conda, requirements, pyproject]
packages:
- *dask
- distributed>=2022.05.2
notebooks:
common:
- output_types: conda
Expand Down
1 change: 1 addition & 0 deletions legate/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ requires-python = ">=3.9"
dependencies = [
"cupy-cuda11x>=12.0.0",
"numpy>=1.21",
"packaging",
"zarr",
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../dependencies.yaml and run `rapids-dependency-file-generator`.
classifiers = [
Expand Down
5 changes: 2 additions & 3 deletions python/benchmarks/single-node-io.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,8 @@ def run_zarr(args):
import kvikio.zarr

dir_path = args.dir / "zarr"

if not hasattr(zarr.Array, "meta_array"):
raise RuntimeError("requires Zarr v2.13+")
if not kvikio.zarr.supported:
raise RuntimeError(f"requires Zarr >={kvikio.zarr.MINIMUM_ZARR_VERSION}")

compressor = None
if args.zarr_compressor is not None:
Expand Down
Loading

0 comments on commit 5451cda

Please sign in to comment.