pub struct GlobalConfig {
pub profiling: ProfilingConfig,
pub autotune: AutotuneConfig,
pub compilation: CompilationConfig,
}
Expand description
Represents the global configuration for CubeCL, combining profiling, autotuning, and compilation settings.
Fields§
§profiling: ProfilingConfig
Configuration for profiling CubeCL operations.
autotune: AutotuneConfig
Configuration for autotuning performance parameters.
compilation: CompilationConfig
Configuration for compilation settings.
Implementations§
Source§impl GlobalConfig
impl GlobalConfig
Sourcepub fn get() -> Arc<Self>
pub fn get() -> Arc<Self>
Retrieves the current global configuration, loading it from the current directory if not set.
If no configuration is set, it attempts to load one from cubecl.toml
or CubeCL.toml
in the
current directory or its parents. If no file is found, a default configuration is used.
§Notes
Calling this function is somewhat expensive, because of a global static lock. The config format is optimized for parsing, not for consumption. A good practice is to use a local static atomic value that you can populate with the appropriate value from the global config during initialization of the atomic value.
For example, the autotune level uses a core::sync::atomic::AtomicI32 with an initial
value of -1
to indicate an uninitialized state. It is then set to the proper value based on
the super::autotune::AutotuneLevel config. All subsequent fetches of the value are
lock-free.
Sourcepub fn save_default<P: AsRef<Path>>(path: P) -> Result<()>
pub fn save_default<P: AsRef<Path>>(path: P) -> Result<()>
Save the default configuration to the provided file path.
Sourcepub fn set(config: Self)
pub fn set(config: Self)
Sets the global configuration to the provided value.
§Panics
Panics if the configuration has already been set or read, as it cannot be overridden.
§Warning
This method must be called at the start of the program, before any calls to get
. Attempting
to set the configuration after it has been initialized will cause a panic.
Sourcepub fn override_from_env(self) -> Self
pub fn override_from_env(self) -> Self
Overrides configuration fields based on environment variables.
Trait Implementations§
Source§impl Clone for GlobalConfig
impl Clone for GlobalConfig
Source§fn clone(&self) -> GlobalConfig
fn clone(&self) -> GlobalConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more