Tinker9 70bd052 (Thu Nov 9 12:11:35 2023 -0800)
Loading...
Searching...
No Matches
Functions
Parallel Algorithms

Functions

template<class T >
tinker::reduceSum (const T *gpu_a, size_t nelem, int queue)
 Sum over all of the elements of an 1D array. More...
 
template<class HT , size_t HN, class DPTR >
void tinker::reduceSum2 (HT(&h_ans)[HN], DPTR v, size_t nelem, int queue)
 Sum over all of the elements of a 2D array. More...
 
template<class T >
void tinker::reduceSumOnDevice (T *dp_ans, const T *a, size_t nelem, int queue)
 Sum over all of the elements of an 1D array. This routine will save the result on the device memory in an asynchronous/non-blocking manner. A valid device pointer is required for the result on the device. More...
 
template<class HT , size_t HN, class DPTR >
void tinker::reduceSum2OnDevice (HT(&dref)[HN], DPTR v, size_t nelem, int queue)
 Sum over all of the elements of a 2D array. This routine will save the result on the device memory in an asynchronous/non-blocking manner. A valid device array is required for the result on device. More...
 
template<class T >
tinker::dotProd (const T *a, const T *b, size_t nelem, int queue)
 Dot product of two linear arrays. More...
 
template<class T >
void tinker::dotProd (T *ans, const T *a, const T *b, size_t nelem, int queue)
 Dot product of two linear arrays. More...
 
template<class T >
void tinker::scaleArray (T *dst, T scal, size_t nelem, int queue)
 Multiply all of the elements in an 1D array by a scalar. More...
 

Detailed Description

Function Documentation

◆ dotProd() [1/2]

template<class T >
T tinker::dotProd ( const T *  a,
const T *  b,
size_t  nelem,
int  queue 
)

Dot product of two linear arrays.

\[ DotProduct = \sum_i^n a_i \cdot b_i \]

Returns
The dot product to the host thread.

◆ dotProd() [2/2]

template<class T >
void tinker::dotProd ( T *  ans,
const T *  a,
const T *  b,
size_t  nelem,
int  queue 
)

Dot product of two linear arrays.

◆ reduceSum()

template<class T >
T tinker::reduceSum ( const T *  gpu_a,
size_t  nelem,
int  queue 
)

Sum over all of the elements of an 1D array.

\[ Sum = \sum_i^n a_i \]

Returns
The sum.

◆ reduceSum2()

template<class HT , size_t HN, class DPTR >
void tinker::reduceSum2 ( HT(&)  h_ans[HN],
DPTR  v,
size_t  nelem,
int  queue 
)

Sum over all of the elements of a 2D array.

In Fortran syntax:

\[ Ans(k) = \sum_i^n v(k,i), 1 \le k \le HN \]

In C++ syntax:

\[ Ans[k] = \sum_i^n v[i][k], 0 \le k < HN \]

◆ reduceSum2OnDevice()

template<class HT , size_t HN, class DPTR >
void tinker::reduceSum2OnDevice ( HT(&)  dref[HN],
DPTR  v,
size_t  nelem,
int  queue 
)

Sum over all of the elements of a 2D array. This routine will save the result on the device memory in an asynchronous/non-blocking manner. A valid device array is required for the result on device.

Fortran syntax:

\[ Ans(k) = \sum_i^n v(k,i), 1 \le k \le HN \]

C++ syntax:

\[ Ans[k] = \sum_i^n v[i][k], 0 \le k < HN \]

Template Parameters
HTType of the array element.
HNLength of the result array.
DPTRType of the 2D array.
Parameters
drefReference to the device array that stores the reduced result.
vDevice pointer to the 2D array.
nelemNumber of elements.
queueOpenACC queue.

◆ reduceSumOnDevice()

template<class T >
void tinker::reduceSumOnDevice ( T *  dp_ans,
const T *  a,
size_t  nelem,
int  queue 
)

Sum over all of the elements of an 1D array. This routine will save the result on the device memory in an asynchronous/non-blocking manner. A valid device pointer is required for the result on the device.

\[ Sum = \sum_i^n a_i \]

Parameters
dp_ansDevice pointer used to store the reduction result.
aDevice pointer to the array.
nelemNumber of elements.
queueOpenACC queue.

◆ scaleArray()

template<class T >
void tinker::scaleArray ( T *  dst,
scal,
size_t  nelem,
int  queue 
)

Multiply all of the elements in an 1D array by a scalar.

\[ a_i = c \cdot a_i \]