PAPI 7.1.0.0
Loading...
Searching...
No Matches
benchSANVML.c
Go to the documentation of this file.
1//-----------------------------------------------------------------------------
2//-----------------------------------------------------------------------------
3// This bench interacts directly with NVML from a main(). The objective here is
4// to test reading and setting of a power limit without PAPI, to determine if
5// errors are PAPI related or not. It can be modified to test other NVML
6// events.
7//
8// Much of this code is scavenged from linux-nvml.c.
9// Author: Tony Castaldo (tonycastaldo@icl.utk.edu).
10//-----------------------------------------------------------------------------
11//-----------------------------------------------------------------------------
12
13#include <unistd.h>
14#include <errno.h>
15#include <dirent.h>
16#include <fcntl.h>
17#include <stdio.h>
18#include <string.h>
19#include <stdlib.h>
20#include <limits.h>
21#include <ctype.h>
22#include <math.h>
23#include <sys/time.h>
24#include <dlfcn.h> // Dynamic lib routines; especially dlsym to get func ptrs.
25
26#include "nvml.h"
27#include "cuda.h"
28#include "cuda_runtime_api.h"
29
30/***** CHANGE PROTOTYPES TO DECLARE CUDA AND NVML LIBRARY SYMBOLS AS WEAK *****
31 * This is done so that a version of PAPI built with the nvml component can *
32 * be installed on a system which does not have the cuda libraries installed. *
33 * *
34 * If this is done without these prototypes, then all papi services on the *
35 * system without the cuda libraries installed will fail. The PAPI libraries *
36 * contain references to the cuda libraries which are not installed. The *
37 * load of PAPI commands fails because the cuda library references can not be *
38 * resolved. *
39 * *
40 * This also defines pointers to the cuda library functions that we call. *
41 * These function pointers will be resolved with dlopen/dlsym calls at *
42 * component initialization time. The component then calls the cuda library *
43 * functions through these function pointers. *
44 ********************************************************************************/
45#undef CUDAAPI
46#define CUDAAPI __attribute__((weak))
47CUresult CUDAAPI (*cuInitPtr)(unsigned int);
48CUresult CUDAAPI cuInit(unsigned int myInt) {return (*cuInitPtr)(myInt);}
49
50#undef CUDARTAPI
51#define CUDARTAPI __attribute__((weak))
52
53cudaError_t (*cudaGetDevicePtr)(int *);
54cudaError_t (*cudaGetDeviceCountPtr)(int *);
55cudaError_t (*cudaDeviceGetPCIBusIdPtr)(char *, int, int);
56
57cudaError_t CUDARTAPI cudaGetDevice(int *dest) {return (*cudaGetDevicePtr)(dest); };
58cudaError_t CUDARTAPI cudaGetDeviceCount(int *dest) {return (*cudaGetDeviceCountPtr)(dest);}
59cudaError_t CUDARTAPI cudaDeviceGetPCIBusId(char *, int, int);
60
61#undef DECLDIR
62#define DECLDIR __attribute__((weak))
63
64char* (*nvmlErrorStringPtr)(nvmlReturn_t);
65nvmlReturn_t (*nvmlDeviceGetClockInfoPtr)(nvmlDevice_t, nvmlClockType_t, unsigned int *);
66nvmlReturn_t (*nvmlDeviceGetCountPtr)(unsigned int *dest);
67nvmlReturn_t (*nvmlDeviceGetDetailedEccErrorsPtr)(nvmlDevice_t, nvmlEccBitType_t, nvmlEccCounterType_t, nvmlEccErrorCounts_t *);
68nvmlReturn_t (*nvmlDeviceGetEccModePtr)(nvmlDevice_t, nvmlEnableState_t *, nvmlEnableState_t *);
69nvmlReturn_t (*nvmlDeviceGetFanSpeedPtr)(nvmlDevice_t, unsigned int *);
70nvmlReturn_t (*nvmlDeviceGetHandleByIndexPtr)(unsigned int, nvmlDevice_t *);
71nvmlReturn_t (*nvmlDeviceGetInforomVersionPtr)(nvmlDevice_t, nvmlInforomObject_t, char *, unsigned int);
72nvmlReturn_t (*nvmlDeviceGetMemoryInfoPtr)(nvmlDevice_t, nvmlMemory_t *);
73nvmlReturn_t (*nvmlDeviceGetNamePtr)(nvmlDevice_t, char *, unsigned int);
74nvmlReturn_t (*nvmlDeviceGetPciInfoPtr)(nvmlDevice_t, nvmlPciInfo_t *);
75nvmlReturn_t (*nvmlDeviceGetPerformanceStatePtr)(nvmlDevice_t, nvmlPstates_t *);
76nvmlReturn_t (*nvmlDeviceGetPowerManagementLimitConstraintsPtr)(nvmlDevice_t device, unsigned int* minLimit, unsigned int* maxLimit);
77nvmlReturn_t (*nvmlDeviceGetPowerManagementLimitPtr)(nvmlDevice_t device, unsigned int* limit);
78nvmlReturn_t (*nvmlDeviceGetPowerUsagePtr)(nvmlDevice_t, unsigned int *);
79nvmlReturn_t (*nvmlDeviceGetTemperaturePtr)(nvmlDevice_t, nvmlTemperatureSensors_t, unsigned int *);
80nvmlReturn_t (*nvmlDeviceGetTotalEccErrorsPtr)(nvmlDevice_t, nvmlEccBitType_t, nvmlEccCounterType_t, unsigned long long *);
81nvmlReturn_t (*nvmlDeviceGetUtilizationRatesPtr)(nvmlDevice_t, nvmlUtilization_t *);
82nvmlReturn_t (*nvmlDeviceSetPowerManagementLimitPtr)(nvmlDevice_t device, unsigned int limit);
83nvmlReturn_t (*nvmlInitPtr)(void);
84nvmlReturn_t (*nvmlShutdownPtr)(void);
85
86const char* DECLDIR nvmlErrorString(nvmlReturn_t);
87nvmlReturn_t DECLDIR nvmlDeviceGetClockInfo(nvmlDevice_t, nvmlClockType_t, unsigned int *);
88nvmlReturn_t DECLDIR nvmlDeviceGetCount(unsigned int *dest){return (*nvmlDeviceGetCountPtr)(dest);}
89nvmlReturn_t DECLDIR nvmlDeviceGetDetailedEccErrors(nvmlDevice_t, nvmlEccBitType_t, nvmlEccCounterType_t, nvmlEccErrorCounts_t *);
90nvmlReturn_t DECLDIR nvmlDeviceGetEccMode(nvmlDevice_t, nvmlEnableState_t *, nvmlEnableState_t *);
91nvmlReturn_t DECLDIR nvmlDeviceGetFanSpeed(nvmlDevice_t, unsigned int *);
92nvmlReturn_t DECLDIR nvmlDeviceGetHandleByIndex(unsigned int idx, nvmlDevice_t *dest) {return (*nvmlDeviceGetHandleByIndexPtr)(idx, dest); }
93nvmlReturn_t DECLDIR nvmlDeviceGetInforomVersion(nvmlDevice_t, nvmlInforomObject_t, char *, unsigned int);
94nvmlReturn_t DECLDIR nvmlDeviceGetMemoryInfo(nvmlDevice_t, nvmlMemory_t *);
95nvmlReturn_t DECLDIR nvmlDeviceGetName(nvmlDevice_t device, char *name, unsigned int len) {(*nvmlDeviceGetNamePtr)(device, name, len); }
96nvmlReturn_t DECLDIR nvmlDeviceGetPciInfo(nvmlDevice_t, nvmlPciInfo_t *);
97nvmlReturn_t DECLDIR nvmlDeviceGetPerformanceState(nvmlDevice_t, nvmlPstates_t *);
98nvmlReturn_t DECLDIR nvmlDeviceGetPowerManagementLimit(nvmlDevice_t device, unsigned int* limit) {
99 (*nvmlDeviceGetPowerManagementLimitPtr)(device, limit); }
100nvmlReturn_t DECLDIR nvmlDeviceGetPowerManagementLimitConstraints(nvmlDevice_t device, unsigned int* minLimit, unsigned int* maxLimit) {
101 (*nvmlDeviceGetPowerManagementLimitConstraintsPtr)(device, minLimit, maxLimit); }
102nvmlReturn_t DECLDIR nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int *dest) {
103 (*nvmlDeviceGetPowerUsagePtr)(device, dest); }
104nvmlReturn_t DECLDIR nvmlDeviceGetTemperature(nvmlDevice_t, nvmlTemperatureSensors_t, unsigned int *);
105nvmlReturn_t DECLDIR nvmlDeviceGetTotalEccErrors(nvmlDevice_t, nvmlEccBitType_t, nvmlEccCounterType_t, unsigned long long *);
106nvmlReturn_t DECLDIR nvmlDeviceGetUtilizationRates(nvmlDevice_t, nvmlUtilization_t *);
107nvmlReturn_t DECLDIR nvmlDeviceSetPowerManagementLimit(nvmlDevice_t device, unsigned int limit) {
108 (*nvmlDeviceSetPowerManagementLimitPtr)(device, limit); }
109nvmlReturn_t DECLDIR nvmlInit(void){return (*nvmlInitPtr)();}
110nvmlReturn_t DECLDIR nvmlShutdown(void);
111
112// file handles used to access cuda libraries with dlopen
113static void* dl1 = NULL;
114static void* dl2 = NULL;
115static void* dl3 = NULL;
116
117static struct timeval t1, t2; // used in timing routines to measure performance.
118
119//-----------------------------------------------------------------------------
120// Union to convert pointers and avoid warnings. Plug in one, pull out the other.
121//-----------------------------------------------------------------------------
122typedef union
123{
124 void *vPtr;
125 int *iPtr;
126 unsigned int *uiPtr;
127 long *lPtr;
128 long long *llPtr;
129 unsigned long long *ullPtr;
130 float *fPtr;
131 double *dPtr;
132 char *cPtr;
133} uPointer_t;
134
135typedef union
136{
137 long long ll;
138 unsigned long long ull;
139 double d;
140 void *vp;
141 unsigned char ch[8];
143
144
145// -------------------------- GLOBAL SECTION ---------------------------------
146
147//--------------------------------------------------------------------
148// Timing of routines and blocks. Typical usage;
149// gettimeofday(&t1, NULL); // starting point.
150// ... some code to execute ...
151// gettimeofday(&t2, NULL); // finished timing.
152// fprintf(stderr, "routine took %li uS.\n", // report time.
153// (mConvertUsec(t2)-mConvertUsec(t1)));
154#define _prog_fprintf if (1) fprintf /* change to 1 to enable printing of progress debug messages. TURN OFF if benchmark timing. */
155#define _time_fprintf if (1) fprintf /* change to 1 to enable printing of performance timings. TURN OFF if benchmark timing. */
156
157//-----------------------------------------------------------------------------
158// Using weak symbols (global declared without a value, so it defers to any
159// other global declared in another file WITH a value) allows PAPI to be built
160// with the component, but PAPI can still be installed in a system without the
161// required library.
162//-----------------------------------------------------------------------------
163
164void (*_dl_non_dynamic_init)(void) __attribute__((weak)); // declare a weak dynamic-library init routine pointer.
165
167static int device_count = 0;
168
169static nvmlDevice_t* devices = NULL;
170static int* features = NULL;
171static unsigned int *power_management_initial_limit = NULL;
172static unsigned int *power_management_limit_constraint_min = NULL;
173static unsigned int *power_management_limit_constraint_max = NULL;
174
175//-----------------------------------------------------------------------------
176// Get all needed function pointers from the Dynamic Link Library.
177//-----------------------------------------------------------------------------
178
179// MACRO checks for Dynamic Lib failure, reports, returns Not Supported.
180#define mCheck_DL_Status( err, str ) \
181 if( err ) \
182 { \
183 fprintf(stderr, str); \
184 return(-1); \
185 }
186
187// keys for above: Init, InitThrd, InitCtlSt, Stop, ShutdownThrd, ShutdownCmp, Start,
188// UpdateCtl, Read, Ctl, SetDom, Reset, Enum, EnumFirst, EnumNext, EnumUmasks,
189// NameToCode, CodeToName, CodeToDesc, CodeToInfo.
190
191// Simplify routine below; relies on ptr names being same as func tags.
192#define STRINGIFY(x) #x
193#define TOSTRING(x) STRINGIFY(x)
194#define mGet_DL_FPtr(libPtr, Name) \
195 Name##Ptr = dlsym(libPtr, TOSTRING(Name)); \
196 mCheck_DL_Status(dlerror()!=NULL, TOSTRING(libPtr) " Library function " \
197 TOSTRING(Name) " not found.");
198
200{
201 if (_dl_non_dynamic_init != NULL) { // If weak var is present, we are statically linked instead of dynamically.
202 fprintf(stderr, "NVML component does not support statically linked libc.");
203 return (-1);
204 }
205
206 // Exit if we cannot link the cuda or NVML libs.
207 dl1 = dlopen("libcuda.so", RTLD_NOW | RTLD_GLOBAL);
208 if (!dl1) {
209 fprintf(stderr, "CUDA library libcuda.so not found.");
210 return (-1);
211 }
212
213 dl2 = dlopen("libcudart.so", RTLD_NOW | RTLD_GLOBAL | RTLD_NODELETE);
214 if (!dl2) {
215 fprintf(stderr, "CUDA runtime library libcudart.so not found.");
216 return (-1);
217 }
218
219 dl3 = dlopen("libnvidia-ml.so", RTLD_NOW | RTLD_GLOBAL);
220 if (!dl3) {
221 fprintf(stderr, "NVML runtime library libnvidia-ml.so not found.");
222 return (-1);
223 }
224
225//-----------------------------------------------------------------------------
226// Collect pointers for routines in shared library. All below will abort this
227// routine with -1, the routine is not found in the dynamic library.
228//-----------------------------------------------------------------------------
229
230//-----------------------------------------------------------------------------
231// Collect pointers for routines in shared library. All below will abort this
232// routine with -1, the routine is not found in the dynamic library.
233//-----------------------------------------------------------------------------
234
236
240
262
263 return 0; // If we get here, all above succeeded.
264} // end routine.
265
266//----------------------------------------------------------------------------
267// main(). intialize the lib, then work on reading the value.
268//---------------------------------------------------------------------------
269int main (int argc, char **argv)
270{
271 (void) argc; (void) argv; // Prevent not used warning.
272 #define hostnameLen 512 /* constant used multiple times. */
273 char hostname[hostnameLen]; // host name.
274 int i, j, ret;
275 int cuda_count, nvml_count;
276 nvmlReturn_t nvret;
277 cudaError_t cuerr;
278
279 //-------------------------------------------------------------------
280 // Begin initialization timing.
281 //-------------------------------------------------------------------
282
283 gettimeofday(&t1, NULL);
285 if ( ret != 0) { // Failure to get lib.
286 fprintf(stderr, "Failed attempt to link to CUDA and NVML libraries.");
287 exit(-1);
288 }
289
290 _prog_fprintf(stderr, "Linked to CUDA and NVML libraries\n"); // debug only; turn off if timing.
291
292 nvret = nvmlInit(); // Initialize the library.
293 if (nvret != NVML_SUCCESS) {
294 fprintf(stderr, "Failed nvmlInit(), ret=%i [%s].\n", nvret, nvmlErrorString(nvret));
295 exit(-1);
296 }
297
298 nvret = cuInit(0); // Initialize the CUDA library.
299 if (nvret != cudaSuccess) {
300 fprintf(stderr, "Failed cuInit(0).\n");
301 exit(-1);
302 }
303
304 nvret = nvmlDeviceGetCount(&nvml_count); // Get the device count.
305 if (nvret != NVML_SUCCESS) {
306 fprintf(stderr, "nvmlDeviceGetCount failed; ret=%i.\n", nvret); // Report an error.
307 exit(-1);
308 }
309
310 nvret = cudaGetDeviceCount(&cuda_count); // Get the device count.
311 if (nvret != cudaSuccess) {
312 fprintf(stderr, "cudaGetDeviceCount failed; ret=%i.\n", nvret); // Report an error.
313 exit(-1);
314 }
315
316
317 ret = gethostname(hostname, hostnameLen); // Try to get the host hame.
318 if( gethostname(hostname, hostnameLen) != 0) { // If we can't get the hostname,
319 fprintf(stderr, "Failed system call, gethostname() "
320 "returned %i.", ret);
321 exit(-1);
322 }
323 #undef hostnameLen /* done with it. */
324
325 fprintf(stderr, "hostname: %s\n"
326 "nvml_count=%i\n"
327 "cuda_count=%i\n", hostname, nvml_count, cuda_count);
328
329 nvmlDevice_t *handle = malloc(nvml_count * sizeof(nvmlDevice_t)); // for all device handles.
330 char name[128]; // space for device name.
331 unsigned int powerUsage, powerLimit, powerLimit2; // for the power usage and limit.
332 unsigned int minPower, maxPower; // Minimum and Maximum power.
333
334 // scan all the devices.
335 for (i=0; i<nvml_count; i++) { // Get all the handles; print as we go.
336 nvret = nvmlDeviceGetHandleByIndex(i, &handle[i]); // Read the handle.
337 if (nvret != NVML_SUCCESS) {
338 fprintf(stderr, "nvmlDeviceGetHandleByIndex %i failed; nvret=%i [%s].\n", i, nvret, nvmlErrorString(nvret));
339 handle[i]=NULL; // Set to bad value.
340 continue; // skip trying this one.
341 }
342
343 fprintf(stderr, "Handle %i: %016lX\n", i, handle[i]); // Show the handles.
344
345 nvret = nvmlDeviceGetName(handle[i], name, sizeof(name)-1); // Get the name.
346 name[sizeof(name)-1]='\0'; // Ensure z-termination.
347 fprintf(stderr, "Name='%s'.\n", name); // Show the name.
348
349 nvret = nvmlDeviceGetPowerUsage(handle[i], &powerUsage); // Attempt to get power usage.
350 if (nvret != NVML_SUCCESS) { // If it failed,
351 fprintf(stderr, "nvmlDeviceGetPowerUsage failed; nvret=%i [%s]\n", nvret, nvmlErrorString(nvret));
352 } else {
353 fprintf(stderr, "nvmlDeviceGetPowerUsage succeeded, value returned=%u mw.\n", powerUsage);
354 }
355
356 nvret = nvmlDeviceGetPowerManagementLimit(handle[i], &powerLimit);// Attempt to get power limit.
357 if (nvret != NVML_SUCCESS) { // If it failed,
358 fprintf(stderr, "nvmlDeviceGetPowerManagementLimit failed; nvret=%i [%s]\n", nvret, nvmlErrorString(nvret));
359 } else {
360 fprintf(stderr, "nvmlDeviceGetPowerManagementLimit succeeded, value returned=%u mw.\n", powerLimit);
361 }
362
363 nvret = nvmlDeviceGetPowerManagementLimitConstraints(handle[i], &minPower, &maxPower);// Attempt to get min and max of power limit.
364 if (nvret != NVML_SUCCESS) { // If it failed,
365 fprintf(stderr, "nvmlDeviceGetPowerManagementLimitConstraints failed; nvret=%i [%s]\n", nvret, nvmlErrorString(nvret));
366 } else {
367 fprintf(stderr, "nvmlDeviceGetPowerManagementLimitConstraints succeeded, values min=%u mw, max=%u mw.\n", minPower, maxPower);
368 }
369
370 // Test setting the power, to top-100.
371 unsigned int newPower=maxPower-100; // compute a new power setting.
372 nvret = nvmlDeviceSetPowerManagementLimit(handle[i], newPower); // Attempt to set it.
373 if (nvret != NVML_SUCCESS) { // If it failed,
374 fprintf(stderr, "nvmlDeviceSetPowerManagementLimit to %i failed; nvret=%i [%s]\n", newPower, nvret, nvmlErrorString(nvret));
375 } else {
376 fprintf(stderr, "nvmlDeviceSetPowerManagementLimit to %i succeeded. (Routine call did not return error).\n", newPower);
377 }
378
379 nvret = nvmlDeviceGetPowerManagementLimit(handle[i], &powerLimit2); // Attempt to get new power limit.
380 if (nvret != NVML_SUCCESS) { // If it failed,
381 fprintf(stderr, "nvmlDeviceGetPowerManagementLimit failed; nvret=%i [%s]\n", nvret, nvmlErrorString(nvret));
382 } else {
383 fprintf(stderr, "nvmlDeviceGetPowerManagementLimit call to check setting succeeded, value returned=%u mw.\n", powerLimit2);
384 if (powerLimit2 != newPower) {
385 fprintf(stderr, "Note the check failed, the limit read is not the limit we tried to set.\n");
386 } else {
387 fprintf(stderr, "Note the check is a success, the power limit was changed.\n");
388 }
389 }
390
391 nvret = nvmlDeviceSetPowerManagementLimit(handle[i], powerLimit); // In case it works, set it back to where we found it.
392 if (nvret != NVML_SUCCESS) { // If it failed,
393 fprintf(stderr, "nvmlDeviceSetPowerManagementLimit to restore %i failed; nvret=%i [%s]\n", powerLimit, nvret, nvmlErrorString(nvret));
394 } else {
395 fprintf(stderr, "nvmlDeviceSetPowerManagementLimit to restore %i succeeded.\n", powerLimit);
396 }
397
398
399
400
401
402
403 } // end of loop through devices.
404
405
406
407
408 //-------------------------------------------------------------------
409 // Cleanup, and shutdown.
410 //-------------------------------------------------------------------
411
412 return 0;
413} // end MAIN routine.
414
415
static papi_handle_t handle
Definition: Gamum.c:21
int i
nvmlReturn_t DECLDIR nvmlDeviceGetPowerUsage(nvmlDevice_t device, unsigned int *dest)
Definition: benchSANVML.c:102
nvmlReturn_t(* nvmlDeviceGetCountPtr)(unsigned int *dest)
Definition: benchSANVML.c:66
cudaError_t CUDARTAPI cudaGetDevice(int *dest)
Definition: benchSANVML.c:57
nvmlReturn_t(* nvmlShutdownPtr)(void)
Definition: benchSANVML.c:84
nvmlReturn_t(* nvmlDeviceGetMemoryInfoPtr)(nvmlDevice_t, nvmlMemory_t *)
Definition: benchSANVML.c:72
nvmlReturn_t DECLDIR nvmlDeviceGetTotalEccErrors(nvmlDevice_t, nvmlEccBitType_t, nvmlEccCounterType_t, unsigned long long *)
nvmlReturn_t(* nvmlDeviceGetEccModePtr)(nvmlDevice_t, nvmlEnableState_t *, nvmlEnableState_t *)
Definition: benchSANVML.c:68
const char *DECLDIR nvmlErrorString(nvmlReturn_t)
nvmlReturn_t DECLDIR nvmlDeviceGetInforomVersion(nvmlDevice_t, nvmlInforomObject_t, char *, unsigned int)
CUresult CUDAAPI cuInit(unsigned int myInt)
Definition: benchSANVML.c:48
cudaError_t CUDARTAPI cudaGetDeviceCount(int *dest)
Definition: benchSANVML.c:58
nvmlReturn_t(* nvmlInitPtr)(void)
Definition: benchSANVML.c:83
nvmlReturn_t(* nvmlDeviceGetTotalEccErrorsPtr)(nvmlDevice_t, nvmlEccBitType_t, nvmlEccCounterType_t, unsigned long long *)
Definition: benchSANVML.c:80
nvmlReturn_t DECLDIR nvmlDeviceGetHandleByIndex(unsigned int idx, nvmlDevice_t *dest)
Definition: benchSANVML.c:92
nvmlReturn_t(* nvmlDeviceGetNamePtr)(nvmlDevice_t, char *, unsigned int)
Definition: benchSANVML.c:73
nvmlReturn_t DECLDIR nvmlDeviceGetPowerManagementLimitConstraints(nvmlDevice_t device, unsigned int *minLimit, unsigned int *maxLimit)
Definition: benchSANVML.c:100
#define CUDARTAPI
Definition: benchSANVML.c:51
nvmlReturn_t DECLDIR nvmlDeviceGetClockInfo(nvmlDevice_t, nvmlClockType_t, unsigned int *)
nvmlReturn_t DECLDIR nvmlDeviceGetName(nvmlDevice_t device, char *name, unsigned int len)
Definition: benchSANVML.c:95
nvmlReturn_t(* nvmlDeviceGetUtilizationRatesPtr)(nvmlDevice_t, nvmlUtilization_t *)
Definition: benchSANVML.c:81
nvmlReturn_t DECLDIR nvmlDeviceGetFanSpeed(nvmlDevice_t, unsigned int *)
nvmlReturn_t(* nvmlDeviceGetFanSpeedPtr)(nvmlDevice_t, unsigned int *)
Definition: benchSANVML.c:69
nvmlReturn_t DECLDIR nvmlDeviceGetPerformanceState(nvmlDevice_t, nvmlPstates_t *)
static void * dl3
Definition: benchSANVML.c:115
nvmlReturn_t DECLDIR nvmlDeviceGetMemoryInfo(nvmlDevice_t, nvmlMemory_t *)
nvmlReturn_t(* nvmlDeviceGetClockInfoPtr)(nvmlDevice_t, nvmlClockType_t, unsigned int *)
Definition: benchSANVML.c:65
cudaError_t CUDARTAPI cudaDeviceGetPCIBusId(char *, int, int)
#define _prog_fprintf
Definition: benchSANVML.c:154
cudaError_t(* cudaDeviceGetPCIBusIdPtr)(char *, int, int)
Definition: benchSANVML.c:55
#define DECLDIR
Definition: benchSANVML.c:62
nvmlReturn_t(* nvmlDeviceGetPowerUsagePtr)(nvmlDevice_t, unsigned int *)
Definition: benchSANVML.c:78
nvmlReturn_t(* nvmlDeviceGetPciInfoPtr)(nvmlDevice_t, nvmlPciInfo_t *)
Definition: benchSANVML.c:74
static void * dl2
Definition: benchSANVML.c:114
static void * dl1
Definition: benchSANVML.c:113
nvmlReturn_t DECLDIR nvmlDeviceGetPciInfo(nvmlDevice_t, nvmlPciInfo_t *)
nvmlReturn_t(* nvmlDeviceGetHandleByIndexPtr)(unsigned int, nvmlDevice_t *)
Definition: benchSANVML.c:70
cudaError_t(* cudaGetDeviceCountPtr)(int *)
Definition: benchSANVML.c:54
nvmlReturn_t DECLDIR nvmlDeviceGetUtilizationRates(nvmlDevice_t, nvmlUtilization_t *)
nvmlReturn_t DECLDIR nvmlDeviceGetCount(unsigned int *dest)
Definition: benchSANVML.c:88
nvmlReturn_t(* nvmlDeviceSetPowerManagementLimitPtr)(nvmlDevice_t device, unsigned int limit)
Definition: benchSANVML.c:82
#define hostnameLen
nvmlReturn_t DECLDIR nvmlShutdown(void)
nvmlReturn_t DECLDIR nvmlDeviceGetDetailedEccErrors(nvmlDevice_t, nvmlEccBitType_t, nvmlEccCounterType_t, nvmlEccErrorCounts_t *)
nvmlReturn_t DECLDIR nvmlDeviceSetPowerManagementLimit(nvmlDevice_t device, unsigned int limit)
Definition: benchSANVML.c:107
nvmlReturn_t(* nvmlDeviceGetInforomVersionPtr)(nvmlDevice_t, nvmlInforomObject_t, char *, unsigned int)
Definition: benchSANVML.c:71
nvmlReturn_t(* nvmlDeviceGetPerformanceStatePtr)(nvmlDevice_t, nvmlPstates_t *)
Definition: benchSANVML.c:75
#define CUDAAPI
Definition: benchSANVML.c:46
nvmlReturn_t DECLDIR nvmlDeviceGetEccMode(nvmlDevice_t, nvmlEnableState_t *, nvmlEnableState_t *)
void(* _dl_non_dynamic_init)(void)
Definition: benchSANVML.c:164
static struct timeval t1 t2
Definition: benchSANVML.c:117
nvmlReturn_t(* nvmlDeviceGetPowerManagementLimitPtr)(nvmlDevice_t device, unsigned int *limit)
Definition: benchSANVML.c:77
nvmlReturn_t(* nvmlDeviceGetDetailedEccErrorsPtr)(nvmlDevice_t, nvmlEccBitType_t, nvmlEccCounterType_t, nvmlEccErrorCounts_t *)
Definition: benchSANVML.c:67
cudaError_t(* cudaGetDevicePtr)(int *)
Definition: benchSANVML.c:53
nvmlReturn_t(* nvmlDeviceGetTemperaturePtr)(nvmlDevice_t, nvmlTemperatureSensors_t, unsigned int *)
Definition: benchSANVML.c:79
nvmlReturn_t DECLDIR nvmlInit(void)
Definition: benchSANVML.c:109
#define mGet_DL_FPtr(libPtr, Name)
nvmlReturn_t(* nvmlDeviceGetPowerManagementLimitConstraintsPtr)(nvmlDevice_t device, unsigned int *minLimit, unsigned int *maxLimit)
Definition: benchSANVML.c:76
CUresult CUDAAPI(* cuInitPtr)(unsigned int)
Definition: benchSANVML.c:47
nvmlReturn_t DECLDIR nvmlDeviceGetPowerManagementLimit(nvmlDevice_t device, unsigned int *limit)
Definition: benchSANVML.c:98
nvmlReturn_t DECLDIR nvmlDeviceGetTemperature(nvmlDevice_t, nvmlTemperatureSensors_t, unsigned int *)
volatile double t1
static int _local_linkDynamicLibraries()
Definition: linux-libmsr.c:157
static int * features
Definition: linux-nvml.c:147
static unsigned int * power_management_initial_limit
Definition: linux-nvml.c:148
static int device_count
Definition: linux-nvml.c:141
static nvmlDevice_t * devices
Definition: linux-nvml.c:146
static unsigned int * power_management_limit_constraint_min
Definition: linux-nvml.c:149
static unsigned int * power_management_limit_constraint_max
Definition: linux-nvml.c:150
unsigned long AO_t __attribute__((__aligned__(4)))
Definition: m68k.h:21
FILE * stderr
int main()
Definition: pernode.c:20
const char * name
Definition: rocs.c:225
int
Definition: sde_internal.h:89
unsigned long long ull
Definition: benchSANVML.c:138
long long ll
Definition: benchSANVML.c:137
unsigned long long * ullPtr
Definition: benchSANVML.c:129
long * lPtr
Definition: benchSANVML.c:127
void * vPtr
Definition: benchSANVML.c:124
char * cPtr
Definition: benchSANVML.c:132
int * iPtr
Definition: benchSANVML.c:125
float * fPtr
Definition: benchSANVML.c:130
double * dPtr
Definition: benchSANVML.c:131
long long * llPtr
Definition: benchSANVML.c:128
unsigned int * uiPtr
Definition: benchSANVML.c:126