Doxygen 1.15.0
Toolkit for Adaptive Stochastic Modeling and Non-Intrusive ApproximatioN: Tasmanian v8.2
Loading...
Searching...
No Matches
tsgCudaLoadStructures.hpp
1/*
2 * Copyright (c) 2018, Miroslav Stoyanov
3 *
4 * This file is part of
5 * Toolkit for Adaptive Stochastic Modeling And Non-Intrusive ApproximatioN: TASMANIAN
6 *
7 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions
12 * and the following disclaimer in the documentation and/or other materials provided with the distribution.
13 *
14 * 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse
15 * or promote products derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
18 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
20 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
21 * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
22 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * UT-BATTELLE, LLC AND THE UNITED STATES GOVERNMENT MAKE NO REPRESENTATIONS AND DISCLAIM ALL WARRANTIES, BOTH EXPRESSED AND IMPLIED.
25 * THERE ARE NO EXPRESS OR IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR THAT THE USE OF THE SOFTWARE WILL NOT INFRINGE ANY PATENT,
26 * COPYRIGHT, TRADEMARK, OR OTHER PROPRIETARY RIGHTS, OR THAT THE SOFTWARE WILL ACCOMPLISH THE INTENDED RESULTS OR THAT THE SOFTWARE OR ITS USE WILL NOT RESULT IN INJURY OR DAMAGE.
27 * THE USER ASSUMES RESPONSIBILITY FOR ALL LIABILITIES, PENALTIES, FINES, CLAIMS, CAUSES OF ACTION, AND COSTS AND EXPENSES, CAUSED BY, RESULTING FROM OR ARISING OUT OF,
28 * IN WHOLE OR IN PART THE USE, STORAGE OR DISPOSAL OF THE SOFTWARE.
29 */
30
31#ifndef __TASMANIAN_SPARSE_CUDA_LOAD_STRUCTS_HPP
32#define __TASMANIAN_SPARSE_CUDA_LOAD_STRUCTS_HPP
33
34#include "tsgAcceleratedDataStructures.hpp"
35
36namespace TasGrid{
37
38
39#ifndef __TASMANIAN_DOXYGEN_SKIP
40
47template<typename FP>
48struct CudaGlobalData{
49 GpuVector<FP> values;
50 // cache stage
51 int num_basis; // number of 1d basis functions
52 GpuVector<FP> nodes;
53 GpuVector<FP> coeff;
54 GpuVector<int> nodes_per_level;
55 GpuVector<int> offset_per_level; // non-nested case nodes, always used for coefficients
56 GpuVector<int> map_dimension;
57 GpuVector<int> map_level;
58 // compute stage
59 GpuVector<FP> tensor_weights;
60 GpuVector<int> active_tensors;
61 GpuVector<int> active_num_points;
62 GpuVector<int> dim_offsets; // relates to the cache
63 GpuVector<int> map_tensor;
64 GpuVector<int> map_index;
65 GpuVector<int> map_reference;
66 void clearNodes(){
67 num_basis = 0;
68 nodes.clear();
69 coeff.clear();
70 nodes_per_level.clear();
71 offset_per_level.clear();
72 map_dimension.clear();
73 map_level.clear();
74 tensor_weights.clear();
75 active_tensors.clear();
76 active_num_points.clear();
77 dim_offsets.clear();
78 map_tensor.clear();
79 map_index.clear();
80 map_reference.clear();
81 }
82};
83
86
92template<typename FP>
93struct CudaSequenceData{
94 GpuVector<FP> surpluses, nodes, coeff;
95 GpuVector<int> num_nodes, points;
96 void clearNodes(){
97 nodes.clear();
98 coeff.clear();
99 num_nodes.clear();
100 points.clear();
101 }
102};
103
106
109template<typename FP>
110struct CudaFourierData{
111 GpuVector<FP> real, imag;
112 GpuVector<int> num_nodes, points;
113};
114
117
122template<typename FP>
123struct CudaLocalPolynomialData{
124 GpuVector<FP> surpluses, nodes, support;
125 GpuVector<int> hpntr, hindx, hroots;
126 void clearHierarchy(){
127 hpntr.clear();
128 hindx.clear();
129 hroots.clear();
130 }
131 void clearBasisHierarchy(){
132 nodes.clear();
133 support.clear();
134 clearHierarchy();
135 }
136};
137
140
142template<typename FP>
143struct CudaWaveletData{
144 GpuVector<FP> coefficients, nodes, support;
145 void clearNodes(){
146 nodes.clear();
147 support.clear();
148 }
149};
150#endif // __TASMANIAN_DOXYGEN_SKIP
151
152}
153
154#endif
Encapsulates the Tasmanian Sparse Grid module.
Definition TasmanianSparseGrid.hpp:68