![]() |
GHOST
1.1.2
General, Hybrid, and Optimized Sparse Toolkit
|
#include "ghost/config.h"
#include "ghost/types.h"
#include "ghost/util.h"
#include "ghost/timing.h"
#include "ghost/rand.h"
#include "ghost/machine.h"
#include "ghost/omp.h"
#include "ghost/locality.h"
#include "ghost/core.h"
Functions | |
ghost_error | ghost_rand_create () |
Create a random seed for each PU of the machine. More... | |
ghost_error | ghost_rand_get (unsigned int **s) |
Get a random state for the calling thread. More... | |
ghost_error | ghost_rand_seed (ghost_rand_seed_type which, unsigned int seed) |
Set the random number seed. More... | |
bool | ghost_rand_customseed () |
Check whether a custom seed has been set. More... | |
void | ghost_rand_destroy () |
Destroy the random states. More... | |
int | ghost_rand_cu_seed_get () |
Get the CUDA random seed. More... | |
Variables | |
static unsigned int * | ghost_rand_states =NULL |
static int | nrand = 0 |
static unsigned int | cu_seed = 0 |
static bool | customseed = false |
ghost_error ghost_rand_create | ( | ) |
Create a random seed for each PU of the machine.
This assumes that there at most as many OpenMP threads as there are PUs.
int ghost_rand_cu_seed_get | ( | ) |
Get the CUDA random seed.
bool ghost_rand_customseed | ( | ) |
Check whether a custom seed has been set.
void ghost_rand_destroy | ( | ) |
Destroy the random states.
ghost_error ghost_rand_get | ( | unsigned int ** | s | ) |
Get a random state for the calling thread.
s | Where to store the state. |
The random state is determined from the calling OpenMP thread index. OpenMP do not have to be pinned in order to return correct random seeds. This function is used for thread-safe random number generation.
ghost_error ghost_rand_seed | ( | ghost_rand_seed_type | which, |
unsigned int | seed | ||
) |
Set the random number seed.
which | Which components of the seed should be set. Components can be combined with OR. |
seed | The value to which the component should be set. |
The random number seed used by GHOST is a combination of the time, the rank and the PU. Each of those components can be set individually with this function. This assumes that there at most as many OpenMP threads as there are PUs. It is not possible to set the PU seed on CUDA devices.
|
static |
|
static |
|
static |
|
static |