falahati/NvAPIWrapper

setting power limit

MaynardMiner opened this issue · 2 comments

uint vn = Convert.ToUInt32(actual_percent * 1000f);
PrivatePowerPoliciesStatusV1 pl = GPUApi.ClientPowerPoliciesGetStatus(GPUs[Index].Handle);
PrivatePowerPoliciesStatusV1.PowerPolicyStatusEntry[] entry = { new PrivatePowerPoliciesStatusV1.PowerPolicyStatusEntry(vn) };
PrivatePowerPoliciesStatusV1 new_pl = new PrivatePowerPoliciesStatusV1(entry);
GPUApi.ClientPowerPoliciesSetStatus(GPUs[Index].Handle, new_pl);

This will only set P0_3DPerformance to whatever % value I wanted.

I can't really change the PerformanceStateId because it's a read only value, so I'm no sure if it is worth adding 1 entry for each existing entry...If there is ever actually more than 1 existing entry...All of my GPUs don't have more than 1 PowerPolicyStatusEntry, which is P0_3DPerformance....But it is an array of PowerPolicyStatusEntries according to low-level.

This works for setting P0, I'm wondering if there is a need and/or a possibility of setting other PerformanceStateId based on the what the GPU has set already? Or would I be fine just setting P0, and removing any existing entries in GPU beyond P0 like I am doing now?

Power target, temperature target, and over-voltage settings are all P0 only. You can not change these settings for other performance states.

If what you are doing is working; keep doing that and don't worry about other performance states since they are not configurable anyway.

The above works. It set power limit after I check it with nvidiainspector. So I guess its good then.