codekingpro/portable-devtools
114k
1/*
2 * Copyright 2019 NVIDIA Corporation. All rights reserved.
3 *
4 * NOTICE TO LICENSEE:
5 *
6 * This source code and/or documentation ("Licensed Deliverables") are
7 * subject to NVIDIA intellectual property rights under U.S. and
8 * international Copyright laws.
9 *
10 * These Licensed Deliverables contained herein is PROPRIETARY and
11 * CONFIDENTIAL to NVIDIA and is being provided under the terms and
12 * conditions of a form of NVIDIA software license agreement by and
13 * between NVIDIA and Licensee ("License Agreement") or electronically
14 * accepted by Licensee. Notwithstanding any terms or conditions to
15 * the contrary in the License Agreement, reproduction or disclosure
16 * of the Licensed Deliverables to any third party without the express
17 * written consent of NVIDIA is prohibited.
18 *
19 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
20 * LICENSE AGREEMENT, NVIDIA MAKES NO REPRESENTATION ABOUT THE
21 * SUITABILITY OF THESE LICENSED DELIVERABLES FOR ANY PURPOSE. IT IS
22 * PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY OF ANY KIND.
23 * NVIDIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THESE LICENSED
24 * DELIVERABLES, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY,
25 * NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE.
26 * NOTWITHSTANDING ANY TERMS OR CONDITIONS TO THE CONTRARY IN THE
27 * LICENSE AGREEMENT, IN NO EVENT SHALL NVIDIA BE LIABLE FOR ANY
28 * SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, OR ANY
29 * DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
30 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
31 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE
32 * OF THESE LICENSED DELIVERABLES.
33 *
34 * U.S. Government End Users. These Licensed Deliverables are a
35 * "commercial item" as that term is defined at 48 C.F.R. 2.101 (OCT
36 * 1995), consisting of "commercial computer software" and "commercial
37 * computer software documentation" as such terms are used in 48
38 * C.F.R. 12.212 (SEPT 1995) and is provided to the U.S. Government
39 * only as a commercial end item. Consistent with 48 C.F.R.12.212 and
40 * 48 C.F.R. 227.7202-1 through 227.7202-4 (JUNE 1995), all
41 * U.S. Government End Users acquire the Licensed Deliverables with
42 * only those rights set forth herein.
43 *
44 * Any use of the Licensed Deliverables in individual and commercial
45 * software must include, in the user documentation and internal
46 * comments to the code, the above Disclaimer and U.S. Government End
47 * Users Notice.
48 */
49
50#if !defined(CUSOLVERMG_H_)
51 #define CUSOLVERMG_H_
52
53 #include <stdint.h>
54 #include "cusolverDn.h"
55
56 #if defined(__cplusplus)
57extern "C" {
58 #endif /* __cplusplus */
59
60 struct cusolverMgContext;
61 typedef struct cusolverMgContext *cusolverMgHandle_t;
62
63 /**
64 * \beief This enum decides how 1D device Ids (or process ranks) get mapped to
65 * a 2D grid.
66 */
67 typedef enum {
68
69 CUDALIBMG_GRID_MAPPING_ROW_MAJOR = 1,
70 CUDALIBMG_GRID_MAPPING_COL_MAJOR = 0
71
72 } cusolverMgGridMapping_t;
73
74 /** \brief Opaque structure of the distributed grid */
75 typedef void *cudaLibMgGrid_t;
76 /** \brief Opaque structure of the distributed matrix descriptor */
77 typedef void *cudaLibMgMatrixDesc_t;
78
79 cusolverStatus_t CUSOLVERAPI cusolverMgCreate(cusolverMgHandle_t *handle);
80
81 cusolverStatus_t CUSOLVERAPI cusolverMgDestroy(cusolverMgHandle_t handle);
82
83 cusolverStatus_t CUSOLVERAPI cusolverMgDeviceSelect(
84 cusolverMgHandle_t handle,
85 int nbDevices,
86 int deviceId[]);
87
88 /**
89 * \brief Allocates resources related to the shared memory device grid.
90 * \param[out] grid the opaque data strcuture that holds the grid
91 * \param[in] numRowDevices number of devices in the row
92 * \param[in] numColDevices number of devices in the column
93 * \param[in] deviceId This array of size height * width stores the
94 * device-ids of the 2D grid; each entry must correspond to a valid
95 * gpu or to -1 (denoting CPU). \param[in] mapping whether the 2D grid is in
96 * row/column major \returns the status code
97 */
98 cusolverStatus_t CUSOLVERAPI cusolverMgCreateDeviceGrid(
99 cudaLibMgGrid_t * grid,
100 int32_t numRowDevices,
101 int32_t numColDevices,
102 const int32_t deviceId[],
103 cusolverMgGridMapping_t mapping);
104
105 /**
106 * \brief Releases the allocated resources related to the distributed grid.
107 * \param[in] grid the opaque data strcuture that holds the distributed grid
108 * \returns the status code
109 */
110 cusolverStatus_t CUSOLVERAPI cusolverMgDestroyGrid(cudaLibMgGrid_t grid);
111
112 /**
113 * \brief Allocates resources related to the distributed matrix descriptor.
114 * \param[out] desc the opaque data strcuture that holds the descriptor
115 * \param[in] numRows number of total rows
116 * \param[in] numCols number of total columns
117 * \param[in] rowBlockSize row block size
118 * \param[in] colBlockSize column block size
119 * \param[in] dataType the data type of each element in cudaDataType
120 * \param[in] grid the opaque data structure of the distributed grid
121 * \returns the status code
122 */
123 cusolverStatus_t CUSOLVERAPI cusolverMgCreateMatrixDesc(
124 cudaLibMgMatrixDesc_t *desc,
125 int64_t numRows,
126 int64_t numCols,
127 int64_t rowBlockSize,
128 int64_t colBlockSize,
129 cudaDataType dataType,
130 const cudaLibMgGrid_t grid);
131
132 /**
133 * \brief Releases the allocated resources related to the distributed matrix
134 * descriptor. \param[in] desc the opaque data strcuture that holds the
135 * descriptor \returns the status code
136 */
137 cusolverStatus_t CUSOLVERAPI
138 cusolverMgDestroyMatrixDesc(cudaLibMgMatrixDesc_t desc);
139
140 cusolverStatus_t CUSOLVERAPI cusolverMgSyevd_bufferSize(
141 cusolverMgHandle_t handle,
142 cusolverEigMode_t jobz,
143 cublasFillMode_t uplo,
144 int N,
145 void * array_d_A[],
146 int IA,
147 int JA,
148 cudaLibMgMatrixDesc_t descrA,
149 void * W,
150 cudaDataType dataTypeW,
151 cudaDataType computeType,
152 int64_t * lwork);
153
154 cusolverStatus_t CUSOLVERAPI cusolverMgSyevd(
155 cusolverMgHandle_t handle,
156 cusolverEigMode_t jobz,
157 cublasFillMode_t uplo,
158 int N,
159 void * array_d_A[],
160 int IA,
161 int JA,
162 cudaLibMgMatrixDesc_t descrA,
163 void * W,
164 cudaDataType dataTypeW,
165 cudaDataType computeType,
166 void * array_d_work[],
167 int64_t lwork,
168 int * info);
169
170 cusolverStatus_t CUSOLVERAPI cusolverMgGetrf_bufferSize(
171 cusolverMgHandle_t handle,
172 int M,
173 int N,
174 void * array_d_A[],
175 int IA,
176 int JA,
177 cudaLibMgMatrixDesc_t descrA,
178 int * array_d_IPIV[],
179 cudaDataType computeType,
180 int64_t * lwork);
181
182 cusolverStatus_t CUSOLVERAPI cusolverMgGetrf(
183 cusolverMgHandle_t handle,
184 int M,
185 int N,
186 void * array_d_A[],
187 int IA,
188 int JA,
189 cudaLibMgMatrixDesc_t descrA,
190 int * array_d_IPIV[],
191 cudaDataType computeType,
192 void * array_d_work[],
193 int64_t lwork,
194 int * info);
195
196 cusolverStatus_t CUSOLVERAPI cusolverMgGetrs_bufferSize(
197 cusolverMgHandle_t handle,
198 cublasOperation_t TRANS,
199 int N,
200 int NRHS,
201 void * array_d_A[],
202 int IA,
203 int JA,
204 cudaLibMgMatrixDesc_t descrA,
205 int * array_d_IPIV[],
206 void * array_d_B[],
207 int IB,
208 int JB,
209 cudaLibMgMatrixDesc_t descrB,
210 cudaDataType computeType,
211 int64_t * lwork);
212
213 cusolverStatus_t CUSOLVERAPI cusolverMgGetrs(
214 cusolverMgHandle_t handle,
215 cublasOperation_t TRANS,
216 int N,
217 int NRHS,
218 void * array_d_A[],
219 int IA,
220 int JA,
221 cudaLibMgMatrixDesc_t descrA,
222 int * array_d_IPIV[],
223 void * array_d_B[],
224 int IB,
225 int JB,
226 cudaLibMgMatrixDesc_t descrB,
227 cudaDataType computeType,
228 void * array_d_work[],
229 int64_t lwork,
230 int * info);
231
232 cusolverStatus_t CUSOLVERAPI cusolverMgPotrf_bufferSize(
233 cusolverMgHandle_t handle,
234 cublasFillMode_t uplo,
235 int N,
236 void * array_d_A[],
237 int IA,
238 int JA,
239 cudaLibMgMatrixDesc_t descrA,
240 cudaDataType computeType,
241 int64_t * lwork);
242
243 cusolverStatus_t CUSOLVERAPI cusolverMgPotrf(
244 cusolverMgHandle_t handle,
245 cublasFillMode_t uplo,
246 int N,
247 void * array_d_A[],
248 int IA,
249 int JA,
250 cudaLibMgMatrixDesc_t descrA,
251 cudaDataType computeType,
252 void * array_d_work[],
253 int64_t lwork,
254 int * h_info);
255
256 cusolverStatus_t CUSOLVERAPI cusolverMgPotrs_bufferSize(
257 cusolverMgHandle_t handle,
258 cublasFillMode_t uplo,
259 int n,
260 int nrhs,
261 void * array_d_A[],
262 int IA,
263 int JA,
264 cudaLibMgMatrixDesc_t descrA,
265 void * array_d_B[],
266 int IB,
267 int JB,
268 cudaLibMgMatrixDesc_t descrB,
269 cudaDataType computeType,
270 int64_t * lwork);
271
272 cusolverStatus_t CUSOLVERAPI cusolverMgPotrs(
273 cusolverMgHandle_t handle,
274 cublasFillMode_t uplo,
275 int n,
276 int nrhs,
277 void * array_d_A[],
278 int IA,
279 int JA,
280 cudaLibMgMatrixDesc_t descrA,
281 void * array_d_B[],
282 int IB,
283 int JB,
284 cudaLibMgMatrixDesc_t descrB,
285 cudaDataType computeType,
286 void * array_d_work[],
287 int64_t lwork,
288 int * h_info);
289
290 cusolverStatus_t CUSOLVERAPI cusolverMgPotri_bufferSize(
291 cusolverMgHandle_t handle,
292 cublasFillMode_t uplo,
293 int N,
294 void * array_d_A[],
295 int IA,
296 int JA,
297 cudaLibMgMatrixDesc_t descrA,
298 cudaDataType computeType,
299 int64_t * lwork);
300
301 cusolverStatus_t CUSOLVERAPI cusolverMgPotri(
302 cusolverMgHandle_t handle,
303 cublasFillMode_t uplo,
304 int N,
305 void * array_d_A[],
306 int IA,
307 int JA,
308 cudaLibMgMatrixDesc_t descrA,
309 cudaDataType computeType,
310 void * array_d_work[],
311 int64_t lwork,
312 int * h_info);
313
314 #if defined(__cplusplus)
315}
316 #endif /* __cplusplus */
317
318#endif // CUSOLVERMG_H_
319 