diff options
| -rw-r--r-- | libsmctrl.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libsmctrl.c b/libsmctrl.c index 7debe3a..30edb32 100644 --- a/libsmctrl.c +++ b/libsmctrl.c | |||
| @@ -460,16 +460,20 @@ void libsmctrl_set_stream_mask_ext(void* stream, uint128_t mask) { | |||
| 460 | // Read an integer from a file in `/proc` | 460 | // Read an integer from a file in `/proc` |
| 461 | static int read_int_procfile(char* filename, uint64_t* out) { | 461 | static int read_int_procfile(char* filename, uint64_t* out) { |
| 462 | char f_data[18] = {0}; | 462 | char f_data[18] = {0}; |
| 463 | size_t ret; | ||
| 463 | int fd = open(filename, O_RDONLY); | 464 | int fd = open(filename, O_RDONLY); |
| 464 | if (fd == -1) | 465 | if (fd == -1) |
| 465 | return errno; | 466 | return errno; |
| 466 | read(fd, f_data, 18); | 467 | ret = read(fd, f_data, 18); |
| 468 | if (ret == -1) | ||
| 469 | return errno; | ||
| 467 | close(fd); | 470 | close(fd); |
| 468 | *out = strtoll(f_data, NULL, 16); | 471 | *out = strtoll(f_data, NULL, 16); |
| 469 | return 0; | 472 | return 0; |
| 470 | } | 473 | } |
| 471 | 474 | ||
| 472 | // We support up to 12 GPCs per GPU, and up to 16 GPUs. | 475 | // We support up to 64 TPCs, up to 12 GPCs per GPU, and up to 16 GPUs. |
| 476 | // TODO: Handle GPUs with greater than 64 TPCs (e.g. some H100 variants) | ||
| 473 | static uint64_t tpc_mask_per_gpc_per_dev[16][12]; | 477 | static uint64_t tpc_mask_per_gpc_per_dev[16][12]; |
| 474 | // Output mask is vtpc-indexed (virtual TPC) | 478 | // Output mask is vtpc-indexed (virtual TPC) |
| 475 | int libsmctrl_get_gpc_info(uint32_t* num_enabled_gpcs, uint64_t** tpcs_for_gpc, int dev) { | 479 | int libsmctrl_get_gpc_info(uint32_t* num_enabled_gpcs, uint64_t** tpcs_for_gpc, int dev) { |
