From 6aa623d363a760878ecae23177d835fca7079c80 Mon Sep 17 00:00:00 2001 From: arthw <14088817+arthw@users.noreply.github.com> Date: Sun, 20 Oct 2024 10:47:16 +0800 Subject: [PATCH] add print cpu info --- ggml/src/ggml-sycl.cpp | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/ggml/src/ggml-sycl.cpp b/ggml/src/ggml-sycl.cpp index 4d91ee460..bb659d104 100644 --- a/ggml/src/ggml-sycl.cpp +++ b/ggml/src/ggml-sycl.cpp @@ -42,9 +42,29 @@ static bool g_sycl_loaded = false; +void print_cpu_detail() { + sycl::device device; + device = sycl::device(sycl::cpu_selector_v); + + dpct::device_info prop; + SYCL_CHECK(CHECK_TRY_ERROR( + dpct::get_device_info(prop, device))); + + std::string name = std::string(prop.get_name()); + name = std::regex_replace(name, std::regex("\\(R\\)"), ""); + name = std::regex_replace(name, std::regex("\\(TM\\)"), ""); + + auto global_mem_size = prop.get_global_mem_size()/1000000; + std::string res= "[SYCL] CPU: ["+name+"] Memory: ["+std::to_string(global_mem_size)+"M]\n"; + + fprintf(stderr, "%s", res.c_str()); +} + static ggml_sycl_device_info ggml_sycl_init() { ggml_sycl_device_info info = {}; + print_cpu_detail(); + info.device_count = dpct::dev_mgr::instance().device_count(); if (info.device_count == 0) { fprintf(stderr, "%s: failed to initialize " GGML_SYCL_NAME ": %s\n", __func__); @@ -64,7 +84,7 @@ static ggml_sycl_device_info ggml_sycl_init() { #else fprintf(stderr, "%s: SYCL_USE_XMX: no\n", __func__); #endif - fprintf(stderr, "%s: found %d " GGML_SYCL_NAME " devices:\n", __func__, info.device_count); + fprintf(stderr, "%s: found %d " GGML_SYCL_NAME " devices\n", __func__, info.device_count); for (int i = 0; i < info.device_count; ++i) { info.devices[i].vmm = 0; @@ -92,6 +112,7 @@ const ggml_sycl_device_info & ggml_sycl_info() { return info; } + void print_device_detail(int id, sycl::device &device, std::string device_type) { dpct::device_info prop;