@@ -431,6 +431,47 @@ nvmlReturn_t call_device_arg_value(int op, nvmlDevice_t device, Arg arg,
431431 return result;
432432}
433433
434+ template <typename A, typename B, typename Out>
435+ nvmlReturn_t call_device_two_args_value (int op, nvmlDevice_t device, A first,
436+ B second, Out *value) {
437+ conn_t *c = connection_for_device (&device);
438+ nvmlReturn_t result = rpc_error ();
439+ Out temp = {};
440+ if (c == nullptr || rpc_write_start_request (c, op) < 0 ||
441+ rpc_write (c, &device, sizeof (device)) < 0 ||
442+ rpc_write (c, &first, sizeof (first)) < 0 ||
443+ rpc_write (c, &second, sizeof (second)) < 0 ||
444+ rpc_wait_for_response (c) < 0 || rpc_read (c, &temp, sizeof (temp)) < 0 ||
445+ rpc_read (c, &result, sizeof (result)) < 0 || rpc_read_end (c) < 0 ) {
446+ return rpc_error ();
447+ }
448+ if (value != nullptr ) {
449+ *value = temp;
450+ }
451+ return result;
452+ }
453+
454+ template <typename A, typename B, typename C, typename Out>
455+ nvmlReturn_t call_device_three_args_value (int op, nvmlDevice_t device, A first,
456+ B second, C third, Out *value) {
457+ conn_t *c = connection_for_device (&device);
458+ nvmlReturn_t result = rpc_error ();
459+ Out temp = {};
460+ if (c == nullptr || rpc_write_start_request (c, op) < 0 ||
461+ rpc_write (c, &device, sizeof (device)) < 0 ||
462+ rpc_write (c, &first, sizeof (first)) < 0 ||
463+ rpc_write (c, &second, sizeof (second)) < 0 ||
464+ rpc_write (c, &third, sizeof (third)) < 0 || rpc_wait_for_response (c) < 0 ||
465+ rpc_read (c, &temp, sizeof (temp)) < 0 ||
466+ rpc_read (c, &result, sizeof (result)) < 0 || rpc_read_end (c) < 0 ) {
467+ return rpc_error ();
468+ }
469+ if (value != nullptr ) {
470+ *value = temp;
471+ }
472+ return result;
473+ }
474+
434475nvmlReturn_t call_processes (int op, nvmlDevice_t device,
435476 unsigned int *infoCount, nvmlProcessInfo_t *infos) {
436477 conn_t *c = connection_for_device (&device);
@@ -1018,6 +1059,29 @@ extern "C" nvmlReturn_t nvmlDeviceGetMaxMigDeviceCount(nvmlDevice_t device,
10181059 return call_device_value (RPC_nvmlDeviceGetMaxMigDeviceCount, device, count);
10191060}
10201061
1062+ extern " C" nvmlReturn_t nvmlDeviceGetTotalEccErrors (
1063+ nvmlDevice_t device, nvmlMemoryErrorType_t errorType,
1064+ nvmlEccCounterType_t counterType, unsigned long long *eccCounts) {
1065+ return call_device_two_args_value (RPC_nvmlDeviceGetTotalEccErrors, device,
1066+ errorType, counterType, eccCounts);
1067+ }
1068+
1069+ extern " C" nvmlReturn_t nvmlDeviceGetDetailedEccErrors (
1070+ nvmlDevice_t device, nvmlMemoryErrorType_t errorType,
1071+ nvmlEccCounterType_t counterType, nvmlEccErrorCounts_t *eccCounts) {
1072+ return call_device_two_args_value (RPC_nvmlDeviceGetDetailedEccErrors, device,
1073+ errorType, counterType, eccCounts);
1074+ }
1075+
1076+ extern " C" nvmlReturn_t nvmlDeviceGetMemoryErrorCounter (
1077+ nvmlDevice_t device, nvmlMemoryErrorType_t errorType,
1078+ nvmlEccCounterType_t counterType, nvmlMemoryLocation_t locationType,
1079+ unsigned long long *count) {
1080+ return call_device_three_args_value (RPC_nvmlDeviceGetMemoryErrorCounter,
1081+ device, errorType, counterType,
1082+ locationType, count);
1083+ }
1084+
10211085extern " C" nvmlReturn_t nvmlDeviceGetEccMode (nvmlDevice_t device,
10221086 nvmlEnableState_t *current,
10231087 nvmlEnableState_t *pending) {
0 commit comments