@@ -4,10 +4,9 @@ use std::sync::Once;
44
55use anyhow:: anyhow;
66use safer_ffi:: prelude:: * ;
7- use safer_ffi:: slice:: slice_boxed;
87
98use super :: types:: {
10- catch_panic_response, catch_panic_response_no_log, GpuDeviceResponse , InitLogFdResponse ,
9+ catch_panic_response, catch_panic_response_no_log, GpuDeviceResponse , InitLogFdResponse , GpuDeviceInfo
1110} ;
1211
1312/// Protects the init off the logger.
@@ -35,18 +34,22 @@ pub fn init_log_with_file(file: File) -> Option<()> {
3534
3635/// Serialize the GPU device names into a vector
3736#[ cfg( any( feature = "opencl" , feature = "cuda" , feature = "cuda-supraseal" ) ) ]
38- fn get_gpu_devices_internal ( ) -> Vec < slice_boxed < u8 > > {
37+ fn get_gpu_devices_internal ( ) -> Vec < GpuDeviceInfo > {
3938 let devices = rust_gpu_tools:: Device :: all ( ) ;
4039
4140 devices
4241 . into_iter ( )
43- . map ( |d| d. name ( ) . into_bytes ( ) . into_boxed_slice ( ) . into ( ) )
42+ . map ( |d| GpuDeviceInfo {
43+ name : d. name ( ) . into_bytes ( ) . into_boxed_slice ( ) . into ( ) ,
44+ vram_bytes : d. memory ( ) . into ( ) ,
45+ cores : d. compute_units ( ) . into ( )
46+ } )
4447 . collect ( )
4548}
4649
4750// Return empty vector for GPU devices if cuda and opencl are disabled
4851#[ cfg( not( any( feature = "opencl" , feature = "cuda" , feature = "cuda-supraseal" ) ) ) ]
49- fn get_gpu_devices_internal ( ) -> Vec < slice_boxed < u8 > > {
52+ fn get_gpu_devices_internal ( ) -> Vec < GpuDeviceInfo > {
5053 Vec :: new ( )
5154}
5255
0 commit comments