-
Notifications
You must be signed in to change notification settings - Fork 4.1k
GPUDirect Storage prototype tutorial #3317
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
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/3317
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 7d9de66 with merge base 7cb6915 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
@@ -31,6 +31,7 @@ | |||
"prototype_source/vmap_recipe", | |||
"prototype_source/torchscript_freezing", | |||
"prototype_source/nestedtensor", | |||
"prototype_source/gpu_direct_storage", # requires specific filesystem + GPUDirect Storage to be set up |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't it run in compat mode with a random machine?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need a specific filesystem
# The loading flow is the inverse, we can ``torch.load`` under the ``torch.serialization.skip_data`` context | ||
# manager to load everything except the storage bytes. This means that any tensors in the checkpoint will be | ||
# created but their storages will be empty (i.e. the tensors will be created via ``torch.empty``). If the | ||
# tensors to be loaded to are persistent, one can use the ``torch.cuda.gds.gds_register_buffer`` API to register |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The register API is not used here?
f.load_storage(v.untyped_storage(), offset) | ||
assert torch.equal(v, sd[k]) | ||
|
||
del f |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar synchronization question as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think synchronization is needed after the call as cuFileRead/Write
are blocking operations that block until IO is complete https://docs.nvidia.com/gpudirect-storage/api-reference-guide/index.html#cufileread. You might need to synchronize before these ops (rather than after) though

# If you are continuously saving the same state dictionary during training, you | ||
# would only need to obtain the offsets once and the same offsets can be re-used. Similarly if tensor is going to | ||
# be loaded to repeatedly one can use the ``torch.cuda.gds.gds_register_buffer`` which wraps | ||
# ``cuFileBufRegister`` to register the storages as gds buffers. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@albanD is this better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a few minor nits
|
||
del f | ||
|
||
# Conclusion |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part is rendered as a code comment: https://docs-preview.pytorch.org/pytorch/tutorials/3317/prototype/gpu_direct_storage.html#using-gpudirect-storage-with-torch-save-and-torch-load
The above fix should fix it.
No description provided.