add device_flops() for cpu, metal, and cuda
This commit is contained in:
+28
-2
@@ -8,8 +8,11 @@ struct cpu_props {
|
||||
const char * name;
|
||||
const char * description;
|
||||
uint32_t cores;
|
||||
float flops_f32;
|
||||
float flops_f16;
|
||||
float flops_f32; // in GFLOPS
|
||||
float flops_f16; // in GFLOPS
|
||||
|
||||
cpu_props()
|
||||
: name(""), description(""), cores(0), flops_f32(0.0f), flops_f16(0.0f) {}
|
||||
};
|
||||
|
||||
struct memory_info {
|
||||
@@ -18,6 +21,9 @@ struct memory_info {
|
||||
float total_swap; // in GB
|
||||
float available_swap; // in GB
|
||||
float bandwidth; // in GB/s
|
||||
|
||||
memory_info()
|
||||
: total_physical(0.0f), available_physical(0.0f), total_swap(0.0f), available_swap(0.0f), bandwidth(0.0f) {}
|
||||
};
|
||||
|
||||
struct gpu_support {
|
||||
@@ -28,6 +34,9 @@ struct gpu_support {
|
||||
bool gpublas;
|
||||
bool blas;
|
||||
bool sycl;
|
||||
|
||||
gpu_support()
|
||||
: metal(false), cuda(false), vulkan(false), kompute(false), gpublas(false), blas(false), sycl(false) {}
|
||||
};
|
||||
|
||||
struct gpu_props {
|
||||
@@ -35,6 +44,11 @@ struct gpu_props {
|
||||
const char * description;
|
||||
float memory_free; // in GB
|
||||
float memory_total; // in GB
|
||||
float metal_flops; // in GFLOPS
|
||||
float cuda_flops; // in GFLOPS
|
||||
|
||||
gpu_props()
|
||||
: name(""), description(""), memory_free(0.0f), memory_total(0.0f), metal_flops(0.0f), cuda_flops(0.0f) {}
|
||||
};
|
||||
|
||||
struct device_info {
|
||||
@@ -45,12 +59,24 @@ struct device_info {
|
||||
struct memory_info memory;
|
||||
struct gpu_support gpu_support;
|
||||
struct gpu_props gpu_props;
|
||||
|
||||
device_info()
|
||||
: rank(0), device_name(""), disk_read_bandwidth(0.0f), cpu_props(), memory(), gpu_support(), gpu_props() {}
|
||||
};
|
||||
|
||||
enum profiler_backend_type {
|
||||
PROFILER_BACKEND_TYPE_CPU = 0,
|
||||
PROFILER_BACKEND_TYPE_METAL = 1,
|
||||
PROFILER_BACKEND_TYPE_CUDA = 2,
|
||||
};
|
||||
|
||||
const char * device_name(void);
|
||||
|
||||
uint32_t device_cpu_cores (void);
|
||||
float device_flops (struct llama_model * model, enum ggml_type dtype, profiler_backend_type btype, int n_threads);
|
||||
float device_cpu_flops (struct llama_model * model, enum ggml_type dtype, int n_threads);
|
||||
float device_metal_flops (struct llama_model * model, enum ggml_type dtype);
|
||||
float device_cuda_flops (struct llama_model * model, enum ggml_type dtype);
|
||||
uint64_t device_physical_memory(bool available);
|
||||
uint64_t device_swap_memory (bool available);
|
||||
uint64_t device_disk_read_bw (const char * test_file, size_t buffer_size_mb);
|
||||
|
||||
Reference in New Issue
Block a user