https://github.com/jcbritobr/nvml-csharp
Nvml( nvidia monitoring library) wrapper for c#.
https://github.com/jcbritobr/nvml-csharp
csharp cuda gpu library monitoring nvidia nvml
Last synced: about 2 months ago
JSON representation
Nvml( nvidia monitoring library) wrapper for c#.
- Host: GitHub
- URL: https://github.com/jcbritobr/nvml-csharp
- Owner: jcbritobr
- License: mit
- Created: 2021-03-10T04:26:17.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2021-03-13T21:37:28.000Z (about 4 years ago)
- Last Synced: 2024-04-17T19:26:18.144Z (about 1 year ago)
- Topics: csharp, cuda, gpu, library, monitoring, nvidia, nvml
- Language: C#
- Homepage:
- Size: 1.36 MB
- Stars: 7
- Watchers: 1
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 
### The nvidia monitoring library wrapper written in c#. Please, read the [documentation](https://docs.nvidia.com/deploy/nvml-api/nvml-api-reference.html#nvml-api-reference) for better understand what is nvml.
* Example on how to get running processes list
```csharp
try
{
NvGpu.NvmlInitV2();
var device = IntPtr.Zero;
device = NvGpu.NvmlDeviceGetHandleByIndex(0);
var (list, count) = NvGpu.NvmlDeviceGetComputeRunningProcesses(device);
NvGpu.NvmlShutdown();
}
catch (Exception e)
{
Assert.Fail(e.ToString());
}
```* Example on how to retrieve gpu temperature
```csharp
try
{
var device = IntPtr.Zero;
NvGpu.NvmlInitV2();
device = NvGpu.NvmlDeviceGetHandleByIndex(0);
var temperature = NvGpu.NvmlDeviceGetTemperature(device, NvmlTemperatureSensor.NVML_TEMPERATURE_GPU);
if (!(temperature >= 40 && temperature <= 80))
{
Assert.Fail("Cant get temperature.");
}
NvGpu.NvmlShutdown();
}
catch (Exception e)
{
Assert.Fail(e.ToString());
}
```* The wrapper is in working status. Below we have a list of migrated modules
- [x] Ititialization and Cleanup
- [x] System Queries
- [ ] Device Queries
- [ ] Unit Queries
- [ ] Unit Commands
- [ ] Device Commands
- [ ] Event Handling Methods
- [ ] Error Reporting* Demo Project - There is also a [demo project](Demo/Program.cs), ported from c language, from original nvml api.