stream_for Interface

public interface stream_for

Derive an independent, reproducible generator for a stream id.

Parallel codes must not let the seed of a task depend on scheduling order. stream_for maps (master_seed, stream_id) to a generator through two SplitMix64 finalisers, so stream 7 is the same sequence whether it runs first, last or on another rank, and different ids give uncorrelated sequences.

Calls

interface~~stream_for~~CallsGraph interface~stream_for stream_for proc~stream_for_pcg32 stream_for_pcg32 interface~stream_for->proc~stream_for_pcg32 proc~stream_for_splitmix64 stream_for_splitmix64 interface~stream_for->proc~stream_for_splitmix64 proc~splitmix64_next splitmix64_t%splitmix64_next proc~stream_for_pcg32->proc~splitmix64_next proc~splitmix64_seed splitmix64_t%splitmix64_seed proc~stream_for_pcg32->proc~splitmix64_seed proc~stream_seed stream_seed proc~stream_for_pcg32->proc~stream_seed proc~stream_for_splitmix64->proc~splitmix64_seed proc~stream_for_splitmix64->proc~stream_seed proc~mix64 mix64 proc~splitmix64_next->proc~mix64 proc~u64_add u64_add proc~splitmix64_next->proc~u64_add proc~stream_seed->proc~mix64 proc~stream_seed->proc~u64_add proc~u64_mul u64_mul proc~stream_seed->proc~u64_mul proc~mix64->proc~u64_mul proc~u64_shr u64_shr proc~mix64->proc~u64_shr

Module Procedures

private subroutine stream_for_splitmix64(master_seed, stream_id, gen)

Build the SplitMix64 generator belonging to stream_id.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: master_seed
integer(kind=default_int), intent(in) :: stream_id
type(splitmix64_t), intent(out) :: gen

private subroutine stream_for_pcg32(master_seed, stream_id, gen)

Build the PCG32 generator belonging to stream_id. The derived seed drives a local SplitMix64 which supplies both the LCG state and the stream selector.

Arguments

Type IntentOptional Attributes Name
integer(kind=int64), intent(in) :: master_seed
integer(kind=default_int), intent(in) :: stream_id
type(pcg32_t), intent(out) :: gen