reduce_kernel.h
Go to the documentation of this file.
1 /*
2  * This file is a part of TiledArray.
3  * Copyright (C) 2018 Virginia Tech
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Chong Peng
19  * Department of Chemistry, Virginia Tech
20  * May 08, 2019
21  *
22  */
23 
24 #ifndef TILEDARRAY_CUDA_REDUCE_KERNEL_H__INCLUDED
25 #define TILEDARRAY_CUDA_REDUCE_KERNEL_H__INCLUDED
26 
27 #include <TiledArray/config.h>
28 
29 #ifdef TILEDARRAY_HAS_CUDA
30 
31 namespace TiledArray {
32 
33 // foreach(i) result *= arg[i]
34 int product_cuda_kernel(const int *arg, std::size_t n, cudaStream_t stream,
35  int device_id);
36 
37 float product_cuda_kernel(const float *arg, std::size_t n, cudaStream_t stream,
38  int device_id);
39 
40 double product_cuda_kernel(const double *arg, std::size_t n,
41  cudaStream_t stream, int device_id);
42 
43 // foreach(i) result += arg[i]
44 int sum_cuda_kernel(const int *arg, std::size_t n, cudaStream_t stream,
45  int device_id);
46 
47 float sum_cuda_kernel(const float *arg, std::size_t n, cudaStream_t stream,
48  int device_id);
49 
50 double sum_cuda_kernel(const double *arg, std::size_t n, cudaStream_t stream,
51  int device_id);
52 
53 // foreach(i) result = max(result, arg[i])
54 int max_cuda_kernel(const int *arg, std::size_t n, cudaStream_t stream,
55  int device_id);
56 
57 float max_cuda_kernel(const float *arg, std::size_t n, cudaStream_t stream,
58  int device_id);
59 
60 double max_cuda_kernel(const double *arg, std::size_t n, cudaStream_t stream,
61  int device_id);
62 
63 // foreach(i) result = min(result, arg[i])
64 int min_cuda_kernel(const int *arg, std::size_t n, cudaStream_t stream,
65  int device_id);
66 
67 float min_cuda_kernel(const float *arg, std::size_t n, cudaStream_t stream,
68  int device_id);
69 
70 double min_cuda_kernel(const double *arg, std::size_t n, cudaStream_t stream,
71  int device_id);
72 
73 // foreach(i) result = max(result, abs(arg[i]))
74 int absmax_cuda_kernel(const int *arg, std::size_t n, cudaStream_t stream,
75  int device_id);
76 
77 float absmax_cuda_kernel(const float *arg, std::size_t n, cudaStream_t stream,
78  int device_id);
79 
80 double absmax_cuda_kernel(const double *arg, std::size_t n, cudaStream_t stream,
81  int device_id);
82 
83 // foreach(i) result = min(result, abs(arg[i]))
84 int absmin_cuda_kernel(const int *arg, std::size_t n, cudaStream_t stream,
85  int device_id);
86 
87 float absmin_cuda_kernel(const float *arg, std::size_t n, cudaStream_t stream,
88  int device_id);
89 
90 double absmin_cuda_kernel(const double *arg, std::size_t n, cudaStream_t stream,
91  int device_id);
92 
93 } // namespace TiledArray
94 
95 #endif // TILEDARRAY_HAS_CUDA
96 
97 #endif // TILEDARRAY_CUDA_REDUCE_KERNEL_H__INCLUDED