Advanced Multi-Physics (AMP)
On-Line Documentation
Public Types | Static Public Member Functions | Private Member Functions | List of all members
AMP::GPUFunctionTable< TYPE > Class Template Reference

#include <GPUFunctionTable.h>

Public Types

template<class TYPE2 >
using cloneTo = GPUFunctionTable< TYPE2 >
 
template<class TYPE2 >
using cloneTo = GPUFunctionTable< TYPE2 >
 
typedef TYPE value_type
 
typedef TYPE value_type
 

Static Public Member Functions

static void axpby (TYPE alpha, size_t N, const TYPE *x, TYPE beta, TYPE *y)
 
static void axpby (TYPE alpha, size_t N, const TYPE *x, TYPE beta, TYPE *y)
 
static void axpy (TYPE alpha, size_t N, const TYPE *x, TYPE *y)
 
static void axpy (TYPE alpha, size_t N, const TYPE *x, TYPE *y)
 
static bool equals (size_t N, const TYPE *A, const TYPE *B, TYPE tol)
 
static bool equals (size_t N, const TYPE *A, const TYPE *B, TYPE tol)
 
static TYPE max (size_t N, const TYPE *x)
 
static TYPE max (size_t N, const TYPE *x)
 
static TYPE min (size_t N, const TYPE *x)
 
static TYPE min (size_t N, const TYPE *x)
 
static void multiply (const ArraySize &sa, const TYPE *a, const ArraySize &sb, const TYPE *b, const ArraySize &sc, TYPE *c)
 
static void multiply (const ArraySize &sa, const TYPE *a, const ArraySize &sb, const TYPE *b, const ArraySize &sc, TYPE *c)
 
static void mx (size_t N, const TYPE *x, TYPE *y)
 
static void mx (size_t N, const TYPE *x, TYPE *y)
 
static void mx (size_t N, TYPE x, TYPE *y)
 
static void mx (size_t N, TYPE x, TYPE *y)
 
static void px (size_t N, const TYPE *x, TYPE *y)
 
static void px (size_t N, const TYPE *x, TYPE *y)
 
static void px (size_t N, TYPE x, TYPE *y)
 
static void px (size_t N, TYPE x, TYPE *y)
 
static void rand (size_t N, TYPE *x)
 
static void rand (size_t N, TYPE *x)
 
template<typename LAMBDA >
static TYPE reduce (LAMBDA &op, size_t N, const TYPE *A, const TYPE *B, TYPE initialValue)
 
template<typename LAMBDA >
static TYPE reduce (LAMBDA &op, size_t N, const TYPE *A, const TYPE *B, TYPE initialValue)
 
template<typename LAMBDA >
static TYPE reduce (LAMBDA &op, size_t N, const TYPE *A, TYPE initialValue)
 
template<typename LAMBDA >
static TYPE reduce (LAMBDA &op, size_t N, const TYPE *A, TYPE initialValue)
 
static void scale (size_t N, TYPE x, TYPE *y)
 
static void scale (size_t N, TYPE x, TYPE *y)
 
static TYPE sum (size_t N, const TYPE *x)
 
static TYPE sum (size_t N, const TYPE *x)
 
template<typename LAMBDA >
static void transform (LAMBDA &fun, size_t N, const TYPE *x, const TYPE *y, TYPE *z)
 
template<typename LAMBDA >
static void transform (LAMBDA &fun, size_t N, const TYPE *x, const TYPE *y, TYPE *z)
 
template<typename LAMBDA >
static void transform (LAMBDA &fun, size_t N, const TYPE *x, TYPE *y)
 
template<typename LAMBDA >
static void transform (LAMBDA &fun, size_t N, const TYPE *x, TYPE *y)
 
static void transformAbs (size_t N, const TYPE *A, TYPE *B)
 
static void transformAbs (size_t N, const TYPE *A, TYPE *B)
 
static void transformHardTanh (size_t N, const TYPE *A, TYPE *B)
 
static void transformHardTanh (size_t N, const TYPE *A, TYPE *B)
 
static void transformReLU (size_t N, const TYPE *A, TYPE *B)
 
static void transformReLU (size_t N, const TYPE *A, TYPE *B)
 
static void transformSigmoid (size_t N, const TYPE *A, TYPE *B)
 
static void transformSigmoid (size_t N, const TYPE *A, TYPE *B)
 
static void transformSoftPlus (size_t N, const TYPE *A, TYPE *B)
 
static void transformSoftPlus (size_t N, const TYPE *A, TYPE *B)
 
static void transformTanh (size_t N, const TYPE *A, TYPE *B)
 
static void transformTanh (size_t N, const TYPE *A, TYPE *B)
 

Private Member Functions

 GPUFunctionTable ()=delete
 
 GPUFunctionTable ()=delete
 

Detailed Description

template<class TYPE>
class AMP::GPUFunctionTable< TYPE >

Class GPUFunctionTable is an accelerated function table class that defines a series of operations that can be performed on the Array class. The class implements the same interface as the serial FunctionTable class Meant to be used with a GPU Allocator class.

Definition at line 20 of file GPUFunctionTable.h.

Member Typedef Documentation

◆ cloneTo [1/2]

template<class TYPE >
template<class TYPE2 >
using AMP::GPUFunctionTable< TYPE >::cloneTo = GPUFunctionTable<TYPE2>

Definition at line 25 of file GPUFunctionTable.h.

◆ cloneTo [2/2]

template<class TYPE >
template<class TYPE2 >
using AMP::GPUFunctionTable< TYPE >::cloneTo = GPUFunctionTable<TYPE2>

Definition at line 25 of file GPUFunctionTable.h.

◆ value_type [1/2]

template<class TYPE >
typedef TYPE AMP::GPUFunctionTable< TYPE >::value_type

Definition at line 23 of file GPUFunctionTable.h.

◆ value_type [2/2]

template<class TYPE >
typedef TYPE AMP::GPUFunctionTable< TYPE >::value_type

Definition at line 23 of file GPUFunctionTable.h.

Constructor & Destructor Documentation

◆ GPUFunctionTable() [1/2]

template<class TYPE >
AMP::GPUFunctionTable< TYPE >::GPUFunctionTable ( )
privatedelete

◆ GPUFunctionTable() [2/2]

template<class TYPE >
AMP::GPUFunctionTable< TYPE >::GPUFunctionTable ( )
privatedelete

Member Function Documentation

◆ axpby() [1/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::axpby ( TYPE  alpha,
size_t  N,
const TYPE *  x,
TYPE  beta,
TYPE *  y 
)
static

Perform axpby equavalent operation ( y = alpha*x + beta*y )

Parameters
[in]alphaThe scalar value alpha
[in]NThe length of the array
[in]xThe input array x
[in]betaThe scalar value alpha
[in,out]yThe output array y

◆ axpby() [2/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::axpby ( TYPE  alpha,
size_t  N,
const TYPE *  x,
TYPE  beta,
TYPE *  y 
)
static

Perform axpby equavalent operation ( y = alpha*x + beta*y )

Parameters
[in]alphaThe scalar value alpha
[in]NThe length of the array
[in]xThe input array x
[in]betaThe scalar value alpha
[in,out]yThe output array y

◆ axpy() [1/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::axpy ( TYPE  alpha,
size_t  N,
const TYPE *  x,
TYPE *  y 
)
static

Perform axpy equavalent operation ( y = alpha*x + y )

Parameters
[in]alphaThe scalar value alpha
[in]NThe length of the array
[in]xThe input array x
[in,out]yThe output array y

◆ axpy() [2/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::axpy ( TYPE  alpha,
size_t  N,
const TYPE *  x,
TYPE *  y 
)
static

Perform axpy equavalent operation ( y = alpha*x + y )

Parameters
[in]alphaThe scalar value alpha
[in]NThe length of the array
[in]xThe input array x
[in,out]yThe output array y

◆ equals() [1/2]

template<class TYPE >
static bool AMP::GPUFunctionTable< TYPE >::equals ( size_t  N,
const TYPE *  A,
const TYPE *  B,
TYPE  tol 
)
static

Check if two arrays are approximately equal

Parameters
[in]NThe length of the array
[in]AThe first array
[in]BThe second array
[in]tolThe tolerance

◆ equals() [2/2]

template<class TYPE >
static bool AMP::GPUFunctionTable< TYPE >::equals ( size_t  N,
const TYPE *  A,
const TYPE *  B,
TYPE  tol 
)
static

Check if two arrays are approximately equal

Parameters
[in]NThe length of the array
[in]AThe first array
[in]BThe second array
[in]tolThe tolerance

◆ max() [1/2]

template<class TYPE >
static TYPE AMP::GPUFunctionTable< TYPE >::max ( size_t  N,
const TYPE *  x 
)
static

Return the maximum value

Parameters
[in]NThe length of the array
[in]xThe first array

◆ max() [2/2]

template<class TYPE >
static TYPE AMP::GPUFunctionTable< TYPE >::max ( size_t  N,
const TYPE *  x 
)
static

Return the maximum value

Parameters
[in]NThe length of the array
[in]xThe first array

◆ min() [1/2]

template<class TYPE >
static TYPE AMP::GPUFunctionTable< TYPE >::min ( size_t  N,
const TYPE *  x 
)
static

Return the minimum value

Parameters
[in]NThe length of the array
[in]xThe first array

◆ min() [2/2]

template<class TYPE >
static TYPE AMP::GPUFunctionTable< TYPE >::min ( size_t  N,
const TYPE *  x 
)
static

Return the minimum value

Parameters
[in]NThe length of the array
[in]xThe first array

◆ multiply() [1/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::multiply ( const ArraySize sa,
const TYPE *  a,
const ArraySize sb,
const TYPE *  b,
const ArraySize sc,
TYPE *  c 
)
static

Multiply two arrays

Parameters
[in]saThe size of the a array
[in]aThe first array
[in]sbThe size of the b array
[in]bThe second array
[in]scThe size of the c array
[out]cThe output array

◆ multiply() [2/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::multiply ( const ArraySize sa,
const TYPE *  a,
const ArraySize sb,
const TYPE *  b,
const ArraySize sc,
TYPE *  c 
)
static

Multiply two arrays

Parameters
[in]saThe size of the a array
[in]aThe first array
[in]sbThe size of the b array
[in]bThe second array
[in]scThe size of the c array
[out]cThe output array

◆ mx() [1/4]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::mx ( size_t  N,
const TYPE *  x,
TYPE *  y 
)
static

Perform subtraction operation ( y += x )

Parameters
[in]xThe scalar value alpha
[in]NThe length of the array
[in,out]yThe output array y

◆ mx() [2/4]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::mx ( size_t  N,
const TYPE *  x,
TYPE *  y 
)
static

Perform subtraction operation ( y += x )

Parameters
[in]xThe scalar value alpha
[in]NThe length of the array
[in,out]yThe output array y

◆ mx() [3/4]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::mx ( size_t  N,
TYPE  x,
TYPE *  y 
)
static

Perform subtraction operation ( y += x )

Parameters
[in]NThe length of the array
[in]xThe scalar value alpha
[in,out]yThe output array y

◆ mx() [4/4]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::mx ( size_t  N,
TYPE  x,
TYPE *  y 
)
static

Perform subtraction operation ( y += x )

Parameters
[in]NThe length of the array
[in]xThe scalar value alpha
[in,out]yThe output array y

◆ px() [1/4]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::px ( size_t  N,
const TYPE *  x,
TYPE *  y 
)
static

Perform addition operation ( y += x )

Parameters
[in]NThe length of the array
[in]xThe scalar value alpha
[in,out]yThe output array y

◆ px() [2/4]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::px ( size_t  N,
const TYPE *  x,
TYPE *  y 
)
static

Perform addition operation ( y += x )

Parameters
[in]NThe length of the array
[in]xThe scalar value alpha
[in,out]yThe output array y

◆ px() [3/4]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::px ( size_t  N,
TYPE  x,
TYPE *  y 
)
static

Perform addition operation ( y += x )

Parameters
[in]NThe length of the array
[in]xThe scalar value alpha
[in,out]yThe output array y

◆ px() [4/4]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::px ( size_t  N,
TYPE  x,
TYPE *  y 
)
static

Perform addition operation ( y += x )

Parameters
[in]NThe length of the array
[in]xThe scalar value alpha
[in,out]yThe output array y

◆ rand() [1/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::rand ( size_t  N,
TYPE *  x 
)
static

Initialize the array with random values

Parameters
[in]NThe length of the array
[in]xThe array to operate on

◆ rand() [2/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::rand ( size_t  N,
TYPE *  x 
)
static

Initialize the array with random values

Parameters
[in]NThe length of the array
[in]xThe array to operate on

◆ reduce() [1/4]

template<class TYPE >
template<typename LAMBDA >
static TYPE AMP::GPUFunctionTable< TYPE >::reduce ( LAMBDA &  op,
size_t  N,
const TYPE *  A,
const TYPE *  B,
TYPE  initialValue 
)
inlinestatic

Perform a reduce operator z = f(x,y)

Parameters
[in]opThe function operation Note: the operator is a template parameter to improve performance
[in]NThe length of the array
[in]AThe first array to operate on
[in]BThe second array to operate on
[in]initialValueThe initial value for the reduction (0 for sum, +/- inf for min/max)
Returns
The reduction

Definition at line 61 of file GPUFunctionTable.h.

References AMP_ERROR.

◆ reduce() [2/4]

template<class TYPE >
template<typename LAMBDA >
static TYPE AMP::GPUFunctionTable< TYPE >::reduce ( LAMBDA &  op,
size_t  N,
const TYPE *  A,
const TYPE *  B,
TYPE  initialValue 
)
inlinestatic

Perform a reduce operator z = f(x,y)

Parameters
[in]opThe function operation Note: the operator is a template parameter to improve performance
[in]NThe length of the array
[in]AThe first array to operate on
[in]BThe second array to operate on
[in]initialValueThe initial value for the reduction (0 for sum, +/- inf for min/max)
Returns
The reduction

Definition at line 61 of file GPUFunctionTable.h.

References AMP_ERROR.

◆ reduce() [3/4]

template<class TYPE >
template<typename LAMBDA >
static TYPE AMP::GPUFunctionTable< TYPE >::reduce ( LAMBDA &  op,
size_t  N,
const TYPE *  A,
TYPE  initialValue 
)
inlinestatic

Perform a reduce operator y = f(x)

Parameters
[in]opThe function operation Note: the operator is a template parameter to improve performance
[in]NThe length of the array
[in]AThe array to operate on
[in]initialValueThe initial value for the reduction (0 for sum, +/- inf for min/max)
Returns
The reduction

Definition at line 45 of file GPUFunctionTable.h.

References AMP_ERROR.

◆ reduce() [4/4]

template<class TYPE >
template<typename LAMBDA >
static TYPE AMP::GPUFunctionTable< TYPE >::reduce ( LAMBDA &  op,
size_t  N,
const TYPE *  A,
TYPE  initialValue 
)
inlinestatic

Perform a reduce operator y = f(x)

Parameters
[in]opThe function operation Note: the operator is a template parameter to improve performance
[in]NThe length of the array
[in]AThe array to operate on
[in]initialValueThe initial value for the reduction (0 for sum, +/- inf for min/max)
Returns
The reduction

Definition at line 45 of file GPUFunctionTable.h.

References AMP_ERROR.

◆ scale() [1/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::scale ( size_t  N,
TYPE  x,
TYPE *  y 
)
static

Perform addition operation ( y *= x )

Parameters
[in]NThe length of the array
[in]xThe scalar value alpha
[in,out]yThe output array y

◆ scale() [2/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::scale ( size_t  N,
TYPE  x,
TYPE *  y 
)
static

Perform addition operation ( y *= x )

Parameters
[in]NThe length of the array
[in]xThe scalar value alpha
[in,out]yThe output array y

◆ sum() [1/2]

template<class TYPE >
static TYPE AMP::GPUFunctionTable< TYPE >::sum ( size_t  N,
const TYPE *  x 
)
static

Return the sum

Parameters
[in]NThe length of the array
[in]xThe first array

◆ sum() [2/2]

template<class TYPE >
static TYPE AMP::GPUFunctionTable< TYPE >::sum ( size_t  N,
const TYPE *  x 
)
static

Return the sum

Parameters
[in]NThe length of the array
[in]xThe first array

◆ transform() [1/4]

template<class TYPE >
template<typename LAMBDA >
static void AMP::GPUFunctionTable< TYPE >::transform ( LAMBDA &  fun,
size_t  N,
const TYPE *  x,
const TYPE *  y,
TYPE *  z 
)
inlinestatic

Perform a element-wise operation z = f(x,y)

Parameters
[in]funThe function operation Note: the function is a template parameter to improve performance
[in]NThe length of the array
[in]xThe first array
[in]yThe second array
[out]zThe output array

Definition at line 90 of file GPUFunctionTable.h.

References AMP_ERROR.

◆ transform() [2/4]

template<class TYPE >
template<typename LAMBDA >
static void AMP::GPUFunctionTable< TYPE >::transform ( LAMBDA &  fun,
size_t  N,
const TYPE *  x,
const TYPE *  y,
TYPE *  z 
)
inlinestatic

Perform a element-wise operation z = f(x,y)

Parameters
[in]funThe function operation Note: the function is a template parameter to improve performance
[in]NThe length of the array
[in]xThe first array
[in]yThe second array
[out]zThe output array

Definition at line 90 of file GPUFunctionTable.h.

References AMP_ERROR.

◆ transform() [3/4]

template<class TYPE >
template<typename LAMBDA >
static void AMP::GPUFunctionTable< TYPE >::transform ( LAMBDA &  fun,
size_t  N,
const TYPE *  x,
TYPE *  y 
)
inlinestatic

Perform a element-wise operation y = f(x)

Parameters
[in]funThe function operation Note: the function is a template parameter to improve performance
[in]NThe length of the array
[in,out]xThe array to operate on
[out]yThe output array

Definition at line 75 of file GPUFunctionTable.h.

References AMP_ERROR.

◆ transform() [4/4]

template<class TYPE >
template<typename LAMBDA >
static void AMP::GPUFunctionTable< TYPE >::transform ( LAMBDA &  fun,
size_t  N,
const TYPE *  x,
TYPE *  y 
)
inlinestatic

Perform a element-wise operation y = f(x)

Parameters
[in]funThe function operation Note: the function is a template parameter to improve performance
[in]NThe length of the array
[in,out]xThe array to operate on
[out]yThe output array

Definition at line 75 of file GPUFunctionTable.h.

References AMP_ERROR.

◆ transformAbs() [1/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::transformAbs ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = |A|

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

◆ transformAbs() [2/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::transformAbs ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = |A|

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

◆ transformHardTanh() [1/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::transformHardTanh ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = max(-1 , min(1 , A) )

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

◆ transformHardTanh() [2/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::transformHardTanh ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = max(-1 , min(1 , A) )

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

◆ transformReLU() [1/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::transformReLU ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation y = max(x , 0)

Parameters
[in]NThe length of the array
[in]AThe input array
[out]BThe output array

◆ transformReLU() [2/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::transformReLU ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation y = max(x , 0)

Parameters
[in]NThe length of the array
[in]AThe input array
[out]BThe output array

◆ transformSigmoid() [1/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::transformSigmoid ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = 1 / (1 + exp(-A))

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

◆ transformSigmoid() [2/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::transformSigmoid ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = 1 / (1 + exp(-A))

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

◆ transformSoftPlus() [1/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::transformSoftPlus ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = log(exp(A) + 1)

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

◆ transformSoftPlus() [2/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::transformSoftPlus ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = log(exp(A) + 1)

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

◆ transformTanh() [1/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::transformTanh ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = tanh(A)

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

◆ transformTanh() [2/2]

template<class TYPE >
static void AMP::GPUFunctionTable< TYPE >::transformTanh ( size_t  N,
const TYPE *  A,
TYPE *  B 
)
static

Perform a element-wise operation B = tanh(A)

Parameters
[in]NThe length of the array
[in]AThe array to operate on
[out]BThe output array

The documentation for this class was generated from the following files:



Advanced Multi-Physics (AMP)
Oak Ridge National Laboratory
Idaho National Laboratory
Los Alamos National Laboratory
This page automatically produced from the
source code by doxygen
Last updated: Tue Mar 10 2026 13:06:42.
Comments on this page