Skip to content

Commit

Permalink
Current State
Browse files Browse the repository at this point in the history
  • Loading branch information
obilaniu committed Jun 12, 2017
1 parent a0489a1 commit 2c4a3cb
Show file tree
Hide file tree
Showing 3 changed files with 1,309 additions and 695 deletions.
91 changes: 16 additions & 75 deletions src/gpuarray/reduction.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,35 +26,34 @@ extern "C" {
*/

typedef enum _ga_reduce_op {
GA_REDUCE_SUM, /* + */
GA_REDUCE_PROD, /* * */
GA_REDUCE_PRODNZ, /* * (!=0) */
GA_REDUCE_MIN, /* min() */
GA_REDUCE_MAX, /* max() */
GA_REDUCE_ARGMIN, /* argmin() */
GA_REDUCE_ARGMAX, /* argmax() */
GA_REDUCE_MINANDARGMIN, /* min(), argmin() */
GA_REDUCE_MAXANDARGMAX, /* max(), argmax() */
GA_REDUCE_AND, /* & */
GA_REDUCE_OR, /* | */
GA_REDUCE_XOR, /* ^ */
GA_REDUCE_ALL, /* &&/all() */
GA_REDUCE_ANY, /* ||/any() */
GA_REDUCE_SUM, /* + */
GA_REDUCE_PROD, /* * */
GA_REDUCE_PRODNZ, /* * (!=0) */
GA_REDUCE_MIN, /* min() */
GA_REDUCE_MAX, /* max() */
GA_REDUCE_ARGMIN, /* argmin() */
GA_REDUCE_ARGMAX, /* argmax() */
GA_REDUCE_MINANDARGMIN, /* min(), argmin() */
GA_REDUCE_MAXANDARGMAX, /* max(), argmax() */
GA_REDUCE_AND, /* & */
GA_REDUCE_OR, /* | */
GA_REDUCE_XOR, /* ^ */
GA_REDUCE_ALL, /* &&/all() */
GA_REDUCE_ANY, /* ||/any() */
} ga_reduce_op;



/**
* @brief Compute a reduction sum (+), product (*), non-zero product (* != 0),
* min, max, argmin, argmax, min-and-argmin, max-and-argmax, and (&),
* or (|), xor (^), all (&&) or any (||) over a list of axes to reduce.
* @brief Compute a reduction over a list of axes to reduce.
*
* Returns one (in the case of min-and-argmin/max-and-argmax, two) destination
* tensors. The destination tensor(s)' axes are a strict subset of the axes of the
* source tensor. The axes to be reduced are specified by the caller, and the
* reduction is performed over these axes, which are then removed in the
* destination.
*
* @param [in] op The reduction operation to perform.
* @param [out] dst The destination tensor. Has the same type as the source.
* @param [out] dstArg For argument of minima/maxima operations. Has type int64.
* @param [in] src The source tensor.
Expand All @@ -81,64 +80,6 @@ typedef enum _ga_reduce_op {
* code otherwise.
*/

GPUARRAY_PUBLIC int GpuArray_sum (GpuArray* dst,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_prod (GpuArray* dst,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_prodnz (GpuArray* dst,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_min (GpuArray* dst,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_max (GpuArray* dst,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_argmin (GpuArray* dstArg,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_argmax (GpuArray* dstArg,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_minandargmin(GpuArray* dst,
GpuArray* dstArg,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_maxandargmax(GpuArray* dst,
GpuArray* dstArg,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_and (GpuArray* dst,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_or (GpuArray* dst,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_xor (GpuArray* dst,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_all (GpuArray* dst,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_any (GpuArray* dst,
const GpuArray* src,
unsigned reduxLen,
const unsigned* reduxList);
GPUARRAY_PUBLIC int GpuArray_reduction (ga_reduce_op op,
GpuArray* dst,
GpuArray* dstArg,
Expand Down
Loading

0 comments on commit 2c4a3cb

Please sign in to comment.