Skip to content

Nvml( nvidia monitoring library) wrapper for c#.

License

Notifications You must be signed in to change notification settings

wojiaofsp/nvml-csharp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

The nvidia monitoring library wrapper written in c#. Please, read the documentation for better understand what is nvml.

  • Example on how to get running processes list
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
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
  • Ititialization and Cleanup
  • System Queries
  • Device Queries
  • Unit Queries
  • Unit Commands
  • Device Commands
  • Event Handling Methods
  • Error Reporting
  • Demo Project - There is also a demo project, ported from c language, from original nvml api.

About

Nvml( nvidia monitoring library) wrapper for c#.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%