-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[STF] Support generation of multiple CUDA graphs from separate threads (
#3943) * Introduce a mutex to protect the underlying CUDA graph of a graph context so that we can generate tasks concurrently * Protect CUDA graphs against concurrent accesses * do test results * remove dead code * Add a test with graph capture and threads * Add and use with_locked_graph, also use weak_ptr * Big code simplification ! no need for shared_ptr/weak_ptr with the mutex that will outlive its users * use std::reference_wrapper to have graph_task be moved assignable * replace complicated API based on lambda function with a simple lock guard * restore a comment removed by mistake * capture with the lock taken because we need to ensure the captured stream is not used concurrently * Fix build * comment why we put a reference_wrapper * Add a sanity check to ensure we have finished all tasks * Add a test which uses multiple threads to generate CUDA graphs * clang-format * Rework how we pass frozen logical data, not logical data to threads * atomic variables are not automatically initialized, so we do set them * Add missing mutex headers * improve readability * Save WIP : there currently needs to be a lock around the creation of the ctx * Improve thread safety in dot, and reduce the visibility of methods which need not be public * reserved::dot::finish needs to be public * Add missing header * There is no need to use a mutex in the ctor of a singleton * Simplify example again --------- Co-authored-by: Andrei Alexandrescu <[email protected]>
- Loading branch information
Showing
4 changed files
with
259 additions
and
136 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
Oops, something went wrong.