Main Page Namespace List Class Hierarchy Alphabetical List Compound List File List Namespace Members Compound Members File Members Related Pages

CUDAWrapNVML.cu File Reference

Runtime loader and wrapper for the NVIDIA NVML GPU management library. More...

#include <stdio.h>
#include <stdlib.h>
#include "CUDAWrapNVML.h"
#include "cuda_runtime.h"
#include <dlfcn.h>

Go to the source code of this file.


Functions

void * wrap_dlopen (const char *filename)
void * wrap_dlsym (void *h, const char *sym)
int wrap_dlclose (void *h)
wrap_nvml_handle * wrap_nvml_create ()
int wrap_nvml_destroy (wrap_nvml_handle *nvmlh)
int wrap_nvml_get_gpucount (wrap_nvml_handle *nvmlh, int *gpucount)
int wrap_cuda_get_gpucount (wrap_nvml_handle *nvmlh, int *gpucount)
int wrap_nvml_get_gpu_name (wrap_nvml_handle *nvmlh, int cudaindex, char *namebuf, int bufsize)
int wrap_nvml_get_tempC (wrap_nvml_handle *nvmlh, int cudaindex, unsigned int *tempC)
int wrap_nvml_get_fanpcnt (wrap_nvml_handle *nvmlh, int cudaindex, unsigned int *fanpcnt)
int wrap_nvml_get_power_usage (wrap_nvml_handle *nvmlh, int cudaindex, unsigned int *milliwatts)
int wrap_nvml_get_cpu_affinity (wrap_nvml_handle *nvmlh, int cudaindex, unsigned int cpuSetSize, unsigned long *cpuSet)
int wrap_nvml_set_cpu_affinity (wrap_nvml_handle *nvmlh, int cudaindex)

Detailed Description

Runtime loader and wrapper for the NVIDIA NVML GPU management library.

A trivial little dlopen()-based wrapper library for the NVIDIA NVML library, to allow runtime discovery of NVML on an arbitrary system. This is all very hackish and simple-minded, but it serves my immediate needs in the short term until NVIDIA provides a static NVML wrapper library themselves, hopefully in CUDA 6.5 or maybe sometime shortly after.

Revision:
1.9
Date:
2020年06月25日 16:05:41

Author:
John E. Stone - john.stone@gmail.com \copyright This trivial code is made available under the "new" 3-clause BSD license, and/or any of the GPL licenses you prefer. Feel free to use the code and modify as you see fit.

Definition in file CUDAWrapNVML.cu.


Function Documentation

int wrap_cuda_get_gpucount ( wrap_nvml_handle * nvmlh,
int * gpucount
)

Definition at line 267 of file CUDAWrapNVML.cu.

References wrap_nvml_handle::cuda_gpucount.

int wrap_dlclose ( void * h ) [static]

Definition at line 50 of file CUDAWrapNVML.cu.

Referenced by wrap_nvml_create, and wrap_nvml_destroy.

void* wrap_dlopen ( const char * filename ) [static]

Definition at line 44 of file CUDAWrapNVML.cu.

Referenced by wrap_nvml_create.

void* wrap_dlsym ( void * h,
const char * sym
) [static]

Definition at line 47 of file CUDAWrapNVML.cu.

Referenced by wrap_nvml_create.

wrap_nvml_handle* wrap_nvml_create ( )

Definition at line 59 of file CUDAWrapNVML.cu.

References wrap_nvmlPciInfo_t::bus, wrap_nvml_handle::cuda_gpucount, wrap_nvml_handle::cuda_nvml_device_id, wrap_nvmlPciInfo_t::device, wrap_nvml_handle::devs, wrap_nvmlPciInfo_t::domain, NULL, wrap_nvml_handle::nvml_cuda_device_id, wrap_nvml_handle::nvml_dll, wrap_nvml_handle::nvml_gpucount, wrap_nvml_handle::nvml_pci_bus_id, wrap_nvml_handle::nvml_pci_device_id, wrap_nvml_handle::nvml_pci_domain_id, wrap_nvml_handle::nvmlDeviceGetCount, wrap_nvml_handle::nvmlDeviceGetCpuAffinity, wrap_nvml_handle::nvmlDeviceGetFanSpeed, wrap_nvml_handle::nvmlDeviceGetHandleByIndex, wrap_nvml_handle::nvmlDeviceGetName, wrap_nvml_handle::nvmlDeviceGetPciInfo, wrap_nvml_handle::nvmlDeviceGetPowerUsage, wrap_nvml_handle::nvmlDeviceGetTemperature, wrap_nvml_handle::nvmlDeviceSetCpuAffinity, wrap_nvml_handle::nvmlInit, wrap_nvml_handle::nvmlShutdown, wrap_dlclose, wrap_dlopen, wrap_dlsym, wrap_nvmlDevice_t, and wrap_nvmlReturn_t.

Referenced by CUDAAccel::CUDAAccel.

int wrap_nvml_destroy ( wrap_nvml_handle * nvmlh )

Definition at line 235 of file CUDAWrapNVML.cu.

References wrap_nvml_handle::cuda_nvml_device_id, wrap_nvml_handle::devs, NULL, wrap_nvml_handle::nvml_cuda_device_id, wrap_nvml_handle::nvml_dll, wrap_nvml_handle::nvml_pci_bus_id, wrap_nvml_handle::nvml_pci_device_id, wrap_nvml_handle::nvml_pci_domain_id, wrap_nvml_handle::nvmlShutdown, and wrap_dlclose.

int wrap_nvml_get_cpu_affinity ( wrap_nvml_handle * nvmlh,
int cudaindex,
unsigned int cpuSetSize,
unsigned long * cpuSet
)

Definition at line 333 of file CUDAWrapNVML.cu.

References wrap_nvml_handle::cuda_nvml_device_id, wrap_nvml_handle::devs, wrap_nvml_handle::nvml_gpucount, wrap_nvml_handle::nvmlDeviceGetCpuAffinity, and WRAPNVML_SUCCESS.

int wrap_nvml_get_fanpcnt ( wrap_nvml_handle * nvmlh,
int cudaindex,
unsigned int * fanpcnt
)

Definition at line 303 of file CUDAWrapNVML.cu.

References wrap_nvml_handle::cuda_nvml_device_id, wrap_nvml_handle::devs, wrap_nvml_handle::nvml_gpucount, wrap_nvml_handle::nvmlDeviceGetFanSpeed, wrap_nvmlReturn_t, and WRAPNVML_SUCCESS.

int wrap_nvml_get_gpu_name ( wrap_nvml_handle * nvmlh,
int cudaindex,
char * namebuf,
int bufsize
)

Definition at line 272 of file CUDAWrapNVML.cu.

References wrap_nvml_handle::cuda_nvml_device_id, wrap_nvml_handle::devs, wrap_nvml_handle::nvml_gpucount, wrap_nvml_handle::nvmlDeviceGetName, and WRAPNVML_SUCCESS.

int wrap_nvml_get_gpucount ( wrap_nvml_handle * nvmlh,
int * gpucount
)

Definition at line 262 of file CUDAWrapNVML.cu.

References wrap_nvml_handle::nvml_gpucount.

int wrap_nvml_get_power_usage ( wrap_nvml_handle * nvmlh,
int cudaindex,
unsigned int * milliwatts
)

Definition at line 319 of file CUDAWrapNVML.cu.

References wrap_nvml_handle::cuda_nvml_device_id, wrap_nvml_handle::devs, wrap_nvml_handle::nvml_gpucount, wrap_nvml_handle::nvmlDeviceGetPowerUsage, and WRAPNVML_SUCCESS.

int wrap_nvml_get_tempC ( wrap_nvml_handle * nvmlh,
int cudaindex,
unsigned int * tempC
)

Definition at line 287 of file CUDAWrapNVML.cu.

References wrap_nvml_handle::cuda_nvml_device_id, wrap_nvml_handle::devs, wrap_nvml_handle::nvml_gpucount, wrap_nvml_handle::nvmlDeviceGetTemperature, wrap_nvmlReturn_t, and WRAPNVML_SUCCESS.

int wrap_nvml_set_cpu_affinity ( wrap_nvml_handle * nvmlh,
int cudaindex
)

Definition at line 348 of file CUDAWrapNVML.cu.

References wrap_nvml_handle::cuda_nvml_device_id, wrap_nvml_handle::devs, wrap_nvml_handle::nvml_gpucount, wrap_nvml_handle::nvmlDeviceSetCpuAffinity, and WRAPNVML_SUCCESS.


Generated on Mon Nov 17 02:47:37 2025 for VMD (current) by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002

AltStyle によって変換されたページ (->オリジナル) /