[GH-ISSUE #203] "NBFC isn't showing my GPU Temps, only shows the CPU temps?" #180

Closed
opened 2026-02-26 00:31:57 +03:00 by kerem · 21 comments
Owner

Originally created by @NicholasLAranda on GitHub (Mar 19, 2017).
Original GitHub issue: https://github.com/hirschmann/nbfc/issues/203

This is because Windows Services do not have access to GPU Temperatures, and NoteBook FanControl runs as a Windows service.

As per the developer of NBFC @hirschmann outlined in this comment: https://github.com/hirschmann/nbfc/issues/33#issuecomment-159989659

"On Windows: services do not have access to the GPU.
Since NBFC runs as a service: it can not read the GPU temperature.
Currently, I don't know of a good solution for this limitation, sorry."

This explains why in Windows we only have the CPU temperature, even though we have full control over the GPU fan.

I made this issue so that multiple existing issues can be closed and merged to this one, in attempts to lessen the amount of open issues @hirschmann will need to manage.

Originally created by @NicholasLAranda on GitHub (Mar 19, 2017). Original GitHub issue: https://github.com/hirschmann/nbfc/issues/203 This is because Windows Services do not have access to GPU Temperatures, and NoteBook FanControl runs as a Windows service. As per the developer of NBFC @hirschmann outlined in this comment: https://github.com/hirschmann/nbfc/issues/33#issuecomment-159989659 > "On Windows: services do not have access to the GPU. Since NBFC runs as a service: it can not read the GPU temperature. Currently, I don't know of a good solution for this limitation, sorry." This explains why in Windows we only have the CPU temperature, even though we have full control over the GPU fan. I made this issue so that multiple existing issues can be closed and merged to this one, in attempts to lessen the amount of open issues @hirschmann will need to manage.
kerem 2026-02-26 00:31:57 +03:00
Author
Owner

@hirschmann commented on GitHub (Mar 20, 2017):

I'll try to shed some (more) light on this problem:
With Windows Vista, MS introduced session 0 isolation, which means services run in a non-interactive session.
Unfortunately this means they can't access the GPU directly, which is the reason why the NBFC service still can't read GPU temperatures.

When I say "I don't know of a good solution for this limitation", I mean there is a solution, but in my opinion it's not reliable enough and that's why I haven't implemented it (yet).
It would be possible to run a process, which monitors the GPU temperature and reports it back to the service, in an interactive (user) session. But as soon as the user logs off from the session, the monitoring process would be stopped by the OS and NBFC would be "cut off" from the GPU.
Obviously, an unreliable (or not existing) temperature source is a really big problem for NBFC.

If anyone wants to discuss this problem or knows how to solve it, feel free to post your thoughts here.

<!-- gh-comment-id:287773305 --> @hirschmann commented on GitHub (Mar 20, 2017): I'll try to shed some (more) light on this problem: With Windows Vista, MS introduced [session 0 isolation](https://blogs.technet.microsoft.com/askperf/2007/04/27/application-compatibility-session-0-isolation/), which means services run in a non-interactive session. Unfortunately this means they can't access the GPU directly, which is the reason why the NBFC service still can't read GPU temperatures. When I say _"I don't know of a good solution for this limitation"_, I mean there is a solution, but in my opinion it's not reliable enough and that's why I haven't implemented it (yet). It would be possible to run a process, which monitors the GPU temperature and reports it back to the service, in an interactive (user) session. But as soon as the user logs off from the session, the monitoring process would be stopped by the OS and NBFC would be "cut off" from the GPU. Obviously, an unreliable (or not existing) temperature source is a really big problem for NBFC. If anyone wants to discuss this problem or knows how to solve it, feel free to post your thoughts here.
Author
Owner

@snow3461 commented on GitHub (Mar 20, 2017):

Why is it different for the CPU? Is that because GPU driver runs in session 1 instead of session 0?

<!-- gh-comment-id:287810727 --> @snow3461 commented on GitHub (Mar 20, 2017): Why is it different for the CPU? Is that because GPU driver runs in session 1 instead of session 0?
Author
Owner

@hirschmann commented on GitHub (Mar 20, 2017):

It's a little more complicated than that.
The short answer is:
Unlike process which run in interactive user sessions, services which run in session 0 can't access graphics devices (the Windows graphics API call to create a graphics device just fails), because they shouldn't be able to interact with the user e.g. by creating a Window on the Desktop.

Unfortunately this also means, libraries like NVAPI and AMD display library can't access the gpu from session 0.

Since NBFC relies on these libraries, it fails to read the GPU temperatures when running in session 0, see:
https://github.com/hirschmann/nbfc/tree/master/Core/Plugins/OpenHardwareMonitor/Hardware/Nvidia
https://github.com/hirschmann/nbfc/tree/master/Core/Plugins/OpenHardwareMonitor/Hardware/ATI

If you want to learn more about session 0 isolation and WDDM, have a look at these articles:

<!-- gh-comment-id:287893876 --> @hirschmann commented on GitHub (Mar 20, 2017): It's a little more complicated than that. The short answer is: Unlike process which run in interactive user sessions, services which run in session 0 can't access graphics devices (the Windows graphics API call to create a graphics device just fails), because they shouldn't be able to interact with the user e.g. by creating a Window on the Desktop. Unfortunately this also means, libraries like [NVAPI](https://developer.nvidia.com/nvapi) and [AMD display library](http://developer.amd.com/tools-and-sdks/graphics-development/display-library-adl-sdk/) can't access the gpu from session 0. Since NBFC relies on these libraries, it fails to read the GPU temperatures when running in session 0, see: https://github.com/hirschmann/nbfc/tree/master/Core/Plugins/OpenHardwareMonitor/Hardware/Nvidia https://github.com/hirschmann/nbfc/tree/master/Core/Plugins/OpenHardwareMonitor/Hardware/ATI If you want to learn more about session 0 isolation and WDDM, have a look at these articles: - [Application Compatibility – Session 0 Isolation](https://blogs.technet.microsoft.com/askperf/2007/04/27/application-compatibility-session-0-isolation/) - [Services isolation in Session 0 of Windows Vista and Longhorn Server](https://blogs.technet.microsoft.com/voy/2007/02/23/services-isolation-in-session-0-of-windows-vista-and-longhorn-server/) - [XPDM vs. WDDM](https://msdn.microsoft.com/de-de/library/windows/desktop/ff471598(v=vs.85).aspx) - [Windows Display Driver Model (WDDM) Architecture](https://msdn.microsoft.com/en-us/library/windows/hardware/ff570589(v=vs.85).aspx)
Author
Owner

@snow3461 commented on GitHub (Mar 23, 2017):

Thank you, I will.

<!-- gh-comment-id:288757386 --> @snow3461 commented on GitHub (Mar 23, 2017): Thank you, I will.
Author
Owner

@NicholasLAranda commented on GitHub (Mar 24, 2017):

Have you seen these @hirschmann :

http://stackoverflow.com/a/16320043
http://stackoverflow.com/a/18221151

https://msdn.microsoft.com/en-us/windows7trainingcourse_win7session0isolation_topic1#_Toc243675528
More links to the right

https://msdn.microsoft.com/en-us/library/windows/hardware/dn305135(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/windows/hardware/hh439923(v=vs.85).aspx

Other than that: you literally need to hack Windows in order to accomplish a "Session 0 Isolation", which currently has NOT bee achieved yet.

I want to help you achieve this!

<!-- gh-comment-id:288935468 --> @NicholasLAranda commented on GitHub (Mar 24, 2017): Have you seen these @hirschmann : http://stackoverflow.com/a/16320043 http://stackoverflow.com/a/18221151 https://msdn.microsoft.com/en-us/windows7trainingcourse_win7session0isolation_topic1#_Toc243675528 More links to the right https://msdn.microsoft.com/en-us/library/windows/hardware/dn305135(v=vs.85).aspx https://msdn.microsoft.com/en-us/library/windows/hardware/hh439923(v=vs.85).aspx Other than that: you literally need to hack Windows in order to accomplish a "Session 0 Isolation", which currently has NOT bee achieved yet. I want to help you achieve this!
Author
Owner

@NicholasLAranda commented on GitHub (Mar 24, 2017):

How do other programs like OpenHardware monitor and nVidiaInspector or really any other program, access GPU temps?

Are they false readings? Couldn't you borrow some code (with credits) to enable this?

I wanna help. I don't know how to compile, but I do know how to "add code" that the program can utilize.

If I find code, can you add the GUI element, can you program it to pull GPU temps and display on-screen in the GUI, then adjust based off the gathering of this data?

<!-- gh-comment-id:288937160 --> @NicholasLAranda commented on GitHub (Mar 24, 2017): How do other programs like OpenHardware monitor and nVidiaInspector or really any other program, access GPU temps? Are they false readings? Couldn't you borrow some code (with credits) to enable this? I wanna help. I don't know how to compile, but I do know how to "add code" that the program can utilize. If I find code, can you add the GUI element, can you program it to pull GPU temps and display on-screen in the GUI, then adjust based off the gathering of this data?
Author
Owner

@snow3461 commented on GitHub (Mar 24, 2017):

@RypeDub420 If my understanding is correct, NBFC runs as a service, and as thus run in session0, which is (or not perfectly as you may have pointed out) isolated from user session.
OpenHardwareMonitor runs in user session so has access to the GPU.

<!-- gh-comment-id:288956363 --> @snow3461 commented on GitHub (Mar 24, 2017): @RypeDub420 If my understanding is correct, NBFC runs as a service, and as thus run in session0, which is (or not perfectly as you may have pointed out) isolated from user session. OpenHardwareMonitor runs in user session so has access to the GPU.
Author
Owner

@hirschmann commented on GitHub (Mar 25, 2017):

@RypeDub420
Thanks for trying to help.
I've tried to clean up the thread and thus have deleted the links to the outdated openhardwaremonitor fork you've posted. I hope you don't mind.

This is the official OHM repo:
https://github.com/openhardwaremonitor/openhardwaremonitor

This is the OHM fork inside the NBFC repo, which NBFC uses (on Windows) to read temperatures and access the EC:
https://github.com/hirschmann/nbfc/tree/master/Core/Plugins/OpenHardwareMonitor

As @snow3461 said, NBFC would be able to read the GPU temperatures, its just not possible from session 0 in general.

<!-- gh-comment-id:289220775 --> @hirschmann commented on GitHub (Mar 25, 2017): @RypeDub420 Thanks for trying to help. I've tried to clean up the thread and thus have deleted the links to the outdated openhardwaremonitor fork you've posted. I hope you don't mind. This is the official OHM repo: https://github.com/openhardwaremonitor/openhardwaremonitor This is the OHM fork inside the NBFC repo, which NBFC uses (on Windows) to read temperatures and access the EC: https://github.com/hirschmann/nbfc/tree/master/Core/Plugins/OpenHardwareMonitor As @snow3461 said, NBFC would be able to read the GPU temperatures, its just not possible from session 0 in general.
Author
Owner

@NicholasLAranda commented on GitHub (Mar 26, 2017):

Couldn't we then run a non-gui process, that hooks into nbfc.exe so the task manager doesnt get filled up lol, that's not session zero, have it output to a file, then have the nbfc service read from the file in order to display temps and utilize that data to control the fan, instead of being linked to þe cpu temp?

The delay between changing the sliders and displaying the fan speed change is already enough to accommodate this small data gathering process.

Also, I don't mind you cleaning up. I just wanted to point directly to þe code so you arent sifting through every file like I did.

<!-- gh-comment-id:289288775 --> @NicholasLAranda commented on GitHub (Mar 26, 2017): Couldn't we then run a non-gui process, that hooks into nbfc.exe so the task manager doesnt get filled up lol, that's not session zero, have it output to a file, then have the nbfc service read from the file in order to display temps and utilize that data to control the fan, instead of being linked to þe cpu temp? The delay between changing the sliders and displaying the fan speed change is already enough to accommodate this small data gathering process. Also, I don't mind you cleaning up. I just wanted to point directly to þe code so you arent sifting through every file like I did.
Author
Owner

@mirh commented on GitHub (Mar 26, 2017):

Having programs read from a file seems dirt as mud.

I think we could consider this depending on openhardwaremonitor/openhardwaremonitor#33 then?
Last comments suggest schtasks to be the solution.

<!-- gh-comment-id:289292795 --> @mirh commented on GitHub (Mar 26, 2017): Having programs read from a file seems dirt as mud. I think we could consider this depending on openhardwaremonitor/openhardwaremonitor#33 then? Last comments suggest schtasks to be the solution.
Author
Owner

@NicholasLAranda commented on GitHub (Mar 27, 2017):

If nbfc runs in session 0 cause it's a service, then have it run as a process not in session 0, SPAWN the service in session 0, then that will allow you to use schtasks, correct?

<!-- gh-comment-id:289336700 --> @NicholasLAranda commented on GitHub (Mar 27, 2017): If nbfc runs in session 0 cause it's a service, then have it run as a process not in session 0, SPAWN the service in session 0, then that will allow you to use schtasks, correct?
Author
Owner

@mirh commented on GitHub (Mar 27, 2017):

Afaik the idea was supposed to just be: run nbfc as a task on start/boot, profit.
Services for reasons explained here really don't seem viable.

<!-- gh-comment-id:289390912 --> @mirh commented on GitHub (Mar 27, 2017): Afaik the idea was supposed to just be: run nbfc as a task on start/boot, profit. Services for reasons explained [here](https://www.scribd.com/doc/58343489/Windows-Session-0-Isolation-Impact-on-GPU-as-Service) really don't seem viable.
Author
Owner

@NicholasLAranda commented on GitHub (Mar 27, 2017):

Maybe it's time to evolve NBFC, perhaps introduce a new GUI and the ability to automatically submit config's.

I just really love this program and I wanna see it grow :D

<!-- gh-comment-id:289527638 --> @NicholasLAranda commented on GitHub (Mar 27, 2017): Maybe it's time to evolve NBFC, perhaps introduce a new GUI and the ability to automatically submit config's. I just really love this program and I wanna see it grow :D
Author
Owner

@mirh commented on GitHub (Mar 27, 2017):

Tbh, if you have the ability to mess up with EC registers, doing a pull request really seem the least of your problems.
If any, I'd see light years of room for improvements in tools to help figuring out those (I'm working on a dumb idea of mine in this regard).

For example: how about cross-comparing temperature (or fan speed RPMs if that info is available somewhere else) change moments with EC registers changes?
Or perhaps porting this stuff.
Also making a wiki page to merge guides and user manual.

<!-- gh-comment-id:289550560 --> @mirh commented on GitHub (Mar 27, 2017): Tbh, if you have the ability to mess up with EC registers, doing a pull request really seem the least of your problems. If any, I'd see light years of room for improvements in tools to help figuring out those (I'm working on a dumb idea of mine in this regard). For example: how about cross-comparing temperature (or fan speed RPMs if that info is available somewhere else) change moments with EC registers changes? Or perhaps porting [this](https://github.com/F0rth/acer_ec) [stuff](https://github.com/Lekensteyn/acpi-stuff). Also making a wiki page to merge [guides](http://forum.notebookreview.com/threads/acer-aspire-timelinex-3820tg-mods-tweaks-only.562576/#post-7260497) and user manual.
Author
Owner

@DrOfIllusions commented on GitHub (Feb 2, 2018):

Hi,

I was looking into a similar matter concerning my Zbook 17. I was wondering if it would not be easier to just write a batch file that runs at Logon in the background and continuously reads the temperature/Power load from nvsmi.exe (NVIDIA GPU) and then issues a command to Notebook FanControl to move to a certain fan percent. Is this possible? If so, can someone give me a weblink to somewhere that shows how to code such a thing?

Thanks!
DOI

<!-- gh-comment-id:362734689 --> @DrOfIllusions commented on GitHub (Feb 2, 2018): Hi, I was looking into a similar matter concerning my Zbook 17. I was wondering if it would not be easier to just write a batch file that runs at Logon in the background and continuously reads the temperature/Power load from nvsmi.exe (NVIDIA GPU) and then issues a command to Notebook FanControl to move to a certain fan percent. Is this possible? If so, can someone give me a weblink to somewhere that shows how to code such a thing? Thanks! DOI
Author
Owner

@mirh commented on GitHub (Feb 2, 2018):

It certainly is possible. but that's really hacky at best.
I wonder if vendor-specific apis couldn't be used then?

<!-- gh-comment-id:362743559 --> @mirh commented on GitHub (Feb 2, 2018): It certainly is possible. but that's really hacky at best. I wonder if [vendor-specific apis](https://stackoverflow.com/questions/2843244/how-to-read-gpu-graphic-card-temperature) couldn't be used then?
Author
Owner

@DrOfIllusions commented on GitHub (Feb 3, 2018):

Great! Thanks! So if I want to communicate with NBFC from either C or the CMD line, once I get the temperatures and my temperature thresholds are met, how to do that?

I was actually looking into exploiting the following Nvidia command from the CMD line in a batch file:

nvidia-smi.exe -i 0 --loop-ms=100 --format=csv,noheader --query-gpu=temperature.gpu

The idea was that every 100ms the GPU parameter I would like to control (for me power would be better as it is an early indicator of the gpu temperature) is automatically measured. At each measurement then I would run the threshold checks and issue the corresponding command to NBFC (Perhaps it would be better to just run EC-probe.exe with the write command?). What is bothering me though is how can I in a batch file read the stdout of a polling program at each poll and act on it without interrupting the poll.

Any help is highly appreciated,

Thanks!

<!-- gh-comment-id:362746154 --> @DrOfIllusions commented on GitHub (Feb 3, 2018): Great! Thanks! So if I want to communicate with NBFC from either C or the CMD line, once I get the temperatures and my temperature thresholds are met, how to do that? I was actually looking into exploiting the following Nvidia command from the CMD line in a batch file: nvidia-smi.exe -i 0 --loop-ms=100 --format=csv,noheader --query-gpu=temperature.gpu The idea was that every 100ms the GPU parameter I would like to control (for me power would be better as it is an early indicator of the gpu temperature) is automatically measured. At each measurement then I would run the threshold checks and issue the corresponding command to NBFC (Perhaps it would be better to just run EC-probe.exe with the write command?). What is bothering me though is how can I in a batch file read the stdout of a polling program at each poll and act on it without interrupting the poll. Any help is highly appreciated, Thanks!
Author
Owner

@chandradeepdey commented on GitHub (Nov 5, 2018):

On my laptop, the EC itself can be used to find out temperatures. Do other laptops also support this?

image
Fan 1 is CPU temp (reading from 0xB0), Fan 2 is GPU temp (reading from 0xB4)

<!-- gh-comment-id:435783126 --> @chandradeepdey commented on GitHub (Nov 5, 2018): On my laptop, the EC itself can be used to find out temperatures. Do other laptops also support this? ![image](https://user-images.githubusercontent.com/21266577/47984837-d209b780-e0fd-11e8-906b-18353697e2c6.png) Fan 1 is CPU temp (reading from 0xB0), Fan 2 is GPU temp (reading from 0xB4)
Author
Owner

@chandradeepdey commented on GitHub (Nov 5, 2018):

The following solution is based on how my laptop works:
We can let the user add a config to individual fans about which registers to read the temperature from. We can also let the user add weights to the registers. While calculating the register, we can do a weighted mean of all nonzero registers.
This allows the CPU fan to only use the CPU temperature. This also allows the GPU fan to be able to properly select the temperature to respond to. When the GPU is active, the weighted mean of both the registers are used. When the GPU is inactive, and the temperature shows up as 00, only the CPU register is considered.

<!-- gh-comment-id:435785988 --> @chandradeepdey commented on GitHub (Nov 5, 2018): The following solution is based on how my laptop works: We can let the user add a config to individual fans about which registers to read the temperature from. We can also let the user add weights to the registers. While calculating the register, we can do a weighted mean of all nonzero registers. This allows the CPU fan to only use the CPU temperature. This also allows the GPU fan to be able to properly select the temperature to respond to. When the GPU is active, the weighted mean of both the registers are used. When the GPU is inactive, and the temperature shows up as 00, only the CPU register is considered.
Author
Owner

@saravanabalagi commented on GitHub (Dec 30, 2018):

@chandradeepdey Same here, my temperatures show up in the EC at registers 164 and 166 for GPU and CPU respectively and I believe we can make use of this for comps that have this setup.

Also observing the EC, I see that register 160 is almost always carry the same value as 166 and so does 164 and 165. I'm still puzzled about a few things though, my config writes 0x0A (10) to registers 160 and 166 before writing the fan speed values at 151 and 152, however when the speed changes automatically it doesn't happen, is that some sort of write switch?

<!-- gh-comment-id:450530280 --> @saravanabalagi commented on GitHub (Dec 30, 2018): @chandradeepdey Same here, my temperatures show up in the EC at registers 164 and 166 for GPU and CPU respectively and I believe we can make use of this for comps that have this setup. Also observing the EC, I see that register 160 is almost always carry the same value as 166 and so does 164 and 165. I'm still puzzled about a few things though, my config writes 0x0A (10) to registers 160 and 166 before writing the fan speed values at 151 and 152, however when the speed changes automatically it doesn't happen, is that some sort of write switch?
Author
Owner

@github-actions[bot] commented on GitHub (Dec 12, 2019):

This issue is stale because it has been open more than 180 days with no activity. If nobody comments within 7 days, this issue will be closed

<!-- gh-comment-id:564787595 --> @github-actions[bot] commented on GitHub (Dec 12, 2019): This issue is stale because it has been open more than 180 days with no activity. If nobody comments within 7 days, this issue will be closed
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/nbfc-hirschmann#180
No description provided.