Skip to content

Commit 6aa623d

Browse files
committed
add print cpu info
1 parent cda0e4b commit 6aa623d

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

ggml/src/ggml-sycl.cpp

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,29 @@
4242

4343
static bool g_sycl_loaded = false;
4444

45+
void print_cpu_detail() {
46+
sycl::device device;
47+
device = sycl::device(sycl::cpu_selector_v);
48+
49+
dpct::device_info prop;
50+
SYCL_CHECK(CHECK_TRY_ERROR(
51+
dpct::get_device_info(prop, device)));
52+
53+
std::string name = std::string(prop.get_name());
54+
name = std::regex_replace(name, std::regex("\\(R\\)"), "");
55+
name = std::regex_replace(name, std::regex("\\(TM\\)"), "");
56+
57+
auto global_mem_size = prop.get_global_mem_size()/1000000;
58+
std::string res= "[SYCL] CPU: ["+name+"] Memory: ["+std::to_string(global_mem_size)+"M]\n";
59+
60+
fprintf(stderr, "%s", res.c_str());
61+
}
62+
4563
static ggml_sycl_device_info ggml_sycl_init() {
4664
ggml_sycl_device_info info = {};
4765

66+
print_cpu_detail();
67+
4868
info.device_count = dpct::dev_mgr::instance().device_count();
4969
if (info.device_count == 0) {
5070
fprintf(stderr, "%s: failed to initialize " GGML_SYCL_NAME ": %s\n", __func__);
@@ -64,7 +84,7 @@ static ggml_sycl_device_info ggml_sycl_init() {
6484
#else
6585
fprintf(stderr, "%s: SYCL_USE_XMX: no\n", __func__);
6686
#endif
67-
fprintf(stderr, "%s: found %d " GGML_SYCL_NAME " devices:\n", __func__, info.device_count);
87+
fprintf(stderr, "%s: found %d " GGML_SYCL_NAME " devices\n", __func__, info.device_count);
6888

6989
for (int i = 0; i < info.device_count; ++i) {
7090
info.devices[i].vmm = 0;
@@ -92,6 +112,7 @@ const ggml_sycl_device_info & ggml_sycl_info() {
92112
return info;
93113
}
94114

115+
95116
void print_device_detail(int id, sycl::device &device, std::string device_type) {
96117

97118
dpct::device_info prop;

0 commit comments

Comments
 (0)