-
Notifications
You must be signed in to change notification settings - Fork 57
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
reentrant TA::rand()
#394
Merged
evaleev
merged 15 commits into
evaleev/fix/rank-1-index-vs-ordinal-accessors
from
evaleev/feature/reentrant-rand
Mar 9, 2023
Merged
reentrant TA::rand()
#394
evaleev
merged 15 commits into
evaleev/fix/rank-1-index-vs-ordinal-accessors
from
evaleev/feature/reentrant-rand
Mar 9, 2023
Conversation
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
copied https://github.com/ValeevGroup/mpqc4/blob/6714a216d963f8252b7be0d379a57e7c9fa0b732/src/mpqc/util/misc/thread_specific.h and https://github.com/ValeevGroup/mpqc4/blob/530f8d01cd84702ec5b387f7658741c80eaeca0a/src/mpqc/util/misc/pool.h to TiledArray/util/thread_specific.h and fixed to be properly movable
- TA::{rand,drand} are reentrant versions of rand and drand48 that uses Boost.Random's mt19937 and uniform distribution classes (the latter is needed to produce platform-portable results, see https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2059r0.pdf ) ... TA::srand controls the seeds of the thread-specific random engines - MakeRandom now uses TA::rand instead of std::rand ... the latter is not reentrant so technically any use of DistArray::fill_random was UB ... single-threaded version of DistArray::fill_random to get random tensors witrh contents independent of schedule will be introduced in a separate commit
…les,fill_random} default is to use MADWorld's taskq, but useful with non-reentrant ops or, even when op is reentrant, e.g. to ensure that same random tensor is generated by DistArray::fill_random (since initial state of every thread-specific random engine is the same tiles generated by different threads will initially have the same content ... )
… hand-rolled equivalent
…ordinal()} assert batch_size=1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
introduces
TA::{rand,drand,srand}
TA::{rand,drand}
are reentrant versions ofrand
anddrand48
that usesBoost.Random
's mt19937 and uniform distribution classes (the latter is needed to produce platform-portable results, see https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2020/p2059r0.pdf ) ...TA::srand
controls the seeds of the thread-specific random enginesdetail::MakeRandom
now usesTA::rand
instead ofstd::rand
(the latter is not guaranteed to be reentrant.DistArray::{init_elements,init_tiles,fill_random}
so that it is possible to useDistArray::fill_random
to get reproducibly-random tensors even if using >1 thread/rank.