Developer Reference for Intel® oneAPI Math Kernel Library for Fortran

ID 766686
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

vslSkipAheadStreamEx

Initializes a stream using the block-splitting method with partitioned number of skipped elements.

Syntax

status = vslskipAheadstreamEx( stream, n, nskip )

Include Files

  • mkl.fi, mkl_vsl.f90

Input Parameters

Name

Type

Description

stream

TYPE(VSL_STREAM_STATE), INTENT(IN)

Pointer to the stream state structure to which block-splitting method is applied

n

INTEGER, INTENT(IN)

Number of summands in nskip

nskip

INTEGER(KIND=8), INTENT(IN)

Partitioned number of skipped elements

Description

The vslSkipAheadStreamEx function skips a given number of elements in a random stream. This feature is particularly useful in distributing random numbers from original random stream across different computational nodes. If the largest number of random numbers used by a computational node is nskip, then the original random sequence may be split by vslSkipAheadStreamEx into non-overlapping blocks of nskip size so that each block corresponds to the respective computational node. The number of computational nodes is unlimited. This method is known as the block-splitting method or as the skip-ahead method.

Use this function when the number of elements to skip in a random stream is greater than 263. Prior calls to the function represent the number of skipped elements with array of size n as shown below:

nskip[0]+ nskip[1]*264+nskip[2]* 2128+ … +nskip[n-1]*2(64*(n-1) );

When the number of skipped elements is less than 263 you can use either vslSkipAheadtreamEx or vslSkipAheadStream. The following code illustrates how to initialize three independent streams using the vslSkipAheadStreamEx function:

...
type(VSL_STREAM_STATE) ::stream1 type(VSL_STREAM_STATE) ::stream2 type(VSL_STREAM_STATE) ::stream3

! Creating the 1st stream
status = vslnewstream(stream1, VSL_BRNG_MRG32K3A, 174)

! To skip 2^64 elements in the random stream skipaheadstreamEx(nskip) function should !	be called with nskip represented as nskip = 2^64 = 0 + 1 * 2^64
integer(kind=8) nskip(2) 
nskip(1) = 0
nskip(2) = 1

! Skipping ahead by 2^64 elements the 2nd stream
status = vslcopystream(stream2, stream1)
status = vslskipaheadstreamex (stream2, 2, nskip)

! Skipping ahead by 2^64 elements the 3rd stream
status = vslcopystream(stream3, stream2)
status = vslskipaheadstreamex (stream3, 2, nskip)

! Generating random numbers
...

! Deleting the streams
status = vsldeletestream(stream1)
status = vsldeletestream(stream2)
status = vsldeletestream(stream3)
...

Return Values

VSL_ERROR_OK, VSL_STATUS_OK

Indicates no error, execution is successful.

VSL_ERROR_NULL_PTR

stream is a NULL pointer.

VSL_RNG_ERROR_BAD_STREAM

stream is not a valid random stream.

VSL_RNG_ERROR_SKIPAHEADEX_UNSUPPORTED

BRNG does not support the advanced Skip-Ahead method.