Software Tuning, Performance Optimization & Platform Monitoring
Discussion regarding monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform updating.
1711 Discussions

Power Gadget: PG_Shutdown when UsePMU=false still affects SW using PMU?

connorimes
Novice
544 Views

CC @Patrick_K_Intel 

Greetings, and thanks again for your help earlier this week.

I'm using Intel Power Gadget 3.7.0 on macOS.

I have software using `PowerGadgetLib.h` which (depending on its condiguration) calls `PG_UsePMU(false)` before reading any samples. I can start and stop multiple instances of the software without issue when all of them set `PG_UsePMU(false)`. However, if any software is using the Power Gadget API without setting `PG_UsePMU(false)`, it starts getting errors as soon as any software calls `PG_Shutdown`, even when the software shutting down has set `PG_UsePMU(false)`. The instance that is using the PMU gets an error when calling `PG_ReadSample`: "ERROR: EnergyDriver_executeCommands [via readSample] returned 0xe00002bc".

Is `PG_Shutdown` performing PMU operations regardless of `UsePMU`? I'd think it should only do so if the PMU was actually used. Similarly, if `PG_Initialize` also operates on the PMUs, perhaps a global `UsePMU` configuration is needed that can be set prior to initialization (which is required to call `PG_GetNumPackages` prior to calling `PG_UsePMU`).

For example, the problem appears when running the Intel Power Gadget application in the background while also starting/stopping software that uses the Power Gadget API with `PG_UsePMU(false)`. Power Gadget silently fails to collect more samples after the other software calls `PG_Shutdown`. I presume that Power Gadget is using the PMU, and I don't see an option to disable its use. It would be nice if a user could run Power Gadget at the same time that other software is using its API with `PG_UsePMU(false)`.

I suppose the questions are then:
What is the intended behavior?
Can the library be fixed/adjusted/extended to better support 1 PMU client alongside multiple non-PMU clients?

Thanks,
-Connor

0 Kudos
0 Replies
Reply