61 lines
2.2 KiB
Plaintext
61 lines
2.2 KiB
Plaintext
#ifndef __AMSCU_RANDOM1_HPP__
|
|
#define __AMSCU_RANDOM1_HPP__
|
|
|
|
#include <amsculib3/random/amscupcg.cuh>
|
|
#include <amsculib3/random/amsxoroshiro.cuh>
|
|
#include <amsculib3/random/amsculcg.cuh>
|
|
#include <amsculib3/random/amscufhash.cuh>
|
|
|
|
|
|
namespace amscuda
|
|
{
|
|
namespace random
|
|
{
|
|
|
|
typedef xoroshiro::xs64ss_state randstate_t;
|
|
|
|
extern randstate_t global_randstate;
|
|
|
|
//default random number generator functions that wrap one of the generators
|
|
//defined in the prefix libraries. Choosing xoroshiro64** for now due to
|
|
//only 32 bit operations being needed.
|
|
|
|
__host__ void rand_seed(const uint32_t seed);
|
|
|
|
__host__ __device__ void rand_state_increment(const int32_t inc, randstate_t *state = NULL);
|
|
|
|
__host__ __device__ void rand_next(randstate_t *state = NULL);
|
|
__host__ __device__ uint32_t randui32(randstate_t *state = NULL);
|
|
__host__ __device__ int randint(int low, int high, randstate_t *state = NULL);
|
|
__host__ __device__ float randf(randstate_t *state = NULL);
|
|
__host__ __device__ double rand(randstate_t *state = NULL);
|
|
|
|
__host__ __device__ float randnf(randstate_t *state = NULL);
|
|
__host__ __device__ double randn(randstate_t *state = NULL);
|
|
|
|
//Operations to fill a host buffer with random values
|
|
__host__ int hbuff_randf(float *hbuffer, int size, randstate_t *state = NULL);
|
|
__host__ int hbuff_rand(double *hbuffer, int size, randstate_t *state = NULL);
|
|
__host__ int hbuff_randnf(float *hbuffer, int size, randstate_t *state = NULL);
|
|
__host__ int hbuff_randn(double *hbuffer, int size, randstate_t *state = NULL);
|
|
__host__ int hbuff_randint(int *hbuffer, int size, int low, int high, randstate_t *state = NULL);
|
|
|
|
//Operations to fill a device buffer with random values
|
|
__host__ int dbuff_randf(float *dbuffer, int size, randstate_t *state = NULL);
|
|
__host__ int dbuff_rand(double *dbuffer, int size, randstate_t *state = NULL);
|
|
__host__ int dbuff_randnf(float *dbuffer, int size, randstate_t *state = NULL);
|
|
__host__ int dbuff_randn(double *dbuffer, int size, randstate_t *state = NULL);
|
|
__host__ int dbuff_randint(int *dbuffer, int size, int low, int high, randstate_t *state = NULL);
|
|
|
|
|
|
//Tests
|
|
__host__ void amscurand_tests1(); //test basic random functions
|
|
__host__ void amscurand_tests2(); //test basic random functions
|
|
|
|
|
|
};
|
|
};
|
|
|
|
#endif
|
|
|