## Developer Reference

Contents

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

## Syntax

Include Files
• mkl.h
Input Parameters
Name
Type
Description
stream
VSLStreamStatePtr
Pointer to the stream state structure to which block-splitting method is applied
n
const MKL_INT
Number of summands in
nskip
nskip
const MKL_UINT64[]
Partitioned number of skipped elements
Description
The
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
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. See Notes for Intel® MKL Vector Statisticsfor more details.
Use this function when the number of elements to skip in a random stream is greater than 2
63
. Prior calls to the function represent the number of skipped elements with array of size
n
as shown below:
nskip
[0]+
nskip
[1]*2
64
+
nskip
[2]* 2
128
+ … +
nskip
[n-1]*2
(64*(n-1) )
;
When the number of skipped elements is less than 2
63
you can use either
or
. The following code illustrates how to initialize three independent streams using the
function:
```VSLStreamStatePtr stream1; VSLStreamStatePtr stream2; VSLStreamStatePtr stream3;

/* Creating the 1st stream
*/
status = vslNewStream(&stream1, VSL_BRNG_MCG31, 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
*/
MKL_UINT64 nskip[2];
nskip[0]=0;
nskip[1]=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.