Doxygen 1.9.8
Toolkit for Adaptive Stochastic Modeling and Non-Intrusive ApproximatioN: Tasmanian v8.2
 
Loading...
Searching...
No Matches
tsgAcceleratedHandles.hpp
1/*
2 * Copyright (c) 2017, 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_GRID_ACCELERATED_HANDLES
32#define __TASMANIAN_SPARSE_GRID_ACCELERATED_HANDLES
33
34#include "tsgEnumerates.hpp"
35
36namespace TasGrid{
37
45namespace AccHandle{
47 struct Cublas{};
49 struct Cusparse{};
51 struct Cusolver{};
53 struct Rocblas{};
55 struct Rocsparse{};
57 struct Syclqueue{};
58}
59
67template<typename> void deleteHandle(int*);
68
101template<typename ehandle>
104 HandleDeleter(bool init_own = true) : own(init_own){}
106 void operator()(int *p) const { if (own) deleteHandle<ehandle>(p); }
108 bool own;
109};
110
111}
112
113#endif
void deleteHandle(int *)
Deletes the handle, specialized for each TPL backend and tag in TasGrid::AccHandle namepace.
Encapsulates the Tasmanian Sparse Grid module.
Definition TasmanianSparseGrid.hpp:68
cuBlas handle.
Definition tsgAcceleratedHandles.hpp:47
cuSolver handle.
Definition tsgAcceleratedHandles.hpp:51
cuSparse handle.
Definition tsgAcceleratedHandles.hpp:49
rocBlas handle.
Definition tsgAcceleratedHandles.hpp:53
rocSparse handle.
Definition tsgAcceleratedHandles.hpp:55
SYCL queue handle.
Definition tsgAcceleratedHandles.hpp:57
Deleter template for the GPU handles, e.g., cuBlas and rocBlas.
Definition tsgAcceleratedHandles.hpp:102
bool own
Save the own/not own state.
Definition tsgAcceleratedHandles.hpp:108
HandleDeleter(bool init_own=true)
Constructor indicating the ownership of the handle.
Definition tsgAcceleratedHandles.hpp:104
void operator()(int *p) const
Deletes the handle, if owned; nothing otherwise.
Definition tsgAcceleratedHandles.hpp:106
Omnipresent enumerate types.