clQMC
An OpenCL library for quasi-Monte Carlo methods
|
Template of the API for specific quasi-Monte Carlo methods(not to be included as is!) More...
#include <clQMC/clQMC.h>
Go to the source code of this file.
Typedefs | |
typedef struct clqmcPointset_ | clqmcPointset |
Point set object [device]. More... | |
typedef struct clqmcPointsetStream_ | clqmcPointsetStream |
Point set stream object [device]. More... | |
Functions | |
cl_uint | clqmcNumPoints (const clqmcPointset *pointset) |
Return the number of point in the point set [device]. More... | |
cl_uint | clqmcDimension (const clqmcPointset *pointset) |
Return the dimension of the point set [device]. More... | |
clqmcPointset * | clqmcCreate (..., size_t *objectSize, clqmcStatus *err) |
Create a new point set object. More... | |
clqmcStatus | clqmcDestroy (clqmcPointset *pointset) |
Destroy a point set object. More... | |
clqmcStatus | clqmcWriteInfo (const clqmcPointset *pointset, FILE *file) |
Write information about a point set object. More... | |
clqmcPointsetStream * | clqmcCreateStream (const clqmcPointset *pointset, cl_uint partCount, cl_uint partIndex, const double *shift, clqmcStatus *err) |
Attach a new stream to a point set object. More... | |
clqmcStatus | clqmcCreateOverStream (clqmcPointsetStream *stream, const clqmcPointset *pointset, cl_uint partCount, cl_uint partIndex, const RandType *randomization) |
Attach a new stream to a point set object in already allocated memory [device]. More... | |
clqmcStatus | clqmcDestroyStream (clqmcPointsetStream *stream) |
Destroy a stream object. More... | |
double | clqmcNextCoordinate (clqmcPointsetStream *stream) |
Return the value of the next coordinate [device]. More... | |
cl_uint | clqmcNextPoint (clqmcPointsetStream *stream, double *coords) |
Retrieve all coordinates of the next point [device]. More... | |
cl_uint | clqmcForwardToNextPoint (clqmcPointsetStream *stream) |
Advance a stream to the next point [device]. More... | |
cl_uint | clqmcCurrentPointIndex (const clqmcPointsetStream *stream) |
Return the current point index of a stream [device]. More... | |
cl_uint | clqmcCurrentCoordIndex (const clqmcPointsetStream *stream) |
Return the current coordinate index of a stream [device]. More... | |
Template of the API for specific quasi-Monte Carlo methods(not to be included as is!)
The function and type names in this API all start with clqmc
. In each specific implementation, prefixes to function names are expanded to a specific prefix and the generic point set and types clqmcPointset
and clqmcPointsetStream
are replaced with specific point set and stream type, e.g., clqmcLatticeRule and clqmcLatticeRuleStream.
The functions described here are all available on the host, in all implementations, unless specified otherwise. Only some of the functions and types are also available on the device in addition to the host; they are tagged with [device]. Other functions are only available on the device; they are tagged with [device-only]. Some functions return an error code in err
.
typedef struct clqmcPointset_ clqmcPointset |
Point set object [device].
This structure contains data that describes a quasi-Monte Carlo point set. Its definition depends on the type of point set.
typedef struct clqmcPointsetStream_ clqmcPointsetStream |
Point set stream object [device].
This structure contains data that describes a stream associated to a quasi-Monte Carlo point set. Its definition depends on the type of point set.
cl_uint clqmcNumPoints | ( | const clqmcPointset * | pointset | ) |
Return the number of point in the point set [device].
[in] | pointset | A point set object. |
cl_uint clqmcDimension | ( | const clqmcPointset * | pointset | ) |
Return the dimension of the point set [device].
[in] | pointset | A point set object. |
clqmcPointset* clqmcCreate | ( | ..., | |
size_t * | objectSize, | ||
clqmcStatus * | err | ||
) |
Create a new point set object.
Allocate resources for and create a new point set object.
The arguments of this function depend on the specific type of point set.
[out] | objectSize | Size in bytes of the returned object. |
[out] | err | Error status. |
clqmcStatus clqmcDestroy | ( | clqmcPointset * | pointset | ) |
Destroy a point set object.
Release the resources associated to a point set object.
[in] | pointset | Point set object to be destroyed. |
clqmcStatus clqmcWriteInfo | ( | const clqmcPointset * | pointset, |
FILE * | file | ||
) |
Write information about a point set object.
Write a description of a point set object and its properties to the console.
clqmcPointsetStream* clqmcCreateStream | ( | const clqmcPointset * | pointset, |
cl_uint | partCount, | ||
cl_uint | partIndex, | ||
const double * | shift, | ||
clqmcStatus * | err | ||
) |
Attach a new stream to a point set object.
This function allocates resources for a new stream object and calls clqmcCreateOverStream() to actually create the stream object.
clqmcStatus clqmcCreateOverStream | ( | clqmcPointsetStream * | stream, |
const clqmcPointset * | pointset, | ||
cl_uint | partCount, | ||
cl_uint | partIndex, | ||
const RandType * | randomization | ||
) |
Attach a new stream to a point set object in already allocated memory [device].
This function does not allocate memory; it uses already allocated memory to create a stream object.
The point set pointset
is divided into partCount
indexed from 0
to partCount - 1
. The internal structure of the partitioning generally depends on the type of point set.
A randomization is optionally applied. The type of the randomization (written here as RandType
for convenience) depends on the type of point set. For example, for a rank-1 lattice rule, the randomization is a periodic random shift. The argument shift
must be a vector of the same dimension as the lattice.
[out] | stream | Memory location that will hold the new stream object. |
[in] | pointset | Point set object to attach the new stream to. |
[in] | partCount | Number of subsets of equal cardinality into which pointset must be partitioned. |
[in] | partIndex | Index of the subset represented by the new stream object. |
[in] | randomization | Randomization of an appropriate type, or NULL for no randomization. |
clqmcStatus clqmcDestroyStream | ( | clqmcPointsetStream * | stream | ) |
Destroy a stream object.
Release the resources associated to a stream object.
double clqmcNextCoordinate | ( | clqmcPointsetStream * | stream | ) |
Return the value of the next coordinate [device].
Advance the stream to the next coordinate of the current point and return its value. When all coordinates of a point are exhausted, clqmcForwardToNextPoint() should be call to advance the stream to the next point.
[in,out] | stream | Point set stream object. |
-1.0
if no further coordinate is available. cl_uint clqmcNextPoint | ( | clqmcPointsetStream * | stream, |
double * | coords | ||
) |
Retrieve all coordinates of the next point [device].
Advance the stream to the next point and return all its coordinates.
[in,out] | stream | Point set stream object. |
[out] | coords | Coordinates of the point. |
coords
.cl_uint clqmcForwardToNextPoint | ( | clqmcPointsetStream * | stream | ) |
Advance a stream to the next point [device].
Advance the stream to the first coordinate of the next point.
[in,out] | stream | Point set stream object. |
cl_uint clqmcCurrentPointIndex | ( | const clqmcPointsetStream * | stream | ) |
Return the current point index of a stream [device].
[in] | stream | Point set stream object. |
cl_uint clqmcCurrentCoordIndex | ( | const clqmcPointsetStream * | stream | ) |
Return the current coordinate index of a stream [device].
[in] | stream | Point set stream object. |