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

Clean up error handling #394

Merged
merged 3 commits into from
Jun 25, 2024
Merged

Conversation

madsbk
Copy link
Member

@madsbk madsbk commented Jun 19, 2024

No description provided.

@madsbk madsbk added improvement Improves an existing functionality non-breaking Introduces a non-breaking change labels Jun 19, 2024
@madsbk madsbk marked this pull request as ready for review June 19, 2024 15:03
@madsbk madsbk requested review from a team as code owners June 19, 2024 15:03
Comment on lines +524 to +526
// When checking for availability, we also check if cuFile's config file exist. This is because
// even when the stream API is available, it doesn't work if no config file exist.
if (kvikio::is_batch_and_stream_available() && !_compat_mode && !config_path().empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wow, this is horrible. Is this a documented restriction, or an empirically observed one?

If the former: can we please link to the docs in this comment.

If the latter: can we please open a bug that requests that this "feature" is fixed?

In either case, can we provide a warning when constructing the config_path singleton for the first time if a config file was not found, since this is not a discoverable failure mode.

Copy link
Member Author

Choose a reason for hiding this comment

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

It is the latter, by default the thread pool isn't enabled, which is required by the stream API.

AFAICT, the conda cufile package doesn't install a config file thus a warning would be triggered always. If we want a warning, we should make sure that the conda and pip package of cufile installs a config file.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, so if there is no config file, then no thread pool, and therefore no stream.

Alternatively, if there is a config file, then there is a thread pool? Or is it that there is a thread pool by default, and it can be turned off.

If the conda/pip version of cufile doesn't install a default config file (which I am guessing must live in /etc/cufile.json), then we need to fix something. But neither of those systems is allowed to write to /etc, so we would need to have a way to control the "root" location of the default configuration file.

But in any case, absence of a default config file should (IMO) result in all defaults being applied, so that there should be no runtime difference between /etc/cufile.json exists and is filled with default values and /etc/cufile.json doesn't exist.

Copy link
Contributor

Choose a reason for hiding this comment

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

There is a config file but we do not ship it in $CONDA_PREFIX/etc. Is this desirable? https://github.com/conda-forge/libcufile-feedstock/blob/3c84e7c8ade4501345445ea56691db2767085b94/recipe/build.sh#L7

Copy link
Contributor

Choose a reason for hiding this comment

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

The decision to drop the config file was made here: conda-forge/staged-recipes#21908 (comment)

Copy link
Member Author

@madsbk madsbk Jun 24, 2024

Choose a reason for hiding this comment

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

Maybe set CUFILE_ENV_PATH_JSON in the conda activation script if CUFILE_ENV_PATH_JSON isn't already defined and /etc/cufile.json doesn't exist?

Copy link
Member Author

@madsbk madsbk Jun 24, 2024

Choose a reason for hiding this comment

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

@wence- my guess is that the threadpool is enabled by default in cufile.json and disabled in the default value embedded in libcufile.

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 can confirm that max_io_threads and parallel_io are 0 when no config is found.

Copy link
Member Author

@madsbk madsbk Jun 25, 2024

Choose a reason for hiding this comment

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

@wence- I suggest we use this for now. Let's think of a more general solution to the cufile.json issue in a new PR.
Maybe KvikIO should parse the config file to provide more helpful errors and warnings?

Copy link
Contributor

Choose a reason for hiding this comment

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

@wence- I suggest we use this for now. Let's think of a more general solution to the cufile.json issue in a new PR.

Makes sense.

Maybe KvikIO should parse the config file to provide more helpful errors and warnings?

Preferably not, if we can avoid it :).

@madsbk
Copy link
Member Author

madsbk commented Jun 25, 2024

/merge

@rapids-bot rapids-bot bot merged commit 648cae3 into rapidsai:branch-24.08 Jun 25, 2024
56 checks passed
@madsbk madsbk deleted the error_cleanup branch July 25, 2024 06:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves an existing functionality non-breaking Introduces a non-breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants