Static Public Member Functions | List of all members
kvikio::defaults Class Reference

Singleton class of default values used thoughtout KvikIO. More...

#include <defaults.hpp>

Static Public Member Functions

static bool compat_mode ()
 Return whether the KvikIO library is running in compatibility mode or not. More...
 
static void compat_mode_reset (bool enable)
 Reset the value of kvikio::defaults::compat_mode() More...
 
static kvikio::third_party::thread_poolthread_pool ()
 Get the default thread pool. More...
 
static unsigned int thread_pool_nthreads ()
 Get the number of threads in the default thread pool. More...
 
static void thread_pool_nthreads_reset (unsigned int nthreads)
 Reset the number of threads in the default thread pool. Waits for all currently running tasks to be completed, then destroys all threads in the pool and creates a new thread pool with the new number of threads. Any tasks that were waiting in the queue before the pool was reset will then be executed by the new threads. If the pool was paused before resetting it, the new pool will be paused as well. More...
 
static std::size_t task_size ()
 Get the default task size used for parallel IO operations. More...
 
static void task_size_reset (std::size_t nbytes)
 Reset the default task size used for parallel IO operations. More...
 
static std::size_t gds_threshold ()
 Get the default GDS threshold, which is the minimum size to use GDS (in bytes). More...
 
static void gds_threshold_reset (std::size_t nbytes)
 Reset the default GDS threshold, which is the minimum size to use GDS (in bytes). More...
 

Detailed Description

Singleton class of default values used thoughtout KvikIO.

Definition at line 79 of file defaults.hpp.

Member Function Documentation

◆ compat_mode()

static bool kvikio::defaults::compat_mode ( )
inlinestatic

Return whether the KvikIO library is running in compatibility mode or not.

Notice, this is not the same as the compatibility mode in cuFile. That is, cuFile can run in compatibility mode while KvikIO is not.

When KvikIO is running in compatibility mode, it doesn't load libcufile.so. Instead, reads and writes are done using POSIX.

Set the environment variable KVIKIO_COMPAT_MODE to enable/disable compatibility mode. By default, compatibility mode is enabled:

  • when libcufile cannot be found
  • when running in Windows Subsystem for Linux (WSL)
  • when /run/udev isn't readable, which typically happens when running inside a docker image not launched with --volume /run/udev:/run/udev:ro
Returns
The boolean answer

Definition at line 148 of file defaults.hpp.

◆ compat_mode_reset()

static void kvikio::defaults::compat_mode_reset ( bool  enable)
inlinestatic

Reset the value of kvikio::defaults::compat_mode()

Changing compatibility mode, effects all new FileHandles that doesn't sets the compat_mode argument explicitly but it never effect existing FileHandles.

Parameters
enableWhether to enable compatibility mode or not.

Definition at line 158 of file defaults.hpp.

◆ gds_threshold()

static std::size_t kvikio::defaults::gds_threshold ( )
inlinestatic

Get the default GDS threshold, which is the minimum size to use GDS (in bytes).

In order to improve performance of small IO, .pread() and .pwrite() implement a shortcut that circumvent the threadpool and use the POSIX backend directly.

Set the default value using kvikio::default::gds_threshold_reset() or by setting the KVIKIO_GDS_THRESHOLD environment variable. If not set, the default value is 1 MiB.

Returns
The default GDS threshold size in bytes.

Definition at line 226 of file defaults.hpp.

◆ gds_threshold_reset()

static void kvikio::defaults::gds_threshold_reset ( std::size_t  nbytes)
inlinestatic

Reset the default GDS threshold, which is the minimum size to use GDS (in bytes).

Parameters
nbytesThe default GDS threshold size in bytes.

Definition at line 232 of file defaults.hpp.

◆ task_size()

static std::size_t kvikio::defaults::task_size ( )
inlinestatic

Get the default task size used for parallel IO operations.

Set the default value using kvikio::default::task_size_reset() or by setting the KVIKIO_TASK_SIZE environment variable. If not set, the default value is 4 MiB.

Returns
The default task size in bytes.

Definition at line 206 of file defaults.hpp.

◆ task_size_reset()

static void kvikio::defaults::task_size_reset ( std::size_t  nbytes)
inlinestatic

Reset the default task size used for parallel IO operations.

Parameters
nbytesThe default task size in bytes.

Definition at line 213 of file defaults.hpp.

◆ thread_pool()

static kvikio::third_party::thread_pool& kvikio::defaults::thread_pool ( )
inlinestatic

Get the default thread pool.

Notice, it is not possible to change the default thread pool. KvikIO will always use the same thread pool however it is possible to change number of threads in the pool (see kvikio::default::thread_pool_nthreads_reset()).

Returns
The the default thread pool instance.

Definition at line 169 of file defaults.hpp.

◆ thread_pool_nthreads()

static unsigned int kvikio::defaults::thread_pool_nthreads ( )
inlinestatic

Get the number of threads in the default thread pool.

Set the default value using kvikio::default::thread_pool_nthreads_reset() or by setting the KVIKIO_NTHREADS environment variable. If not set, the default value is 1.

Returns
The number of threads.

Definition at line 182 of file defaults.hpp.

◆ thread_pool_nthreads_reset()

static void kvikio::defaults::thread_pool_nthreads_reset ( unsigned int  nthreads)
inlinestatic

Reset the number of threads in the default thread pool. Waits for all currently running tasks to be completed, then destroys all threads in the pool and creates a new thread pool with the new number of threads. Any tasks that were waiting in the queue before the pool was reset will then be executed by the new threads. If the pool was paused before resetting it, the new pool will be paused as well.

Parameters
nthreadsThe number of threads to use.

Definition at line 196 of file defaults.hpp.


The documentation for this class was generated from the following file: