clRNG
An OpenCL library for random number generators (RNG)
 All Data Structures Files Functions Typedefs Enumerations Pages
clRNG_template.h
Go to the documentation of this file.
1 #pragma once
2 #ifndef CLRNG_TEMPLATE_H
3 #define CLRNG_TEMPLATE_H
4 
5 #error This file is a template for specific RNG implementations; it should not be included as is. Use an RNG-specific header such as mrg31k3p.h instead.
6 
7 #include <clRNG.h>
8 
9 /* for FILE in clrngWriteStreamInfo() */
10 #include <stdio.h>
11 
12 
204 typedef struct { /* ... */ } clrngStreamState;
205 
206 
223 typedef struct { /* ... */ } clrngStream;
224 
225 
231 typedef struct { /* ... */ } clrngHostStream;
232 
233 
245 typedef struct { /* ... */ } clrngStreamCreator;
246 
247 
248 #ifdef __cplusplus
249 extern "C" {
250 #endif
251 
252 
277 
278 
287 
297 
315 
316 
336 clrngStatus clrngChangeStreamsSpacing(clrngStreamCreator* creator, cl_int e, cl_int c);
337 
338 
362 clrngStream* clrngAllocStreams(size_t count, size_t* bufSize, clrngStatus* err);
363 
364 
373 
374 
393 clrngStream* clrngCreateStreams(clrngStreamCreator* creator, size_t count, size_t* bufSize, clrngStatus* err);
394 
395 
414 clrngStatus clrngCreateOverStreams(clrngStreamCreator* creator, size_t count, clrngStream* streams);
415 
416 
431 clrngStream* clrngCopyStreams(size_t count, const clrngStream* streams, clrngStatus* err);
432 
433 
460 clrngStatus clrngCopyOverStreams(size_t count, clrngStream* destStreams, const clrngStream* srcStreams);
461 
462 
476 clrngStatus clrngCopyOverStreamsFromGlobal(size_t count, clrngStream* destStreams, const clrngHostStream* srcStreams);
477 
478 
489 clrngStatus clrngCopyOverStreamsToGlobal(size_t count, clrngHostStream* destStreams, const clrngStream* srcStreams);
490 
491 
519 cl_double clrngRandomU01(clrngStream* stream);
520 
521 
534 cl_int clrngRandomInteger(clrngStream* stream, cl_int i, cl_int j);
535 
536 
550 clrngStatus clrngRandomU01Array(clrngStream* stream, size_t count, cl_double* buffer);
551 
552 
565 clrngStatus clrngRandomIntegerArray(clrngStream* stream, cl_int i, cl_int j, size_t count, cl_int* buffer);
566 
567 
589 clrngStatus clrngRewindStreams(size_t count, clrngStream* streams);
590 
591 
606 clrngStatus clrngRewindSubstreams(size_t count, clrngStream* streams);
607 
608 
624 
625 
639 clrngStream* clrngMakeSubstreams(clrngStream* stream, size_t count, size_t* bufSize, clrngStatus* err);
640 
641 
652 clrngStatus clrngMakeOverSubstreams(clrngStream* stream, size_t count, clrngStream* substreams);
653 
654 
678 clrngStatus clrngAdvanceStreams(size_t count, clrngStream* streams, cl_int e, cl_int c);
679 
680 
759 clrngStatus clrngDeviceRandomU01Array(size_t streamCount, cl_mem streams,
760  size_t numberCount, cl_mem outBuffer, cl_uint numQueuesAndEvents,
761  cl_command_queue* commQueues, cl_uint numWaitEvents,
762  const cl_event* waitEvents, cl_event* outEvents);
763 
764 
779 clrngStatus clrngWriteStreamInfo(const clrngStream* stream, FILE *file);
780 
781 
785 #ifdef __cplusplus
786 }
787 #endif
788 
789 /*
790  * vim: syntax=c.doxygen spell spelllang=en fdm=syntax fdl=1
791  */
792 
793 #endif
clrngStream * clrngCopyStreams(size_t count, const clrngStream *streams, clrngStatus *err)
Clone RNG stream objects.
Library definitions common to all RNG's.
clrngStatus clrngDestroyStreams(clrngStream *streams)
Destroy one or many stream objects.
cl_double clrngRandomU01(clrngStream *stream)
Generate the next random value in (0,1) [device].
clrngStatus clrngMakeOverSubstreams(clrngStream *stream, size_t count, clrngStream *substreams)
Make an array of substreams of a stream.
enum clrngStatus_ clrngStatus
Error codes.
clrngStream * clrngCreateStreams(clrngStreamCreator *creator, size_t count, size_t *bufSize, clrngStatus *err)
Allocate memory for and create new RNG stream objects.
Stream creator object.
Definition: clRNG_template.h:245
clrngStatus clrngRandomU01Array(clrngStream *stream, size_t count, cl_double *buffer)
Fill an array with successive random values in (0,1) [device].
Stream object [device].
Definition: clRNG_template.h:223
clrngStatus clrngCopyOverStreamsFromGlobal(size_t count, clrngStream *destStreams, const clrngHostStream *srcStreams)
Copy RNG host stream objects from global memory into private memory [device-only].
Host stream object [device-only].
Definition: clRNG_template.h:231
clrngStatus clrngDeviceRandomU01Array(size_t streamCount, cl_mem streams, size_t numberCount, cl_mem outBuffer, cl_uint numQueuesAndEvents, cl_command_queue *commQueues, cl_uint numWaitEvents, const cl_event *waitEvents, cl_event *outEvents)
Fill a buffer of random numbers.
clrngStream * clrngMakeSubstreams(clrngStream *stream, size_t count, size_t *bufSize, clrngStatus *err)
Allocate and make an array of substreams of a stream.
clrngStatus clrngRewindSubstreams(size_t count, clrngStream *streams)
Reinitialize streams to their initial substream states [device].
clrngStatus clrngCopyOverStreamsToGlobal(size_t count, clrngHostStream *destStreams, const clrngStream *srcStreams)
Copy RNG device stream objects from private memory into global memory [device-only].
clrngStatus clrngSetBaseCreatorState(clrngStreamCreator *creator, const clrngStreamState *baseState)
Change the base stream state of a stream creator.
clrngStatus clrngCopyOverStreams(size_t count, clrngStream *destStreams, const clrngStream *srcStreams)
Copy RNG stream objects in already allocated memory [device].
clrngStream * clrngAllocStreams(size_t count, size_t *bufSize, clrngStatus *err)
Reserve memory for one or more stream objects.
Stream state [device].
Definition: clRNG_template.h:204
clrngStatus clrngForwardToNextSubstreams(size_t count, clrngStream *streams)
Advance streams to the next substreams [device].
clrngStatus clrngWriteStreamInfo(const clrngStream *stream, FILE *file)
Format and output information about a stream object to a file.
clrngStatus clrngRewindStreams(size_t count, clrngStream *streams)
Reinitialize streams to their initial states [device].
clrngStatus clrngChangeStreamsSpacing(clrngStreamCreator *creator, cl_int e, cl_int c)
Change the spacing between successive streams.
clrngStatus clrngDestroyStreamCreator(clrngStreamCreator *creator)
Destroy a stream creator object.
clrngStreamCreator * clrngCopyStreamCreator(const clrngStreamCreator *creator, clrngStatus *err)
Duplicate an existing stream creator object.
clrngStatus clrngCreateOverStreams(clrngStreamCreator *creator, size_t count, clrngStream *streams)
Create new RNG stream objects in already allocated memory.
clrngStatus clrngRewindStreamCreator(clrngStreamCreator *creator)
Reset a stream creator to its original initial state.
clrngStatus clrngAdvanceStreams(size_t count, clrngStream *streams, cl_int e, cl_int c)
Advance the state of streams by many steps.
cl_int clrngRandomInteger(clrngStream *stream, cl_int i, cl_int j)
Generate the next random integer value [device].
clrngStatus clrngRandomIntegerArray(clrngStream *stream, cl_int i, cl_int j, size_t count, cl_int *buffer)
Fill an array with successive random integer values [device].