Notice: file_put_contents(): Write of 18820 bytes failed with errno=28 No space left on device in /var/www/tgoop/post.php on line 50
[PYTHON:TODAY]@python2day P.6788
PYTHON2DAY Telegram 6788
🎮 Следишь за своей видеокартой? Теперь ты можешь это делать прямо из Python.

Скрипт, который:
📊 Показывает загрузку GPU
📊 Отображает объём свободной/занятой памяти
🌡 Показывает температуру
🖥 И всё это — в красивой ASCII-таблице

💻 Код:

# pip install GPUtil tabulate

import GPUtil
from tabulate import tabulate
from typing import List, Tuple

def gpu_info() -> str:
"""
Получает информацию о доступных GPU: загрузка, температура, объём памяти.
Возвращает отформатированную таблицу.
"""
gpus = GPUtil.getGPUs()
gpus_list: List[Tuple] = []

for gpu in gpus:
gpus_list.append((
gpu.id,
gpu.name,
f"{gpu.load * 100:.1f}%",
f"{gpu.memoryFree}MB",
f"{gpu.memoryUsed}MB",
f"{gpu.memoryTotal}MB",
f"{gpu.temperature}°C"
))

return tabulate(
gpus_list,
headers=["id", "name", "load", "free memory", "used memory", "total memory", "temperature"],
tablefmt="pretty"
)

if __name__ == "__main__":
print(gpu_info())


🔥 Поддерживается работа с несколькими GPU.
Проверь, как там твоя RTX под стрессом.

#python #soft #code #cheatsheet
Please open Telegram to view this post
VIEW IN TELEGRAM
👍50🔥2312



tgoop.com/python2day/6788
Create:
Last Update:

🎮 Следишь за своей видеокартой? Теперь ты можешь это делать прямо из Python.

Скрипт, который:
📊 Показывает загрузку GPU
📊 Отображает объём свободной/занятой памяти
🌡 Показывает температуру
🖥 И всё это — в красивой ASCII-таблице

💻 Код:

# pip install GPUtil tabulate

import GPUtil
from tabulate import tabulate
from typing import List, Tuple

def gpu_info() -> str:
"""
Получает информацию о доступных GPU: загрузка, температура, объём памяти.
Возвращает отформатированную таблицу.
"""
gpus = GPUtil.getGPUs()
gpus_list: List[Tuple] = []

for gpu in gpus:
gpus_list.append((
gpu.id,
gpu.name,
f"{gpu.load * 100:.1f}%",
f"{gpu.memoryFree}MB",
f"{gpu.memoryUsed}MB",
f"{gpu.memoryTotal}MB",
f"{gpu.temperature}°C"
))

return tabulate(
gpus_list,
headers=["id", "name", "load", "free memory", "used memory", "total memory", "temperature"],
tablefmt="pretty"
)

if __name__ == "__main__":
print(gpu_info())


🔥 Поддерживается работа с несколькими GPU.
Проверь, как там твоя RTX под стрессом.

#python #soft #code #cheatsheet

BY [PYTHON:TODAY]




Share with your friend now:
tgoop.com/python2day/6788

View MORE
Open in Telegram


Telegram News

Date: |

How to create a business channel on Telegram? (Tutorial) There have been several contributions to the group with members posting voice notes of screaming, yelling, groaning, and wailing in different rhythms and pitches. Calling out the “degenerate” community or the crypto obsessives that engage in high-risk trading, Co-founder of NFT renting protocol Rentable World emiliano.eth shared this group on his Twitter. He wrote: “hey degen, are you stressed? Just let it out all out. Voice only tg channel for screaming”. Earlier, crypto enthusiasts had created a self-described “meme app” dubbed “gm” app wherein users would greet each other with “gm” or “good morning” messages. However, in September 2021, the gm app was down after a hacker reportedly gained access to the user data. 2How to set up a Telegram channel? (A step-by-step tutorial) With the “Bear Market Screaming Therapy Group,” we’ve now transcended language.
from us


Telegram [PYTHON:TODAY]
FROM American