CUDPP 1.1
|
CUDPP application-level rand routine for MD5. More...
#include "cudpp.h"
#include "cudpp_util.h"
#include "cudpp_plan.h"
#include <cutil.h>
#include <cstdlib>
#include <cstdio>
#include <assert.h>
#include "cta/rand_cta.cu"
#include "kernel/rand_kernel.cu"
Functions | |
Rand Functions | |
void | launchRandMD5Kernel (unsigned int *d_out, unsigned int seed, size_t numElements) |
Launches the MD5 Random number generator kernel. | |
void | cudppRandDispatch (void *d_out, size_t numElements, const CUDPPRandPlan *plan) |
Dispatches the rand function based on the plan. |
CUDPP application-level rand routine for MD5.
rand_md5_app.cu
void launchRandMD5Kernel | ( | unsigned int * | d_out, |
unsigned int | seed, | ||
size_t | numElements | ||
) |
Launches the MD5 Random number generator kernel.
The MD5 Random number generator works by generating 128 bit digests which are then broken down into 32 bit chunks and stored inside d_out. d_out is expected to be of type unsigned int and can hold numElements elements.
An analysis of the stastical distribution of the MD5 random number generator can be found in the original paper Parallel white noise generation on a GPU via cryptographic hash. The optimizations mentioned in the paper are also present in the CUDPP version of the MD5 Random number generator.
It is also worth pointing out that the GPU version will not generate the same output * as the CPU version. This is due to the difference in the floating point accuracy and several optimizations that have been used (i.e. calculating sin using device hardware rather than storing it in an array that the original implementation does). However, the distribution of the numbers is well suited for random number generation, even without the CPU-GPU invariance.
[out] | d_out | the array of unsigned integers allocated on device memory |
[in] | seed | the random seed used to vary the output |
[in] | numElements | the number of elements in d_out |
void cudppRandDispatch | ( | void * | d_out, |
size_t | numElements, | ||
const CUDPPRandPlan * | plan | ||
) |
Dispatches the rand function based on the plan.
This is the dispatch call which looks at the algorithm specified in plan and calls the appropriate random number generation algorithm.
[out] | d_out | the array allocated on device memory where the random numbers will be stored must be of type unsigned int |
[in] | numElements | the number of elements in the array d_out |
[in] | plan | pointer to CUDPPRandPlan which contains the algorithm to run |