How to return the GPU temperature as an integer using Bash?












0















I am aiming to create a Bash script to control the fan speed of my AMD Vega 64. I've got an idea on how to go about it, apart from the aspect of getting solely the integer value for the temperature of the GPU core from the file /sys/kernel/debug/dri/0/amdgpu_pm_info without picking up the strings "GPU Temperature:" at the start of the line and "C" at the end of it. A bonus would to able to get the HBM2 temperature - which doesn't seem to be anywhere - as that it is known to run hotter than the core.










share|improve this question























  • Why don't you just use fancontrol ? without picking up the strings "GPU Temperature:" at the start of the line and "C" at the end of it. - this is/sys/kernel/debug it's for debugging. You should use /sys/class/hwmon and such similar interfaces to read the temperature into your program.

    – Kamil Cuk
    Jan 20 at 6:50








  • 1





    Welcome to SO. Stack Overflow is a question and answer page for professional and enthusiastic programmers. Add your own code to your question. You are expected to show at least the amount of research you have put into solving this question yourself.

    – Cyrus
    Jan 20 at 7:08











  • Please add sample input and your desired output for that sample input to your question.

    – Cyrus
    Jan 20 at 7:09
















0















I am aiming to create a Bash script to control the fan speed of my AMD Vega 64. I've got an idea on how to go about it, apart from the aspect of getting solely the integer value for the temperature of the GPU core from the file /sys/kernel/debug/dri/0/amdgpu_pm_info without picking up the strings "GPU Temperature:" at the start of the line and "C" at the end of it. A bonus would to able to get the HBM2 temperature - which doesn't seem to be anywhere - as that it is known to run hotter than the core.










share|improve this question























  • Why don't you just use fancontrol ? without picking up the strings "GPU Temperature:" at the start of the line and "C" at the end of it. - this is/sys/kernel/debug it's for debugging. You should use /sys/class/hwmon and such similar interfaces to read the temperature into your program.

    – Kamil Cuk
    Jan 20 at 6:50








  • 1





    Welcome to SO. Stack Overflow is a question and answer page for professional and enthusiastic programmers. Add your own code to your question. You are expected to show at least the amount of research you have put into solving this question yourself.

    – Cyrus
    Jan 20 at 7:08











  • Please add sample input and your desired output for that sample input to your question.

    – Cyrus
    Jan 20 at 7:09














0












0








0








I am aiming to create a Bash script to control the fan speed of my AMD Vega 64. I've got an idea on how to go about it, apart from the aspect of getting solely the integer value for the temperature of the GPU core from the file /sys/kernel/debug/dri/0/amdgpu_pm_info without picking up the strings "GPU Temperature:" at the start of the line and "C" at the end of it. A bonus would to able to get the HBM2 temperature - which doesn't seem to be anywhere - as that it is known to run hotter than the core.










share|improve this question














I am aiming to create a Bash script to control the fan speed of my AMD Vega 64. I've got an idea on how to go about it, apart from the aspect of getting solely the integer value for the temperature of the GPU core from the file /sys/kernel/debug/dri/0/amdgpu_pm_info without picking up the strings "GPU Temperature:" at the start of the line and "C" at the end of it. A bonus would to able to get the HBM2 temperature - which doesn't seem to be anywhere - as that it is known to run hotter than the core.







linux bash gpu






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 20 at 6:46









Gareth Anthony HulseGareth Anthony Hulse

213




213













  • Why don't you just use fancontrol ? without picking up the strings "GPU Temperature:" at the start of the line and "C" at the end of it. - this is/sys/kernel/debug it's for debugging. You should use /sys/class/hwmon and such similar interfaces to read the temperature into your program.

    – Kamil Cuk
    Jan 20 at 6:50








  • 1





    Welcome to SO. Stack Overflow is a question and answer page for professional and enthusiastic programmers. Add your own code to your question. You are expected to show at least the amount of research you have put into solving this question yourself.

    – Cyrus
    Jan 20 at 7:08











  • Please add sample input and your desired output for that sample input to your question.

    – Cyrus
    Jan 20 at 7:09



















  • Why don't you just use fancontrol ? without picking up the strings "GPU Temperature:" at the start of the line and "C" at the end of it. - this is/sys/kernel/debug it's for debugging. You should use /sys/class/hwmon and such similar interfaces to read the temperature into your program.

    – Kamil Cuk
    Jan 20 at 6:50








  • 1





    Welcome to SO. Stack Overflow is a question and answer page for professional and enthusiastic programmers. Add your own code to your question. You are expected to show at least the amount of research you have put into solving this question yourself.

    – Cyrus
    Jan 20 at 7:08











  • Please add sample input and your desired output for that sample input to your question.

    – Cyrus
    Jan 20 at 7:09

















Why don't you just use fancontrol ? without picking up the strings "GPU Temperature:" at the start of the line and "C" at the end of it. - this is/sys/kernel/debug it's for debugging. You should use /sys/class/hwmon and such similar interfaces to read the temperature into your program.

– Kamil Cuk
Jan 20 at 6:50







Why don't you just use fancontrol ? without picking up the strings "GPU Temperature:" at the start of the line and "C" at the end of it. - this is/sys/kernel/debug it's for debugging. You should use /sys/class/hwmon and such similar interfaces to read the temperature into your program.

– Kamil Cuk
Jan 20 at 6:50






1




1





Welcome to SO. Stack Overflow is a question and answer page for professional and enthusiastic programmers. Add your own code to your question. You are expected to show at least the amount of research you have put into solving this question yourself.

– Cyrus
Jan 20 at 7:08





Welcome to SO. Stack Overflow is a question and answer page for professional and enthusiastic programmers. Add your own code to your question. You are expected to show at least the amount of research you have put into solving this question yourself.

– Cyrus
Jan 20 at 7:08













Please add sample input and your desired output for that sample input to your question.

– Cyrus
Jan 20 at 7:09





Please add sample input and your desired output for that sample input to your question.

– Cyrus
Jan 20 at 7:09












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54274229%2fhow-to-return-the-gpu-temperature-as-an-integer-using-bash%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54274229%2fhow-to-return-the-gpu-temperature-as-an-integer-using-bash%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Homophylophilia

Updating UILabel text programmatically using a function

Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage