-
Notifications
You must be signed in to change notification settings - Fork 513
Add some logging to GPU detection #6992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -584,32 +584,36 @@ static void get_available_nvidia_ram(COPROC_NVIDIA &cc, vector<string>& warnings | |
| retval = (*p_cuDeviceGet)(&device, cc.device_num); | ||
| if (retval) { | ||
| snprintf(buf, sizeof(buf), | ||
| "[coproc] cuDeviceGet(%d) returned %d", cc.device_num, retval | ||
| "cuDeviceGet(%d) returned %d", cc.device_num, retval | ||
| ); | ||
| gpu_warning(warnings, buf); | ||
| return; | ||
| } | ||
| retval = (*p_cuCtxCreate)(&ctx, 0, device); | ||
| if (retval) { | ||
| snprintf(buf, sizeof(buf), | ||
| "[coproc] cuCtxCreate(%d) returned %d", cc.device_num, retval | ||
| "cuCtxCreate(%d) returned %d", cc.device_num, retval | ||
| ); | ||
| gpu_warning(warnings, buf); | ||
| return; | ||
| } | ||
| if (p_cuMemGetInfo_v2) { | ||
| retval = (*p_cuMemGetInfo_v2)(&memfree, &memtotal); | ||
| } | ||
| else { | ||
| // cuMemGetInfo_v2() always returns 201 (no context) | ||
| if (p_cuMemGetInfo) { | ||
| retval = (*p_cuMemGetInfo)(&memfree, &memtotal); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. P1: Handle Prompt for AI agents |
||
| } | ||
| if (retval) { | ||
| snprintf(buf, sizeof(buf), | ||
| "[coproc] cuMemGetInfo(%d) returned %d", cc.device_num, retval | ||
| "cuMemGetInfo() returned %d; dev %d free %zu total %zu", | ||
| retval, cc.device_num, memfree, memtotal | ||
|
Comment on lines
+600
to
+605
|
||
| ); | ||
| gpu_warning(warnings, buf); | ||
| (*p_cuCtxDestroy)(ctx); | ||
| return; | ||
| } else if (p_cuMemGetInfo_v2) { | ||
| retval = (*p_cuMemGetInfo_v2)(&memfree, &memtotal); | ||
| snprintf(buf, sizeof(buf), | ||
| "cuMemGetInfo_v2() returned %d; dev %d free %zu total %zu", | ||
| retval, cc.device_num, memfree, memtotal | ||
| ); | ||
| gpu_warning(warnings, buf); | ||
| } else { | ||
| gpu_warning(warnings, "No MemGetInfo function available"); | ||
| } | ||
| (*p_cuCtxDestroy)(ctx); | ||
| cc.available_ram = (double) memfree; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -745,13 +745,15 @@ void COPROCS::get_opencl( | |
| double freq = ((double)prop.max_clock_frequency) * MEGA; | ||
| prop.peak_flops = ((double)prop.max_compute_units) * freq; | ||
| } | ||
| char buf2[256]; | ||
| snprintf(buf2, sizeof(buf2), | ||
| "OpenCL generic: peak FLOPS %f; Max units %u, max freq %u MHz", | ||
| prop.peak_flops, | ||
| prop.max_compute_units, prop.max_clock_frequency | ||
| ); | ||
| gpu_warning(warnings, buf2); | ||
| if (prop.peak_flops <= 0 || prop.peak_flops > GPU_MAX_PEAK_FLOPS) { | ||
| char buf2[256]; | ||
| snprintf(buf2, sizeof(buf2), | ||
| "OpenCL generic: bad peak FLOPS; Max units %u, max freq %u MHz", | ||
| prop.max_compute_units, prop.max_clock_frequency | ||
| ); | ||
| gpu_warning(warnings, buf2); | ||
| gpu_warning(warnings, "bad peak flops value; using default"); | ||
|
Comment on lines
+749
to
+756
|
||
| prop.peak_flops = GPU_DEFAULT_PEAK_FLOPS; | ||
|
Comment on lines
755
to
757
|
||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
gpu_warning() now calls time_to_string(dtime()), but this file doesn't include str_util.h where time_to_string() is declared. This will fail to compile; include str_util.h (or otherwise ensure time_to_string is declared) in this translation unit.