pub struct DeviceConfig {
pub cpu_config: CpuConfig,
pub ram_config: RamConfig,
pub use_gpu: bool,
pub cuda_config: Option<CudaConfig>,
pub error_on_config_issue: bool,
pub layer_count: Option<u64>,
pub average_layer_size_bytes: Option<u64>,
pub local_model_path: String,
}Expand description
Configuration for device-specific settings in LLM inference.
Fields§
§cpu_config: CpuConfigCPU configuration for thread count.
ram_config: RamConfigRAM configuration for non-GPU inference on Windows and Unix.
This setting is used when GPU acceleration is not available or not enabled.
use_gpu: boolIndicates whether to use any available GPUs for inference.
If true, the system will attempt to use GPU acceleration. If false, inference will be performed on CPU only.
cuda_config: Option<CudaConfig>CUDA configuration for GPU inference on non-macOS platforms.
This field is only available on platforms other than macOS. If None, default CUDA settings will be used when GPU is enabled.
error_on_config_issue: boolDetermines error handling behavior for configuration issues.
If true, the system will return an error when encountering configuration issues. If false (default), issues will be logged and execution will continue if possible.
This flag is useful for debugging purposes.
layer_count: Option<u64>The number of layers in the model.
This is set at runtime.
average_layer_size_bytes: Option<u64>The average size of a layer in bytes.
This is set at runtime.
local_model_path: StringThe file system path to the local model.
This is set at runtime.
Implementations§
Source§impl DeviceConfig
impl DeviceConfig
pub fn initialize(&mut self) -> Result<()>
pub fn available_memory_bytes(&self) -> Result<u64>
pub fn average_layer_size_bytes(&self) -> Result<u64>
pub fn layer_count(&self) -> Result<u64>
pub fn main_gpu(&self) -> Result<u32>
pub fn gpu_count(&self) -> usize
pub fn allocate_layers_to_gpus( &self, buffer_layer_per_gpu: u64, buffer_layer_main_gpu: u64, ) -> Result<Vec<GpuDevice>>
Trait Implementations§
Source§impl Clone for DeviceConfig
impl Clone for DeviceConfig
Source§fn clone(&self) -> DeviceConfig
fn clone(&self) -> DeviceConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more