Skip to content

pg_gpu_info to get NVIDIA-related information like with nvidia-smi #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
173 changes: 134 additions & 39 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ bytesize = "1.1.0"
ciborium = "0.2.0"
heapless = "0.7.16"
lazy_static = "1.4.0"
nvml-wrapper = "0.9.0"
parking_lot = "0.12.1"
pgrx = { version = "=0.8.3", features = ["time-crate"] }
serde = "1.0.152"
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ SELECT * FROM pg_stat_sysinfo_cache_summary();

```

NVIDIA GPU statistics are available if the `nvidia-smi` command is available

```sql
----
SELECT device_id, device_name, total_memory_mb, used_memory_mb, temperature_c from pg_gpu_info();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to namespace this function to this extension as well, if we are to use this approach. Like we do with PostgresML, it should be something like SELECT * FROM pg_stat_sysinfo.gpu_metrics() or similar.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @levkk! I will look at the performance of getting the gpu_metrics vs. the others. Namespacing the function is also a good idea.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also update the pgrx dependencies. I didn't right off the bat because I was getting some errors, but we definitely should.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah, good call. Would be great to match the pgrx version here with what we have in postgresml/postgresml.

device_id | device_name | total_memory_mb | used_memory_mb | temperature_c
-----------+-------------+-----------------+----------------+---------------
0 | Tesla T4 | 16106.12736 | 12277.972992 | 59
1 | Tesla T4 | 16106.12736 | 13227.982848 | 58
2 | Tesla T4 | 16106.12736 | 2043.871232 | 56
3 | Tesla T4 | 16106.12736 | 9325.182976 | 53
(4 rows)
```
## Configuration Changes

The `pg_stat_sysinfo.interval` can be updated by changing `postgres.conf` and
Expand Down
Loading