-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use cuFile direct device reads/writes by default in cuIO (#9722)
Making this change early in 22.02 to test through internal use + nightly builds before the release. - Modify the way cuFile integration is enabled to match the nvCOMP integration. - Change the default from OFF to GDS (GDS on, only for direct reads/writes, no compatibility mode). - cuFile JSON config file is now modified on first cuFile use (same time as the driver), instead of the first query that checks if GDS use is enabled. Authors: - Vukasin Milovanovic (https://github.com/vuule) Approvers: - David Wendt (https://github.com/davidwendt) - Bradley Dice (https://github.com/bdice) - Vyas Ramasubramani (https://github.com/vyasr) URL: #9722
- Loading branch information
Showing
8 changed files
with
171 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/* | ||
* Copyright (c) 2021, NVIDIA CORPORATION. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
#include "config_utils.hpp" | ||
|
||
#include <cudf/utilities/error.hpp> | ||
|
||
#include <cstdlib> | ||
#include <string> | ||
|
||
namespace cudf::io::detail { | ||
|
||
std::string getenv_or(std::string const& env_var_name, std::string_view default_val) | ||
{ | ||
auto const env_val = std::getenv(env_var_name.c_str()); | ||
return std::string{(env_val == nullptr) ? default_val : env_val}; | ||
} | ||
|
||
namespace cufile_integration { | ||
|
||
namespace { | ||
/** | ||
* @brief Defines which cuFile usage to enable. | ||
*/ | ||
enum class usage_policy : uint8_t { OFF, GDS, ALWAYS }; | ||
|
||
/** | ||
* @brief Get the current usage policy. | ||
*/ | ||
usage_policy get_env_policy() | ||
{ | ||
static auto const env_val = getenv_or("LIBCUDF_CUFILE_POLICY", "GDS"); | ||
if (env_val == "OFF") return usage_policy::OFF; | ||
if (env_val == "GDS") return usage_policy::GDS; | ||
if (env_val == "ALWAYS") return usage_policy::ALWAYS; | ||
CUDF_FAIL("Invalid LIBCUDF_CUFILE_POLICY value: " + env_val); | ||
} | ||
} // namespace | ||
|
||
bool is_always_enabled() { return get_env_policy() == usage_policy::ALWAYS; } | ||
|
||
bool is_gds_enabled() { return is_always_enabled() or get_env_policy() == usage_policy::GDS; } | ||
|
||
} // namespace cufile_integration | ||
|
||
namespace nvcomp_integration { | ||
|
||
namespace { | ||
/** | ||
* @brief Defines which nvCOMP usage to enable. | ||
*/ | ||
enum class usage_policy : uint8_t { OFF, STABLE, ALWAYS }; | ||
|
||
/** | ||
* @brief Get the current usage policy. | ||
*/ | ||
usage_policy get_env_policy() | ||
{ | ||
static auto const env_val = getenv_or("LIBCUDF_NVCOMP_POLICY", "STABLE"); | ||
if (env_val == "OFF") return usage_policy::OFF; | ||
if (env_val == "STABLE") return usage_policy::STABLE; | ||
if (env_val == "ALWAYS") return usage_policy::ALWAYS; | ||
CUDF_FAIL("Invalid LIBCUDF_NVCOMP_POLICY value: " + env_val); | ||
} | ||
} // namespace | ||
|
||
bool is_all_enabled() { return get_env_policy() == usage_policy::ALWAYS; } | ||
|
||
bool is_stable_enabled() { return is_all_enabled() or get_env_policy() == usage_policy::STABLE; } | ||
|
||
} // namespace nvcomp_integration | ||
|
||
} // namespace cudf::io::detail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.