25 #include <kvikio/compat_mode.hpp>
26 #include <kvikio/http_status_codes.hpp>
27 #include <kvikio/shim/cufile.hpp>
28 #include <kvikio/threadpool_wrapper.hpp>
36 T getenv_or(std::string_view env_var_name, T default_val)
38 auto const* env_val = std::getenv(env_var_name.data());
39 if (env_val ==
nullptr) {
return default_val; }
41 std::stringstream sstream(env_val);
43 sstream >> converted_val;
45 "unknown config value " + std::string{env_var_name} +
"=" + std::string{env_val},
46 std::invalid_argument);
51 bool getenv_or(std::string_view env_var_name,
bool default_val);
57 std::vector<int> getenv_or(std::string_view env_var_name, std::vector<int> default_val);
67 std::size_t _task_size;
68 std::size_t _gds_threshold;
69 std::size_t _bounce_buffer_size;
70 std::size_t _http_max_attempts;
72 std::vector<int> _http_status_codes;
74 static unsigned int get_num_threads_from_env();
78 KVIKIO_EXPORT
static defaults* instance();
Singleton class of default values used throughout KvikIO.
static CompatMode infer_compat_mode_if_auto(CompatMode compat_mode) noexcept
Infer the AUTO compatibility mode from the system runtime.
static std::size_t task_size()
Get the default task size used for parallel IO operations.
static std::vector< int > const & http_status_codes()
The list of HTTP status codes to retry.
static void set_task_size(std::size_t nbytes)
Set the default task size used for parallel IO operations.
static bool is_compat_mode_preferred()
Whether the global compatibility mode from class defaults is expected to be ON.
static void set_http_status_codes(std::vector< int > status_codes)
Set the list of HTTP status codes to retry.
static void set_compat_mode(CompatMode compat_mode)
Set the value of kvikio::defaults::compat_mode().
static void set_gds_threshold(std::size_t nbytes)
Set the default GDS threshold, which is the minimum size to use GDS (in bytes).
static void set_http_timeout(long timeout_seconds)
Reset the http timeout.
static bool is_compat_mode_preferred(CompatMode compat_mode) noexcept
Given a requested compatibility mode, whether it is expected to reduce to ON.
static void set_thread_pool_nthreads(unsigned int nthreads)
Set the number of threads in the default thread pool. Waits for all currently running tasks to be com...
static std::size_t http_max_attempts()
Get the maximum number of attempts per remote IO read.
static BS_thread_pool & thread_pool()
Get the default thread pool.
static long http_timeout()
The maximum time, in seconds, the transfer is allowed to complete.
static std::size_t gds_threshold()
Get the default GDS threshold, which is the minimum size to use GDS (in bytes).
static unsigned int thread_pool_nthreads()
Get the number of threads in the default thread pool.
static std::size_t bounce_buffer_size()
Get the size of the bounce buffer used to stage data in host memory.
static void set_http_max_attempts(std::size_t attempts)
Set the maximum number of attempts per remote IO read.
static void set_bounce_buffer_size(std::size_t nbytes)
Set the size of the bounce buffer used to stage data in host memory.
static CompatMode compat_mode()
Return whether the KvikIO library is running in compatibility mode or not.
#define KVIKIO_EXPECT(...)
Macro for checking pre-conditions or conditions that throws an exception when a condition is violated...
CompatMode
I/O compatibility mode.