-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
pierre.delaunay
committed
Sep 18, 2024
1 parent
c1760c7
commit 46647ff
Showing
9 changed files
with
145 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
|
||
|
||
def memory_peak_fetcher(): | ||
import jax | ||
|
||
def fetch_memory_peak(): | ||
# 'memory', 'memory_stats' | ||
devices = jax.devices() | ||
max_mem = -1 | ||
for device in devices: | ||
# dqn.D0 [stdout] Device: cuda:0 | ||
# dqn.D0 [stdout] num_allocs: 0.0006799697875976562 MiB | ||
# dqn.D0 [stdout] bytes_in_use: 0.915771484375 MiB | ||
# dqn.D0 [stdout] peak_bytes_in_use: 80.41552734375 MiB | ||
# dqn.D0 [stdout] largest_alloc_size: 16.07958984375 MiB | ||
# dqn.D0 [stdout] bytes_limit: 60832.359375 MiB | ||
# dqn.D0 [stdout] bytes_reserved: 0.0 MiB | ||
# dqn.D0 [stdout] peak_bytes_reserved: 0.0 MiB | ||
# dqn.D0 [stdout] largest_free_block_bytes: 0.0 MiB | ||
# dqn.D0 [stdout] pool_bytes: 60832.359375 MiB | ||
# dqn.D0 [stdout] peak_pool_bytes: 60832.359375 MiB | ||
|
||
# device_name = str(device) | ||
mem = device.memory_stats().get("peak_bytes_in_use", 0) / (1024 ** 2) | ||
max_mem = max(mem, max_mem) | ||
|
||
return max_mem | ||
|
||
return fetch_memory_peak |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters