falahati/NvAPIWrapper

fan methods

MaynardMiner opened this issue · 8 comments

https://github.com/falahati/NvAPIWrapper/tree/a4d5ba0fcdd9c1ccfc1e9e4d4480fcbce512848f

Somewhere after this point, the fan methods broke for RTX cards. You can still set them for GTX, but RTX cards get

"NVAPI_NOT_SUPPORTED" error for GPUApi.GetCoolerSettings

I ended up doing searching, and found where you made the commits and used that branch and it worked.

Based on this comment that you sent to me on 24 of July last year, GPUApi.GetCoolerSettings didn't work with RTX cards. The right way to get cooler information without relying on multiple fallback methods is to use the high-level API as follow:

        var GPUs = PhysicalGPU.GetPhysicalGPUs();
        var MyGPUIndex = 1;
        var coolers = GPUs[MyGPUIndex].CoolerInformation.Coolers.ToArray();
        for (int j = 0; j < coolers.Length; j++)
        {
            // Info available via `coolers[j]` properties
            // Set speed using this:
            // GPUs[MyGPUIndex].CoolerInformation.SetCoolerSettings(coolers[j].CoolerId, 100);
        }

Does this work for you with the high-level API?

I feel that you are missing something here. If you are sure that GPUApi.GetCoolerSettings worked before these commits with your RTX card (please double-check as it might retrieve information about the GTX card you have on the system), please find a way to narrow the problem to a single commit. Maybe by cloning the repository and trying every commit since that time, simply by checking out the changes and recompiling in a solution. I am asking for this since I checked the source code and couldn't find any change to this method or other relevant methods in the last year.

Thanks

I am using the same exact codebase that I used. I simply tried to rebuild it with latest.

If I build the original code, it works.
If I try to build with the latest wrapper:
-GTX cards work.
-RTX cards to not work.

There is no difference in the code.

Steps to reproduce

Working version

namespace NvAPISample
{
    class Program
    {
        static void Main(string[] args)
        {
           int Speed = 75;
           int Index = 0;

          if (Speed > -1)
           {
              NVIDIA.Initialize();
              var GPUs = PhysicalGPU.GetPhysicalGPUs();
              var Cool = GPUs[Index].CoolerInformation.Coolers;
              Console.WriteLine("Current Fan Speed: " + GPUs[Index].CoolerInformation.CurrentFanSpeedLevel);
              foreach (GPUCooler cooler in Cool)
               {
                 GPUs[Index].CoolerInformation.SetCoolerSettings(cooler.CoolerId, Speed);
               }
             Console.WriteLine("New Fan Speed: " + Speed);
             NVIDIA.Unload();
          }
      }
   }
}
  • build

Step to reproduce (error)

  • Clone latest version.
  • Insert the above code into Program.cs (nvapisample)...Just for fast example.
  • build

I am doing nothing different...Maybe just generating a new key in the signing section.

The exception thrown is here:

https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/GPU/GPUCoolerInformation.cs#L43

It's just very weird that the same exact code can be built with the version I posted in the issue, but not the current. Don't get me wrong, I am just using the old version fine as a workaround. I just am posting because it's driving me nuts as to why it is happening...I personally don't see anything wrong with the codebase. It makes no sense to me, either.

Hmm,

What is the value of e.Status when the exception is thrown?

I am talking about the line you mentioned:
https://github.com/falahati/NvAPIWrapper/blob/master/NvAPIWrapper/GPU/GPUCoolerInformation.cs#L43

"NVAPI_NOT_SUPPORTED"

If you capture this exception, or just debug the main library at the line specified before, what is the value of e.Status in "integer"? Its an enum type and should have an integer value or at least a corresponding enum member. Is it NotSupported = -104?

I am sorry about these questions, but since I don't own an RTX card, you are the only one that can produce this problem.

Will get back to you.

I need to hook up the dev rig with RTX cards back into windows, and run the debug again.

So I happened to flash a new windows and a new visual studio (I had to, to update my disk). After reloading everything and building...It appears to work.

I'm not sure why it didn't work before. I am clueless, but I guess this was in error. It must have been some build setting or something in my last Windows. I apologize, I just spent days trying to figure out issue before I posted here.