|
PSCF v1.4.0
|
Functions that perform parallel reductions on a GPU. More...
Functions | |
| cudaReal | Pscf::Reduce::sum (DeviceArray< cudaReal > const &in) |
| Return sum of elements of a real array. | |
| cudaReal | Pscf::Reduce::sum (DeviceArray< cudaReal > const &in, int begin, int end) |
| Return sum of elements of a real array slice. | |
| std::complex< cudaReal > | Pscf::Reduce::sum (DeviceArray< cudaComplex > const &in) |
| Return sum of all elements of a complex array. | |
| std::complex< cudaReal > | Pscf::Reduce::sum (DeviceArray< cudaComplex > const &in, int begin, int end) |
| Return sum of elements of a complex array slice. | |
| cudaReal | Pscf::Reduce::sumSq (DeviceArray< cudaReal > const &in) |
| Return sum of squares of elements of a real array. | |
| std::complex< cudaReal > | Pscf::Reduce::sumSq (DeviceArray< cudaComplex > const &in) |
| Return sum of squares of elements of a complex array. | |
| cudaReal | Pscf::Reduce::sumSqAbs (DeviceArray< cudaComplex > const &in) |
| Return sum of squared magnitudes of elements of a complex array. | |
| cudaReal | Pscf::Reduce::innerProduct (DeviceArray< cudaReal > const &a, DeviceArray< cudaReal > const &b) |
| Return the inner product of two real arrays. | |
| cudaReal | Pscf::Reduce::max (DeviceArray< cudaReal > const &in) |
| Return maximum of all real array elements. | |
| cudaReal | Pscf::Reduce::max (DeviceArray< cudaReal > const &in, int begin, int end) |
| Return maximum of elements of a real array slice. | |
| cudaReal | Pscf::Reduce::maxAbs (DeviceArray< cudaReal > const &in) |
| Get maximum absolute magnitude of real array elements. | |
| cudaReal | Pscf::Reduce::min (DeviceArray< cudaReal > const &in) |
| Return minimum of all real array elements. | |
| cudaReal | Pscf::Reduce::min (DeviceArray< cudaReal > const &in, int begin, int end) |
| Return minimum of elements of a real array slice. | |
| cudaReal | Pscf::Reduce::minAbs (DeviceArray< cudaReal > const &in) |
| Return minimum absolute magnitude of real array elements. | |
| void | Pscf::Reduce::freeWorkSpace () |
| Free any private work space currently allocated for reductions. | |
Functions that perform parallel reductions on a GPU.
A reduction is any operation that involves reducing all of the elements of one or more arrays to a single scalar result. Examples include taking the computation of the sum or the maximum of all elements of a single array, or of a Euclidean inner product of two real arrays.
A public function is provided for each reduction operation, which takes one or more DeviceArray containers as inputs and returns a single value. Each wrapper function is a standard C++ function that may be called on the host CPU. The implementation of each such wrapper function calls one of the device-wide algorithms defined in the CUB library that is distributed as part of the CUDA Core Compute library collection provided with the CUDA development kit.
Reduction functions that return a real number return a value of type cudaReal. Functions that return a complex number instead return a value of type std::complex<cudaReal>. Complex values are returned as std::complex<cudaReal> rather than cudaComplex to allow similar interfaces to be used by reduction functions declared here and by analogous functions defined in src/pscf/cpu/Reduced.h that take take standard Array containers as inputs and perform calculations on the CPU.
| cudaReal Pscf::Reduce::sum | ( | DeviceArray< cudaReal > const & | in | ) |
Return sum of elements of a real array.
| in | real input array |
Definition at line 216 of file Reduce.cu.
References Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::cArray(), Pscf::DeviceArray< Data >::isAllocated(), sum(), and UTIL_CHECK.
| cudaReal Pscf::Reduce::sum | ( | DeviceArray< cudaReal > const & | in, |
| int | begin, | ||
| int | end ) |
Return sum of elements of a real array slice.
| in | real input array |
| begin | index of first element of slice |
| end | index one past last element |
Definition at line 231 of file Reduce.cu.
References Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::cArray(), Pscf::DeviceArray< Data >::isAllocated(), sum(), and UTIL_CHECK.
| std::complex< cudaReal > Pscf::Reduce::sum | ( | DeviceArray< cudaComplex > const & | in | ) |
Return sum of all elements of a complex array.
| in | complex input array |
Definition at line 249 of file Reduce.cu.
References Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::cArray(), Pscf::DeviceArray< Data >::isAllocated(), sum(), and UTIL_CHECK.
| std::complex< cudaReal > Pscf::Reduce::sum | ( | DeviceArray< cudaComplex > const & | in, |
| int | begin, | ||
| int | end ) |
Return sum of elements of a complex array slice.
| in | real input array |
| begin | index of first element of slice |
| end | index one past last element of slice |
Definition at line 264 of file Reduce.cu.
References Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::cArray(), Pscf::DeviceArray< Data >::isAllocated(), sum(), and UTIL_CHECK.
| cudaReal Pscf::Reduce::sumSq | ( | DeviceArray< cudaReal > const & | in | ) |
Return sum of squares of elements of a real array.
This function returns the square of the Euclidean norm for a real array.
| in | real input array |
Definition at line 281 of file Reduce.cu.
References Pscf::DeviceArray< Data >::associate(), Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::dissociate(), Pscf::DeviceArray< Data >::isAllocated(), Pscf::VecOp::sqV(), sum(), and UTIL_CHECK.
| std::complex< cudaReal > Pscf::Reduce::sumSq | ( | DeviceArray< cudaComplex > const & | in | ) |
Return sum of squares of elements of a complex array.
This function returns the complex sum of complex squares of elements. This is not the square of the Hilbert space norm.
| in | real input array |
Definition at line 304 of file Reduce.cu.
References Pscf::DeviceArray< Data >::associate(), Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::dissociate(), Pscf::DeviceArray< Data >::isAllocated(), Pscf::VecOp::sqV(), sum(), and UTIL_CHECK.
| cudaReal Pscf::Reduce::sumSqAbs | ( | DeviceArray< cudaComplex > const & | in | ) |
Return sum of squared magnitudes of elements of a complex array.
This function returns the real sum of the squared absolute magnitude of all elements of a complex array. This is the square of the conventional Hilbert space norm.
| in | real input array |
Definition at line 328 of file Reduce.cu.
References Pscf::DeviceArray< Data >::associate(), Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::dissociate(), Pscf::DeviceArray< Data >::isAllocated(), Pscf::VecOp::sqAbsV(), sum(), and UTIL_CHECK.
| cudaReal Pscf::Reduce::innerProduct | ( | DeviceArray< cudaReal > const & | a, |
| DeviceArray< cudaReal > const & | b ) |
Return the inner product of two real arrays.
| a | first real input array |
| b | second real input array |
Definition at line 352 of file Reduce.cu.
References Pscf::DeviceArray< Data >::associate(), Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::dissociate(), Pscf::DeviceArray< Data >::isAllocated(), Pscf::VecOp::mulVV(), sum(), and UTIL_CHECK.
| cudaReal Pscf::Reduce::max | ( | DeviceArray< cudaReal > const & | in | ) |
Return maximum of all real array elements.
| in | real input array |
Definition at line 381 of file Reduce.cu.
References Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::cArray(), Pscf::DeviceArray< Data >::isAllocated(), max(), and UTIL_CHECK.
| cudaReal Pscf::Reduce::max | ( | DeviceArray< cudaReal > const & | in, |
| int | begin, | ||
| int | end ) |
Return maximum of elements of a real array slice.
| in | real input array |
| begin | index of first element of slice |
| end | index one past last element |
Definition at line 394 of file Reduce.cu.
References Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::cArray(), Pscf::DeviceArray< Data >::isAllocated(), max(), and UTIL_CHECK.
| cudaReal Pscf::Reduce::maxAbs | ( | DeviceArray< cudaReal > const & | in | ) |
Get maximum absolute magnitude of real array elements.
| in | real input array |
Definition at line 410 of file Reduce.cu.
References Pscf::VecOp::absV(), Pscf::DeviceArray< Data >::associate(), Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::dissociate(), Pscf::DeviceArray< Data >::isAllocated(), max(), and UTIL_CHECK.
| cudaReal Pscf::Reduce::min | ( | DeviceArray< cudaReal > const & | in | ) |
Return minimum of all real array elements.
| in | real input array |
Definition at line 436 of file Reduce.cu.
References Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::cArray(), Pscf::DeviceArray< Data >::isAllocated(), min(), and UTIL_CHECK.
| cudaReal Pscf::Reduce::min | ( | DeviceArray< cudaReal > const & | in, |
| int | begin, | ||
| int | end ) |
Return minimum of elements of a real array slice.
| in | real input array |
| begin | index of first element of slice |
| end | index one past last element |
Definition at line 449 of file Reduce.cu.
References Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::cArray(), Pscf::DeviceArray< Data >::isAllocated(), min(), and UTIL_CHECK.
| cudaReal Pscf::Reduce::minAbs | ( | DeviceArray< cudaReal > const & | in | ) |
Return minimum absolute magnitude of real array elements.
| in | real input array |
Definition at line 465 of file Reduce.cu.
References Pscf::VecOp::absV(), Pscf::DeviceArray< Data >::associate(), Pscf::DeviceArray< Data >::capacity(), Pscf::DeviceArray< Data >::dissociate(), Pscf::DeviceArray< Data >::isAllocated(), min(), and UTIL_CHECK.