codekingpro/portable-devtools
114k
1/*
2 * Copyright 1993-2018 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
51
52#if !defined(__CUDA_RUNTIME_API_H__)
53#define __CUDA_RUNTIME_API_H__
54
55#if !defined(__CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__)
56#define __CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS__
57#define __UNDEF_CUDA_INCLUDE_COMPILER_INTERNAL_HEADERS_CUDA_RUNTIME_API_H__
58#endif
59
60/**
61 * \latexonly
62 * \page sync_async API synchronization behavior
63 *
64 * \section memcpy_sync_async_behavior Memcpy
65 * The API provides memcpy/memset functions in both synchronous and asynchronous forms,
66 * the latter having an \e "Async" suffix. This is a misnomer as each function
67 * may exhibit synchronous or asynchronous behavior depending on the arguments
68 * passed to the function. In the reference documentation, each memcpy function is
69 * categorized as \e synchronous or \e asynchronous, corresponding to the definitions
70 * below.
71 *
72 * \subsection MemcpySynchronousBehavior Synchronous
73 *
74 * <ol>
75 * <li> For transfers from pageable host memory to device memory, a stream sync is performed
76 * before the copy is initiated. The function will return once the pageable
77 * buffer has been copied to the staging memory for DMA transfer to device memory,
78 * but the DMA to final destination may not have completed.
79 *
80 * <li> For transfers from pinned host memory to device memory, the function is synchronous
81 * with respect to the host.
82 *
83 * <li> For transfers from device to either pageable or pinned host memory, the function returns
84 * only once the copy has completed.
85 *
86 * <li> For transfers from device memory to device memory, no host-side synchronization is
87 * performed.
88 *
89 * <li> For transfers from any host memory to any host memory, the function is fully
90 * synchronous with respect to the host.
91 * </ol>
92 *
93 * \subsection MemcpyAsynchronousBehavior Asynchronous
94 *
95 * <ol>
96 * <li> For transfers between device memory and pageable host memory, the function might
97 * be synchronous with respect to host.
98 *
99 * <li> For transfers from any host memory to any host memory, the function is fully
100 * synchronous with respect to the host.
101 *
102 * <li> If pageable memory must first be staged to pinned memory, the driver may
103 * synchronize with the stream and stage the copy into pinned memory.
104 *
105 * <li> For all other transfers, the function should be fully asynchronous.
106 * </ol>
107 *
108 * \section memset_sync_async_behavior Memset
109 * The cudaMemset functions are asynchronous with respect to the host
110 * except when the target memory is pinned host memory. The \e Async
111 * versions are always asynchronous with respect to the host.
112 *
113 * \section kernel_launch_details Kernel Launches
114 * Kernel launches are asynchronous with respect to the host. Details of
115 * concurrent kernel execution and data transfers can be found in the CUDA
116 * Programmers Guide.
117 *
118 * \endlatexonly
119 */
120
121/**
122 * There are two levels for the runtime API.
123 *
124 * The C API (<i>cuda_runtime_api.h</i>) is
125 * a C-style interface that does not require compiling with \p nvcc.
126 *
127 * The \ref CUDART_HIGHLEVEL "C++ API" (<i>cuda_runtime.h</i>) is a
128 * C++-style interface built on top of the C API. It wraps some of the
129 * C API routines, using overloading, references and default arguments.
130 * These wrappers can be used from C++ code and can be compiled with any C++
131 * compiler. The C++ API also has some CUDA-specific wrappers that wrap
132 * C API routines that deal with symbols, textures, and device functions.
133 * These wrappers require the use of \p nvcc because they depend on code being
134 * generated by the compiler. For example, the execution configuration syntax
135 * to invoke kernels is only available in source code compiled with \p nvcc.
136 */
137
138/** CUDA Runtime API Version */
139#define CUDART_VERSION 12040
140
141#if defined(__CUDA_API_VER_MAJOR__) && defined(__CUDA_API_VER_MINOR__)
142# define __CUDART_API_VERSION ((__CUDA_API_VER_MAJOR__ * 1000) + (__CUDA_API_VER_MINOR__ * 10))
143#else
144# define __CUDART_API_VERSION CUDART_VERSION
145#endif
146
147#ifndef __DOXYGEN_ONLY__
148#include "crt/host_defines.h"
149#endif
150#include "builtin_types.h"
151
152#if !defined(__CUDACC_RTC_MINIMAL__) && ((defined(__CUDACC_RDC__) || defined(__CUDACC_EWP__) || !defined(__CUDACC_RTC__)))
153#include "cuda_device_runtime_api.h"
154#endif /* !defined(__CUDACC_RTC_MINIMAL__) && (defined(__CUDACC_RDC__) || defined(__CUDACC_EWP__) || !defined(__CUDACC_RTC__)) */
155
156
157#ifndef __CUDACC_RTC_MINIMAL__
158#if defined(CUDA_API_PER_THREAD_DEFAULT_STREAM) || defined(__CUDA_API_VERSION_INTERNAL)
159 #define __CUDART_API_PER_THREAD_DEFAULT_STREAM
160 #define __CUDART_API_PTDS(api) api ## _ptds
161 #define __CUDART_API_PTSZ(api) api ## _ptsz
162#else
163 #define __CUDART_API_PTDS(api) api
164 #define __CUDART_API_PTSZ(api) api
165#endif
166
167#define cudaSignalExternalSemaphoresAsync __CUDART_API_PTSZ(cudaSignalExternalSemaphoresAsync_v2)
168#define cudaWaitExternalSemaphoresAsync __CUDART_API_PTSZ(cudaWaitExternalSemaphoresAsync_v2)
169
170 #define cudaStreamGetCaptureInfo __CUDART_API_PTSZ(cudaStreamGetCaptureInfo_v2)
171
172#define cudaGetDeviceProperties cudaGetDeviceProperties_v2
173
174#if defined(__CUDART_API_PER_THREAD_DEFAULT_STREAM)
175 #define cudaMemcpy __CUDART_API_PTDS(cudaMemcpy)
176 #define cudaMemcpyToSymbol __CUDART_API_PTDS(cudaMemcpyToSymbol)
177 #define cudaMemcpyFromSymbol __CUDART_API_PTDS(cudaMemcpyFromSymbol)
178 #define cudaMemcpy2D __CUDART_API_PTDS(cudaMemcpy2D)
179 #define cudaMemcpyToArray __CUDART_API_PTDS(cudaMemcpyToArray)
180 #define cudaMemcpy2DToArray __CUDART_API_PTDS(cudaMemcpy2DToArray)
181 #define cudaMemcpyFromArray __CUDART_API_PTDS(cudaMemcpyFromArray)
182 #define cudaMemcpy2DFromArray __CUDART_API_PTDS(cudaMemcpy2DFromArray)
183 #define cudaMemcpyArrayToArray __CUDART_API_PTDS(cudaMemcpyArrayToArray)
184 #define cudaMemcpy2DArrayToArray __CUDART_API_PTDS(cudaMemcpy2DArrayToArray)
185 #define cudaMemcpy3D __CUDART_API_PTDS(cudaMemcpy3D)
186 #define cudaMemcpy3DPeer __CUDART_API_PTDS(cudaMemcpy3DPeer)
187 #define cudaMemset __CUDART_API_PTDS(cudaMemset)
188 #define cudaMemset2D __CUDART_API_PTDS(cudaMemset2D)
189 #define cudaMemset3D __CUDART_API_PTDS(cudaMemset3D)
190 #define cudaGraphInstantiateWithParams __CUDART_API_PTSZ(cudaGraphInstantiateWithParams)
191 #define cudaGraphUpload __CUDART_API_PTSZ(cudaGraphUpload)
192 #define cudaGraphLaunch __CUDART_API_PTSZ(cudaGraphLaunch)
193 #define cudaStreamBeginCapture __CUDART_API_PTSZ(cudaStreamBeginCapture)
194 #define cudaStreamBeginCaptureToGraph __CUDART_API_PTSZ(cudaStreamBeginCaptureToGraph)
195 #define cudaStreamEndCapture __CUDART_API_PTSZ(cudaStreamEndCapture)
196 #define cudaStreamGetCaptureInfo_v3 __CUDART_API_PTSZ(cudaStreamGetCaptureInfo_v3)
197 #define cudaStreamUpdateCaptureDependencies __CUDART_API_PTSZ(cudaStreamUpdateCaptureDependencies)
198 #define cudaStreamUpdateCaptureDependencies_v2 __CUDART_API_PTSZ(cudaStreamUpdateCaptureDependencies_v2)
199 #define cudaStreamIsCapturing __CUDART_API_PTSZ(cudaStreamIsCapturing)
200 #define cudaMemcpyAsync __CUDART_API_PTSZ(cudaMemcpyAsync)
201 #define cudaMemcpyToSymbolAsync __CUDART_API_PTSZ(cudaMemcpyToSymbolAsync)
202 #define cudaMemcpyFromSymbolAsync __CUDART_API_PTSZ(cudaMemcpyFromSymbolAsync)
203 #define cudaMemcpy2DAsync __CUDART_API_PTSZ(cudaMemcpy2DAsync)
204 #define cudaMemcpyToArrayAsync __CUDART_API_PTSZ(cudaMemcpyToArrayAsync)
205 #define cudaMemcpy2DToArrayAsync __CUDART_API_PTSZ(cudaMemcpy2DToArrayAsync)
206 #define cudaMemcpyFromArrayAsync __CUDART_API_PTSZ(cudaMemcpyFromArrayAsync)
207 #define cudaMemcpy2DFromArrayAsync __CUDART_API_PTSZ(cudaMemcpy2DFromArrayAsync)
208 #define cudaMemcpy3DAsync __CUDART_API_PTSZ(cudaMemcpy3DAsync)
209 #define cudaMemcpy3DPeerAsync __CUDART_API_PTSZ(cudaMemcpy3DPeerAsync)
210 #define cudaMemsetAsync __CUDART_API_PTSZ(cudaMemsetAsync)
211 #define cudaMemset2DAsync __CUDART_API_PTSZ(cudaMemset2DAsync)
212 #define cudaMemset3DAsync __CUDART_API_PTSZ(cudaMemset3DAsync)
213 #define cudaStreamQuery __CUDART_API_PTSZ(cudaStreamQuery)
214 #define cudaStreamGetFlags __CUDART_API_PTSZ(cudaStreamGetFlags)
215 #define cudaStreamGetId __CUDART_API_PTSZ(cudaStreamGetId)
216 #define cudaStreamGetPriority __CUDART_API_PTSZ(cudaStreamGetPriority)
217 #define cudaEventRecord __CUDART_API_PTSZ(cudaEventRecord)
218 #define cudaEventRecordWithFlags __CUDART_API_PTSZ(cudaEventRecordWithFlags)
219 #define cudaStreamWaitEvent __CUDART_API_PTSZ(cudaStreamWaitEvent)
220 #define cudaStreamAddCallback __CUDART_API_PTSZ(cudaStreamAddCallback)
221 #define cudaStreamAttachMemAsync __CUDART_API_PTSZ(cudaStreamAttachMemAsync)
222 #define cudaStreamSynchronize __CUDART_API_PTSZ(cudaStreamSynchronize)
223 #define cudaLaunchKernel __CUDART_API_PTSZ(cudaLaunchKernel)
224 #define cudaLaunchKernelExC __CUDART_API_PTSZ(cudaLaunchKernelExC)
225 #define cudaLaunchHostFunc __CUDART_API_PTSZ(cudaLaunchHostFunc)
226 #define cudaMemPrefetchAsync __CUDART_API_PTSZ(cudaMemPrefetchAsync)
227 #define cudaMemPrefetchAsync_v2 __CUDART_API_PTSZ(cudaMemPrefetchAsync_v2)
228 #define cudaLaunchCooperativeKernel __CUDART_API_PTSZ(cudaLaunchCooperativeKernel)
229 #define cudaStreamCopyAttributes __CUDART_API_PTSZ(cudaStreamCopyAttributes)
230 #define cudaStreamGetAttribute __CUDART_API_PTSZ(cudaStreamGetAttribute)
231 #define cudaStreamSetAttribute __CUDART_API_PTSZ(cudaStreamSetAttribute)
232 #define cudaMallocAsync __CUDART_API_PTSZ(cudaMallocAsync)
233 #define cudaFreeAsync __CUDART_API_PTSZ(cudaFreeAsync)
234 #define cudaMallocFromPoolAsync __CUDART_API_PTSZ(cudaMallocFromPoolAsync)
235 #define cudaGetDriverEntryPoint __CUDART_API_PTSZ(cudaGetDriverEntryPoint)
236#endif
237
238#endif /* __CUDACC_RTC_MINIMAL__ */
239
240/** \cond impl_private */
241#if !defined(__dv)
242
243#if defined(__cplusplus)
244
245#define __dv(v) \
246 = v
247
248#else /* __cplusplus */
249
250#define __dv(v)
251
252#endif /* __cplusplus */
253
254#endif /* !__dv */
255/** \endcond impl_private */
256
257#if (defined(_NVHPC_CUDA) || !defined(__CUDA_ARCH__) || (__CUDA_ARCH__ >= 350)) /** Visible to SM>=3.5 and "__host__ __device__" only **/
258
259#define CUDART_DEVICE __device__
260
261#else
262
263#define CUDART_DEVICE
264
265#endif /** CUDART_DEVICE */
266
267#if !defined(__CUDACC_RTC__)
268#define EXCLUDE_FROM_RTC
269
270/** \cond impl_private */
271#if defined(__DOXYGEN_ONLY__) || defined(CUDA_ENABLE_DEPRECATED)
272#define __CUDA_DEPRECATED
273#elif defined(_MSC_VER)
274#define __CUDA_DEPRECATED __declspec(deprecated)
275#elif defined(__GNUC__)
276#define __CUDA_DEPRECATED __attribute__((deprecated))
277#else
278#define __CUDA_DEPRECATED
279#endif
280/** \endcond impl_private */
281
282#if defined(__cplusplus)
283extern "C" {
284#endif /* __cplusplus */
285
286/**
287 * \defgroup CUDART_DEVICE Device Management
288 *
289 * ___MANBRIEF___ device management functions of the CUDA runtime API
290 * (___CURRENT_FILE___) ___ENDMANBRIEF___
291 *
292 * This section describes the device management functions of the CUDA runtime
293 * application programming interface.
294 *
295 * @{
296 */
297
298/**
299 * \brief Destroy all allocations and reset all state on the current device
300 * in the current process.
301 *
302 * Explicitly destroys and cleans up all resources associated with the current
303 * device in the current process. It is the caller's responsibility to ensure
304 * that the resources are not accessed or passed in subsequent API calls and
305 * doing so will result in undefined behavior. These resources include CUDA types
306 * such as ::cudaStream_t, ::cudaEvent_t, ::cudaArray_t, ::cudaMipmappedArray_t,
307 * ::cudaTextureObject_t, ::cudaSurfaceObject_t, ::textureReference, ::surfaceReference,
308 * ::cudaExternalMemory_t, ::cudaExternalSemaphore_t and ::cudaGraphicsResource_t.
309 * Any subsequent API call to this device will reinitialize the device.
310 *
311 * Note that this function will reset the device immediately. It is the caller's
312 * responsibility to ensure that the device is not being accessed by any
313 * other host threads from the process when this function is called.
314 *
315 * \return
316 * ::cudaSuccess
317 * \notefnerr
318 * \note_init_rt
319 * \note_callback
320 *
321 * \sa ::cudaDeviceSynchronize
322 */
323extern __host__ cudaError_t CUDARTAPI cudaDeviceReset(void);
324
325/**
326 * \brief Wait for compute device to finish
327 *
328 * Blocks until the device has completed all preceding requested tasks.
329 * ::cudaDeviceSynchronize() returns an error if one of the preceding tasks
330 * has failed. If the ::cudaDeviceScheduleBlockingSync flag was set for
331 * this device, the host thread will block until the device has finished
332 * its work.
333 *
334 * \return
335 * ::cudaSuccess
336 * \note_device_sync_deprecated
337 * \notefnerr
338 * \note_init_rt
339 * \note_callback
340 *
341 * \sa
342 * ::cudaDeviceReset,
343 * ::cuCtxSynchronize
344 */
345extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceSynchronize(void);
346
347/**
348 * \brief Set resource limits
349 *
350 * Setting \p limit to \p value is a request by the application to update
351 * the current limit maintained by the device. The driver is free to
352 * modify the requested value to meet h/w requirements (this could be
353 * clamping to minimum or maximum values, rounding up to nearest element
354 * size, etc). The application can use ::cudaDeviceGetLimit() to find out
355 * exactly what the limit has been set to.
356 *
357 * Setting each ::cudaLimit has its own specific restrictions, so each is
358 * discussed here.
359 *
360 * - ::cudaLimitStackSize controls the stack size in bytes of each GPU thread.
361 *
362 * - ::cudaLimitPrintfFifoSize controls the size in bytes of the shared FIFO
363 * used by the ::printf() device system call. Setting
364 * ::cudaLimitPrintfFifoSize must not be performed after launching any kernel
365 * that uses the ::printf() device system call - in such case
366 * ::cudaErrorInvalidValue will be returned.
367 *
368 * - ::cudaLimitMallocHeapSize controls the size in bytes of the heap used by
369 * the ::malloc() and ::free() device system calls. Setting
370 * ::cudaLimitMallocHeapSize must not be performed after launching any kernel
371 * that uses the ::malloc() or ::free() device system calls - in such case
372 * ::cudaErrorInvalidValue will be returned.
373 *
374 * - ::cudaLimitDevRuntimeSyncDepth controls the maximum nesting depth of a
375 * grid at which a thread can safely call ::cudaDeviceSynchronize(). Setting
376 * this limit must be performed before any launch of a kernel that uses the
377 * device runtime and calls ::cudaDeviceSynchronize() above the default sync
378 * depth, two levels of grids. Calls to ::cudaDeviceSynchronize() will fail
379 * with error code ::cudaErrorSyncDepthExceeded if the limitation is
380 * violated. This limit can be set smaller than the default or up the maximum
381 * launch depth of 24. When setting this limit, keep in mind that additional
382 * levels of sync depth require the runtime to reserve large amounts of
383 * device memory which can no longer be used for user allocations. If these
384 * reservations of device memory fail, ::cudaDeviceSetLimit will return
385 * ::cudaErrorMemoryAllocation, and the limit can be reset to a lower value.
386 * This limit is only applicable to devices of compute capability < 9.0.
387 * Attempting to set this limit on devices of other compute capability will
388 * results in error ::cudaErrorUnsupportedLimit being returned.
389 *
390 * - ::cudaLimitDevRuntimePendingLaunchCount controls the maximum number of
391 * outstanding device runtime launches that can be made from the current
392 * device. A grid is outstanding from the point of launch up until the grid
393 * is known to have been completed. Device runtime launches which violate
394 * this limitation fail and return ::cudaErrorLaunchPendingCountExceeded when
395 * ::cudaGetLastError() is called after launch. If more pending launches than
396 * the default (2048 launches) are needed for a module using the device
397 * runtime, this limit can be increased. Keep in mind that being able to
398 * sustain additional pending launches will require the runtime to reserve
399 * larger amounts of device memory upfront which can no longer be used for
400 * allocations. If these reservations fail, ::cudaDeviceSetLimit will return
401 * ::cudaErrorMemoryAllocation, and the limit can be reset to a lower value.
402 * This limit is only applicable to devices of compute capability 3.5 and
403 * higher. Attempting to set this limit on devices of compute capability less
404 * than 3.5 will result in the error ::cudaErrorUnsupportedLimit being
405 * returned.
406 *
407 * - ::cudaLimitMaxL2FetchGranularity controls the L2 cache fetch granularity.
408 * Values can range from 0B to 128B. This is purely a performance hint and
409 * it can be ignored or clamped depending on the platform.
410 *
411 * - ::cudaLimitPersistingL2CacheSize controls size in bytes available
412 * for persisting L2 cache. This is purely a performance hint and it
413 * can be ignored or clamped depending on the platform.
414 *
415 * \param limit - Limit to set
416 * \param value - Size of limit
417 *
418 * \return
419 * ::cudaSuccess,
420 * ::cudaErrorUnsupportedLimit,
421 * ::cudaErrorInvalidValue,
422 * ::cudaErrorMemoryAllocation
423 * \notefnerr
424 * \note_init_rt
425 * \note_callback
426 *
427 * \sa
428 * ::cudaDeviceGetLimit,
429 * ::cuCtxSetLimit
430 */
431extern __host__ cudaError_t CUDARTAPI cudaDeviceSetLimit(enum cudaLimit limit, size_t value);
432
433/**
434 * \brief Return resource limits
435 *
436 * Returns in \p *pValue the current size of \p limit. The following ::cudaLimit values are supported.
437 * - ::cudaLimitStackSize is the stack size in bytes of each GPU thread.
438 * - ::cudaLimitPrintfFifoSize is the size in bytes of the shared FIFO used by the
439 * ::printf() device system call.
440 * - ::cudaLimitMallocHeapSize is the size in bytes of the heap used by the
441 * ::malloc() and ::free() device system calls.
442 * - ::cudaLimitDevRuntimeSyncDepth is the maximum grid depth at which a
443 * thread can isssue the device runtime call ::cudaDeviceSynchronize()
444 * to wait on child grid launches to complete. This functionality is removed
445 * for devices of compute capability >= 9.0, and hence will return error
446 * ::cudaErrorUnsupportedLimit on such devices.
447 * - ::cudaLimitDevRuntimePendingLaunchCount is the maximum number of outstanding
448 * device runtime launches.
449 * - ::cudaLimitMaxL2FetchGranularity is the L2 cache fetch granularity.
450 * - ::cudaLimitPersistingL2CacheSize is the persisting L2 cache size in bytes.
451 *
452 * \param limit - Limit to query
453 * \param pValue - Returned size of the limit
454 *
455 * \return
456 * ::cudaSuccess,
457 * ::cudaErrorUnsupportedLimit,
458 * ::cudaErrorInvalidValue
459 * \notefnerr
460 * \note_init_rt
461 * \note_callback
462 *
463 * \sa
464 * ::cudaDeviceSetLimit,
465 * ::cuCtxGetLimit
466 */
467extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetLimit(size_t *pValue, enum cudaLimit limit);
468
469/**
470 * \brief Returns the maximum number of elements allocatable in a 1D linear texture for a given element size.
471 *
472 * Returns in \p maxWidthInElements the maximum number of elements allocatable in a 1D linear texture
473 * for given format descriptor \p fmtDesc.
474 *
475 * \param maxWidthInElements - Returns maximum number of texture elements allocatable for given \p fmtDesc.
476 * \param fmtDesc - Texture format description.
477 *
478 * \return
479 * ::cudaSuccess,
480 * ::cudaErrorUnsupportedLimit,
481 * ::cudaErrorInvalidValue
482 * \notefnerr
483 * \note_init_rt
484 * \note_callback
485 *
486 * \sa
487 * ::cuDeviceGetTexture1DLinearMaxWidth
488 */
489#if __CUDART_API_VERSION >= 11010
490 extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetTexture1DLinearMaxWidth(size_t *maxWidthInElements, const struct cudaChannelFormatDesc *fmtDesc, int device);
491#endif
492
493/**
494 * \brief Returns the preferred cache configuration for the current device.
495 *
496 * On devices where the L1 cache and shared memory use the same hardware
497 * resources, this returns through \p pCacheConfig the preferred cache
498 * configuration for the current device. This is only a preference. The
499 * runtime will use the requested configuration if possible, but it is free to
500 * choose a different configuration if required to execute functions.
501 *
502 * This will return a \p pCacheConfig of ::cudaFuncCachePreferNone on devices
503 * where the size of the L1 cache and shared memory are fixed.
504 *
505 * The supported cache configurations are:
506 * - ::cudaFuncCachePreferNone: no preference for shared memory or L1 (default)
507 * - ::cudaFuncCachePreferShared: prefer larger shared memory and smaller L1 cache
508 * - ::cudaFuncCachePreferL1: prefer larger L1 cache and smaller shared memory
509 * - ::cudaFuncCachePreferEqual: prefer equal size L1 cache and shared memory
510 *
511 * \param pCacheConfig - Returned cache configuration
512 *
513 * \return
514 * ::cudaSuccess
515 * \notefnerr
516 * \note_init_rt
517 * \note_callback
518 *
519 * \sa ::cudaDeviceSetCacheConfig,
520 * \ref ::cudaFuncSetCacheConfig(const void*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C API)",
521 * \ref ::cudaFuncSetCacheConfig(T*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C++ API)",
522 * ::cuCtxGetCacheConfig
523 */
524extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetCacheConfig(enum cudaFuncCache *pCacheConfig);
525
526/**
527 * \brief Returns numerical values that correspond to the least and
528 * greatest stream priorities.
529 *
530 * Returns in \p *leastPriority and \p *greatestPriority the numerical values that correspond
531 * to the least and greatest stream priorities respectively. Stream priorities
532 * follow a convention where lower numbers imply greater priorities. The range of
533 * meaningful stream priorities is given by [\p *greatestPriority, \p *leastPriority].
534 * If the user attempts to create a stream with a priority value that is
535 * outside the the meaningful range as specified by this API, the priority is
536 * automatically clamped down or up to either \p *leastPriority or \p *greatestPriority
537 * respectively. See ::cudaStreamCreateWithPriority for details on creating a
538 * priority stream.
539 * A NULL may be passed in for \p *leastPriority or \p *greatestPriority if the value
540 * is not desired.
541 *
542 * This function will return '0' in both \p *leastPriority and \p *greatestPriority if
543 * the current context's device does not support stream priorities
544 * (see ::cudaDeviceGetAttribute).
545 *
546 * \param leastPriority - Pointer to an int in which the numerical value for least
547 * stream priority is returned
548 * \param greatestPriority - Pointer to an int in which the numerical value for greatest
549 * stream priority is returned
550 *
551 * \return
552 * ::cudaSuccess
553 * \notefnerr
554 * \note_init_rt
555 * \note_callback
556 *
557 * \sa ::cudaStreamCreateWithPriority,
558 * ::cudaStreamGetPriority,
559 * ::cuCtxGetStreamPriorityRange
560 */
561extern __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetStreamPriorityRange(int *leastPriority, int *greatestPriority);
562
563/**
564 * \brief Sets the preferred cache configuration for the current device.
565 *
566 * On devices where the L1 cache and shared memory use the same hardware
567 * resources, this sets through \p cacheConfig the preferred cache
568 * configuration for the current device. This is only a preference. The
569 * runtime will use the requested configuration if possible, but it is free to
570 * choose a different configuration if required to execute the function. Any
571 * function preference set via
572 * \ref ::cudaFuncSetCacheConfig(const void*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C API)"
573 * or
574 * \ref ::cudaFuncSetCacheConfig(T*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C++ API)"
575 * will be preferred over this device-wide setting. Setting the device-wide
576 * cache configuration to ::cudaFuncCachePreferNone will cause subsequent
577 * kernel launches to prefer to not change the cache configuration unless
578 * required to launch the kernel.
579 *
580 * This setting does nothing on devices where the size of the L1 cache and
581 * shared memory are fixed.
582 *
583 * Launching a kernel with a different preference than the most recent
584 * preference setting may insert a device-side synchronization point.
585 *
586 * The supported cache configurations are:
587 * - ::cudaFuncCachePreferNone: no preference for shared memory or L1 (default)
588 * - ::cudaFuncCachePreferShared: prefer larger shared memory and smaller L1 cache
589 * - ::cudaFuncCachePreferL1: prefer larger L1 cache and smaller shared memory
590 * - ::cudaFuncCachePreferEqual: prefer equal size L1 cache and shared memory
591 *
592 * \param cacheConfig - Requested cache configuration
593 *
594 * \return
595 * ::cudaSuccess
596 * \notefnerr
597 * \note_init_rt
598 * \note_callback
599 *
600 * \sa ::cudaDeviceGetCacheConfig,
601 * \ref ::cudaFuncSetCacheConfig(const void*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C API)",
602 * \ref ::cudaFuncSetCacheConfig(T*, enum cudaFuncCache) "cudaFuncSetCacheConfig (C++ API)",
603 * ::cuCtxSetCacheConfig
604 */
605extern __host__ cudaError_t CUDARTAPI cudaDeviceSetCacheConfig(enum cudaFuncCache cacheConfig);
606
607/**
608 * \brief Returns a handle to a compute device
609 *
610 * Returns in \p *device a device ordinal given a PCI bus ID string.
611 *
612 * \param device - Returned device ordinal
613 *
614 * \param pciBusId - String in one of the following forms:
615 * [domain]:[bus]:[device].[function]
616 * [domain]:[bus]:[device]
617 * [bus]:[device].[function]
618 * where \p domain, \p bus, \p device, and \p function are all hexadecimal values
619 *
620 * \return
621 * ::cudaSuccess,
622 * ::cudaErrorInvalidValue,
623 * ::cudaErrorInvalidDevice
624 * \notefnerr
625 * \note_init_rt
626 * \note_callback
627 *
628 * \sa
629 * ::cudaDeviceGetPCIBusId,
630 * ::cuDeviceGetByPCIBusId
631 */
632extern __host__ cudaError_t CUDARTAPI cudaDeviceGetByPCIBusId(int *device, const char *pciBusId);
633
634/**
635 * \brief Returns a PCI Bus Id string for the device
636 *
637 * Returns an ASCII string identifying the device \p dev in the NULL-terminated
638 * string pointed to by \p pciBusId. \p len specifies the maximum length of the
639 * string that may be returned.
640 *
641 * \param pciBusId - Returned identifier string for the device in the following format
642 * [domain]:[bus]:[device].[function]
643 * where \p domain, \p bus, \p device, and \p function are all hexadecimal values.
644 * pciBusId should be large enough to store 13 characters including the NULL-terminator.
645 *
646 * \param len - Maximum length of string to store in \p name
647 *
648 * \param device - Device to get identifier string for
649 *
650 * \return
651 * ::cudaSuccess,
652 * ::cudaErrorInvalidValue,
653 * ::cudaErrorInvalidDevice
654 * \notefnerr
655 * \note_init_rt
656 * \note_callback
657 *
658 * \sa
659 * ::cudaDeviceGetByPCIBusId,
660 * ::cuDeviceGetPCIBusId
661 */
662extern __host__ cudaError_t CUDARTAPI cudaDeviceGetPCIBusId(char *pciBusId, int len, int device);
663
664/**
665 * \brief Gets an interprocess handle for a previously allocated event
666 *
667 * Takes as input a previously allocated event. This event must have been
668 * created with the ::cudaEventInterprocess and ::cudaEventDisableTiming
669 * flags set. This opaque handle may be copied into other processes and
670 * opened with ::cudaIpcOpenEventHandle to allow efficient hardware
671 * synchronization between GPU work in different processes.
672 *
673 * After the event has been been opened in the importing process,
674 * ::cudaEventRecord, ::cudaEventSynchronize, ::cudaStreamWaitEvent and
675 * ::cudaEventQuery may be used in either process. Performing operations
676 * on the imported event after the exported event has been freed
677 * with ::cudaEventDestroy will result in undefined behavior.
678 *
679 * IPC functionality is restricted to devices with support for unified
680 * addressing on Linux and Windows operating systems.
681 * IPC functionality on Windows is restricted to GPUs in TCC mode.
682 * Users can test their device for IPC functionality by calling
683 * ::cudaDeviceGetAttribute with ::cudaDevAttrIpcEventSupport
684 *
685 * \param handle - Pointer to a user allocated cudaIpcEventHandle
686 * in which to return the opaque event handle
687 * \param event - Event allocated with ::cudaEventInterprocess and
688 * ::cudaEventDisableTiming flags.
689 *
690 * \return
691 * ::cudaSuccess,
692 * ::cudaErrorInvalidResourceHandle,
693 * ::cudaErrorMemoryAllocation,
694 * ::cudaErrorMapBufferObjectFailed,
695 * ::cudaErrorNotSupported,
696 * ::cudaErrorInvalidValue
697 * \note_init_rt
698 * \note_callback
699 *
700 * \sa
701 * ::cudaEventCreate,
702 * ::cudaEventDestroy,
703 * ::cudaEventSynchronize,
704 * ::cudaEventQuery,
705 * ::cudaStreamWaitEvent,
706 * ::cudaIpcOpenEventHandle,
707 * ::cudaIpcGetMemHandle,
708 * ::cudaIpcOpenMemHandle,
709 * ::cudaIpcCloseMemHandle,
710 * ::cuIpcGetEventHandle
711 */
712extern __host__ cudaError_t CUDARTAPI cudaIpcGetEventHandle(cudaIpcEventHandle_t *handle, cudaEvent_t event);
713
714/**
715 * \brief Opens an interprocess event handle for use in the current process
716 *
717 * Opens an interprocess event handle exported from another process with
718 * ::cudaIpcGetEventHandle. This function returns a ::cudaEvent_t that behaves like
719 * a locally created event with the ::cudaEventDisableTiming flag specified.
720 * This event must be freed with ::cudaEventDestroy.
721 *
722 * Performing operations on the imported event after the exported event has
723 * been freed with ::cudaEventDestroy will result in undefined behavior.
724 *
725 * IPC functionality is restricted to devices with support for unified
726 * addressing on Linux and Windows operating systems.
727 * IPC functionality on Windows is restricted to GPUs in TCC mode.
728 * Users can test their device for IPC functionality by calling
729 * ::cudaDeviceGetAttribute with ::cudaDevAttrIpcEventSupport
730 *
731 * \param event - Returns the imported event
732 * \param handle - Interprocess handle to open
733 *
734 * \returns
735 * ::cudaSuccess,
736 * ::cudaErrorMapBufferObjectFailed,
737 * ::cudaErrorNotSupported,
738 * ::cudaErrorInvalidValue,
739 * ::cudaErrorDeviceUninitialized
740 * \note_init_rt
741 * \note_callback
742 *
743 * \sa
744 * ::cudaEventCreate,
745 * ::cudaEventDestroy,
746 * ::cudaEventSynchronize,
747 * ::cudaEventQuery,
748 * ::cudaStreamWaitEvent,
749 * ::cudaIpcGetEventHandle,
750 * ::cudaIpcGetMemHandle,
751 * ::cudaIpcOpenMemHandle,
752 * ::cudaIpcCloseMemHandle,
753 * ::cuIpcOpenEventHandle
754 */
755extern __host__ cudaError_t CUDARTAPI cudaIpcOpenEventHandle(cudaEvent_t *event, cudaIpcEventHandle_t handle);
756
757/**
758 * \brief Gets an interprocess memory handle for an existing device memory
759 * allocation
760 *
761 * Takes a pointer to the base of an existing device memory allocation created
762 * with ::cudaMalloc and exports it for use in another process. This is a
763 * lightweight operation and may be called multiple times on an allocation
764 * without adverse effects.
765 *
766 * If a region of memory is freed with ::cudaFree and a subsequent call
767 * to ::cudaMalloc returns memory with the same device address,
768 * ::cudaIpcGetMemHandle will return a unique handle for the
769 * new memory.
770 *
771 * IPC functionality is restricted to devices with support for unified
772 * addressing on Linux and Windows operating systems.
773 * IPC functionality on Windows is restricted to GPUs in TCC mode.
774 * Users can test their device for IPC functionality by calling
775 * ::cudaDeviceGetAttribute with ::cudaDevAttrIpcEventSupport
776 *
777 * \param handle - Pointer to user allocated ::cudaIpcMemHandle to return
778 * the handle in.
779 * \param devPtr - Base pointer to previously allocated device memory
780 *
781 * \returns
782 * ::cudaSuccess,
783 * ::cudaErrorMemoryAllocation,
784 * ::cudaErrorMapBufferObjectFailed,
785 * ::cudaErrorNotSupported,
786 * ::cudaErrorInvalidValue
787 * \note_init_rt
788 * \note_callback
789 *
790 * \sa
791 * ::cudaMalloc,
792 * ::cudaFree,
793 * ::cudaIpcGetEventHandle,
794 * ::cudaIpcOpenEventHandle,
795 * ::cudaIpcOpenMemHandle,
796 * ::cudaIpcCloseMemHandle,
797 * ::cuIpcGetMemHandle
798 */
799extern __host__ cudaError_t CUDARTAPI cudaIpcGetMemHandle(cudaIpcMemHandle_t *handle, void *devPtr);
800
801/**
802 * \brief Opens an interprocess memory handle exported from another process
803 * and returns a device pointer usable in the local process.
804 *
805 * Maps memory exported from another process with ::cudaIpcGetMemHandle into
806 * the current device address space. For contexts on different devices
807 * ::cudaIpcOpenMemHandle can attempt to enable peer access between the
808 * devices as if the user called ::cudaDeviceEnablePeerAccess. This behavior is
809 * controlled by the ::cudaIpcMemLazyEnablePeerAccess flag.
810 * ::cudaDeviceCanAccessPeer can determine if a mapping is possible.
811 *
812 * ::cudaIpcOpenMemHandle can open handles to devices that may not be visible
813 * in the process calling the API.
814 *
815 * Contexts that may open ::cudaIpcMemHandles are restricted in the following way.
816 * ::cudaIpcMemHandles from each device in a given process may only be opened
817 * by one context per device per other process.
818 *
819 * If the memory handle has already been opened by the current context, the
820 * reference count on the handle is incremented by 1 and the existing device pointer
821 * is returned.
822 *
823 * Memory returned from ::cudaIpcOpenMemHandle must be freed with
824 * ::cudaIpcCloseMemHandle.
825 *
826 * Calling ::cudaFree on an exported memory region before calling
827 * ::cudaIpcCloseMemHandle in the importing context will result in undefined
828 * behavior.
829 *
830 * IPC functionality is restricted to devices with support for unified
831 * addressing on Linux and Windows operating systems.
832 * IPC functionality on Windows is restricted to GPUs in TCC mode.
833 * Users can test their device for IPC functionality by calling
834 * ::cudaDeviceGetAttribute with ::cudaDevAttrIpcEventSupport
835 *
836 * \param devPtr - Returned device pointer
837 * \param handle - ::cudaIpcMemHandle to open
838 * \param flags - Flags for this operation. Must be specified as ::cudaIpcMemLazyEnablePeerAccess
839 *
840 * \returns
841 * ::cudaSuccess,
842 * ::cudaErrorMapBufferObjectFailed,
843 * ::cudaErrorInvalidResourceHandle,
844 * ::cudaErrorDeviceUninitialized,
845 * ::cudaErrorTooManyPeers,
846 * ::cudaErrorNotSupported,
847 * ::cudaErrorInvalidValue
848 * \note_init_rt
849 * \note_callback
850 *
851 * \note No guarantees are made about the address returned in \p *devPtr.
852 * In particular, multiple processes may not receive the same address for the same \p handle.
853 *
854 * \sa
855 * ::cudaMalloc,
856 * ::cudaFree,
857 * ::cudaIpcGetEventHandle,
858 * ::cudaIpcOpenEventHandle,
859 * ::cudaIpcGetMemHandle,
860 * ::cudaIpcCloseMemHandle,
861 * ::cudaDeviceEnablePeerAccess,
862 * ::cudaDeviceCanAccessPeer,
863 * ::cuIpcOpenMemHandle
864 */
865extern __host__ cudaError_t CUDARTAPI cudaIpcOpenMemHandle(void **devPtr, cudaIpcMemHandle_t handle, unsigned int flags);
866
867/**
868 * \brief Attempts to close memory mapped with cudaIpcOpenMemHandle
869 *
870 * Decrements the reference count of the memory returnd by ::cudaIpcOpenMemHandle by 1.
871 * When the reference count reaches 0, this API unmaps the memory. The original allocation
872 * in the exporting process as well as imported mappings in other processes
873 * will be unaffected.
874 *
875 * Any resources used to enable peer access will be freed if this is the
876 * last mapping using them.
877 *
878 * IPC functionality is restricted to devices with support for unified
879 * addressing on Linux and Windows operating systems.
880 * IPC functionality on Windows is restricted to GPUs in TCC mode.
881 * Users can test their device for IPC functionality by calling
882 * ::cudaDeviceGetAttribute with ::cudaDevAttrIpcEventSupport
883 *
884 * \param devPtr - Device pointer returned by ::cudaIpcOpenMemHandle
885 *
886 * \returns
887 * ::cudaSuccess,
888 * ::cudaErrorMapBufferObjectFailed,
889 * ::cudaErrorNotSupported,
890 * ::cudaErrorInvalidValue
891 * \note_init_rt
892 * \note_callback
893 *
894 * \sa
895 * ::cudaMalloc,
896 * ::cudaFree,
897 * ::cudaIpcGetEventHandle,
898 * ::cudaIpcOpenEventHandle,
899 * ::cudaIpcGetMemHandle,
900 * ::cudaIpcOpenMemHandle,
901 * ::cuIpcCloseMemHandle
902 */
903extern __host__ cudaError_t CUDARTAPI cudaIpcCloseMemHandle(void *devPtr);
904
905/**
906 * \brief Blocks until remote writes are visible to the specified scope
907 *
908 * Blocks until remote writes to the target context via mappings created
909 * through GPUDirect RDMA APIs, like nvidia_p2p_get_pages (see
910 * https://docs.nvidia.com/cuda/gpudirect-rdma for more information), are
911 * visible to the specified scope.
912 *
913 * If the scope equals or lies within the scope indicated by
914 * ::cudaDevAttrGPUDirectRDMAWritesOrdering, the call will be a no-op and
915 * can be safely omitted for performance. This can be determined by
916 * comparing the numerical values between the two enums, with smaller
917 * scopes having smaller values.
918 *
919 * Users may query support for this API via ::cudaDevAttrGPUDirectRDMAFlushWritesOptions.
920 *
921 * \param target - The target of the operation, see cudaFlushGPUDirectRDMAWritesTarget
922 * \param scope - The scope of the operation, see cudaFlushGPUDirectRDMAWritesScope
923 *
924 * \return
925 * ::cudaSuccess,
926 * ::cudaErrorNotSupported,
927 * \notefnerr
928 * \note_init_rt
929 * \note_callback
930 *
931 * \sa
932 * ::cuFlushGPUDirectRDMAWrites
933 */
934#if __CUDART_API_VERSION >= 11030
935extern __host__ cudaError_t CUDARTAPI cudaDeviceFlushGPUDirectRDMAWrites(enum cudaFlushGPUDirectRDMAWritesTarget target, enum cudaFlushGPUDirectRDMAWritesScope scope);
936#endif
937
938/**
939* \brief Registers a callback function to receive async notifications
940*
941* Registers \p callbackFunc to receive async notifications.
942*
943* The \p userData parameter is passed to the callback function at async notification time.
944* Likewise, \p callback is also passed to the callback function to distinguish between
945* multiple registered callbacks.
946*
947* The callback function being registered should be designed to return quickly (~10ms).
948* Any long running tasks should be queued for execution on an application thread.
949*
950* Callbacks may not call cudaDeviceRegisterAsyncNotification or cudaDeviceUnregisterAsyncNotification.
951* Doing so will result in ::cudaErrorNotPermitted. Async notification callbacks execute
952* in an undefined order and may be serialized.
953*
954* Returns in \p *callback a handle representing the registered callback instance.
955*
956* \param device - The device on which to register the callback
957* \param callbackFunc - The function to register as a callback
958* \param userData - A generic pointer to user data. This is passed into the callback function.
959* \param callback - A handle representing the registered callback instance
960*
961* \return
962* ::cudaSuccess
963* ::cudaErrorNotSupported
964* ::cudaErrorInvalidDevice
965* ::cudaErrorInvalidValue
966* ::cudaErrorNotPermitted
967* ::cudaErrorUnknown
968* \notefnerr
969*
970* \sa
971* ::cudaDeviceUnregisterAsyncNotification
972*/
973extern __host__ cudaError_t CUDARTAPI cudaDeviceRegisterAsyncNotification(int device, cudaAsyncCallback callbackFunc, void* userData, cudaAsyncCallbackHandle_t* callback);
974
975/**
976* \brief Unregisters an async notification callback
977*
978* Unregisters \p callback so that the corresponding callback function will stop receiving
979* async notifications.
980*
981* \param device - The device from which to remove \p callback.
982* \param callback - The callback instance to unregister from receiving async notifications.
983*
984* \return
985* ::cudaSuccess
986* ::cudaErrorNotSupported
987* ::cudaErrorInvalidDevice
988* ::cudaErrorInvalidValue
989* ::cudaErrorNotPermitted
990* ::cudaErrorUnknown
991* \notefnerr
992*
993* \sa
994* ::cudaDeviceRegisterAsyncNotification
995*/
996extern __host__ cudaError_t CUDARTAPI cudaDeviceUnregisterAsyncNotification(int device, cudaAsyncCallbackHandle_t callback);
997
998/** @} */ /* END CUDART_DEVICE */
999
1000/**
1001 * \defgroup CUDART_DEVICE_DEPRECATED Device Management [DEPRECATED]
1002 *
1003 * ___MANBRIEF___ deprecated device management functions of the CUDA runtime API
1004 * (___CURRENT_FILE___) ___ENDMANBRIEF___
1005 *
1006 * This section describes the deprecated device management functions of the CUDA runtime
1007 * application programming interface.
1008 *
1009 * @{
1010 */
1011
1012/**
1013 * \brief Returns the shared memory configuration for the current device.
1014 *
1015 * \deprecated
1016 *
1017 * This function will return in \p pConfig the current size of shared memory banks
1018 * on the current device. On devices with configurable shared memory banks,
1019 * ::cudaDeviceSetSharedMemConfig can be used to change this setting, so that all
1020 * subsequent kernel launches will by default use the new bank size. When
1021 * ::cudaDeviceGetSharedMemConfig is called on devices without configurable shared
1022 * memory, it will return the fixed bank size of the hardware.
1023 *
1024 * The returned bank configurations can be either:
1025 * - ::cudaSharedMemBankSizeFourByte - shared memory bank width is four bytes.
1026 * - ::cudaSharedMemBankSizeEightByte - shared memory bank width is eight bytes.
1027 *
1028 * \param pConfig - Returned cache configuration
1029 *
1030 * \return
1031 * ::cudaSuccess,
1032 * ::cudaErrorInvalidValue
1033 * \notefnerr
1034 * \note_init_rt
1035 * \note_callback
1036 *
1037 * \sa ::cudaDeviceSetCacheConfig,
1038 * ::cudaDeviceGetCacheConfig,
1039 * ::cudaDeviceSetSharedMemConfig,
1040 * ::cudaFuncSetCacheConfig,
1041 * ::cuCtxGetSharedMemConfig
1042 */
1043extern __CUDA_DEPRECATED __host__ __cudart_builtin__ cudaError_t CUDARTAPI cudaDeviceGetSharedMemConfig(enum cudaSharedMemConfig *pConfig);
1044
1045/**
1046 * \brief Sets the shared memory configuration for the current device.
1047 *
1048 * \deprecated
1049 *
1050 * On devices with configurable shared memory banks, this function will set
1051 * the shared memory bank size which is used for all subsequent kernel launches.
1052 * Any per-function setting of shared memory set via ::cudaFuncSetSharedMemConfig
1053 * will override the device wide setting.
1054 *
1055 * Changing the shared memory configuration between launches may introduce
1056 * a device side synchronization point.
1057 *
1058 * Changing the shared memory bank size will not increase shared memory usage
1059 * or affect occupancy of kernels, but may have major effects on performance.
1060 * Larger bank sizes will allow for greater potential bandwidth to shared memory,
1061 * but will change what kinds of accesses to shared memory will result in bank
1062 * conflicts.
1063 *
1064 * This function will do nothing on devices with fixed shared memory bank size.
1065 *
1066 * The supported bank configurations are:
1067 * - ::cudaSharedMemBankSizeDefault: set bank width the device default (currently,
1068 * four bytes)
1069 * - ::cudaSharedMemBankSizeFourByte: set shared memory bank width to be four bytes
1070 * natively.
1071 * - ::cudaSharedMemBankSizeEightByte: set shared memory bank width to be eight
1072 * bytes natively.
1073 *
1074 * \param config - Requested cache configuration
1075 *
1076 * \return
1077 * ::cudaSuccess,
1078 * ::cudaErrorInvalidValue
1079 * \notefnerr
1080 * \note_init_rt
1081 * \note_callback
1082 *
1083 * \sa ::cudaDeviceSetCacheConfig,
1084 * ::cudaDeviceGetCacheConfig,
1085 * ::cudaDeviceGetSharedMemConfig,
1086 * ::cudaFuncSetCacheConfig,
1087 * ::cuCtxSetSharedMemConfig
1088 */
1089extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaDeviceSetSharedMemConfig(enum cudaSharedMemConfig config);
1090/** @} */ /* END CUDART_DEVICE_DEPRECATED */
1091
1092/**
1093 * \defgroup CUDART_THREAD_DEPRECATED Thread Management [DEPRECATED]
1094 *
1095 * ___MANBRIEF___ deprecated thread management functions of the CUDA runtime
1096 * API (___CURRENT_FILE___) ___ENDMANBRIEF___
1097 *
1098 * This section describes deprecated thread management functions of the CUDA runtime
1099 * application programming interface.
1100 *
1101 * @{
1102 */
1103
1104/**
1105 * \brief Exit and clean up from CUDA launches
1106 *
1107 * \deprecated
1108 *
1109 * Note that this function is deprecated because its name does not
1110 * reflect its behavior. Its functionality is identical to the
1111 * non-deprecated function ::cudaDeviceReset(), which should be used
1112 * instead.
1113 *
1114 * Explicitly destroys all cleans up all resources associated with the current
1115 * device in the current process. Any subsequent API call to this device will
1116 * reinitialize the device.
1117 *
1118 * Note that this function will reset the device immediately. It is the caller's
1119 * responsibility to ensure that the device is not being accessed by any
1120 * other host threads from the process when this function is called.
1121 *
1122 * \return
1123 * ::cudaSuccess
1124 * \notefnerr
1125 * \note_init_rt
1126 * \note_callback
1127 *
1128 * \sa ::cudaDeviceReset
1129 */
1130extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadExit(void);
1131
1132/**
1133 * \brief Wait for compute device to finish
1134 *
1135 * \deprecated
1136 *
1137 * Note that this function is deprecated because its name does not
1138 * reflect its behavior. Its functionality is similar to the
1139 * non-deprecated function ::cudaDeviceSynchronize(), which should be used
1140 * instead.
1141 *
1142 * Blocks until the device has completed all preceding requested tasks.
1143 * ::cudaThreadSynchronize() returns an error if one of the preceding tasks
1144 * has failed. If the ::cudaDeviceScheduleBlockingSync flag was set for
1145 * this device, the host thread will block until the device has finished
1146 * its work.
1147 *
1148 * \return
1149 * ::cudaSuccess
1150 * \notefnerr
1151 * \note_init_rt
1152 * \note_callback
1153 *
1154 * \sa ::cudaDeviceSynchronize
1155 */
1156extern __CUDA_DEPRECATED __host__ cudaError_t CUDARTAPI cudaThreadSynchronize(void);
1157
1158/**
1159 * \brief Set resource limits
1160 *
1161 * \deprecated
1162 *
1163 * Note that this function is deprecated because its name does not
1164 * reflect its behavior. Its functionality is identical to the
1165 * non-deprecated function ::cudaDeviceSetLimit(), which should be used
1166 * instead.
1167 *
1168 * Setting \p limit to \p value is a request by the application to update
1169 * the current limit maintained by the device. The driver is free to
1170 * modify the requested value to meet h/w requirements (this could be
1171 * clamping to minimum or maximum values, rounding up to nearest element
1172 * size, etc). The application can use ::cudaThreadGetLimit() to find out
1173 * exactly what the limit has been set to.
1174 *
1175 * Setting each ::cudaLimit has its own specific restrictions, so each is
1176 * discussed here.
1177 *
1178 * - ::cudaLimitStackSize controls the stack size of each GPU thread.
1179 *
1180 * - ::cudaLimitPrintfFifoSize controls the size of the shared FIFO
1181 * used by the ::printf() device system call.
1182 * Setting ::cudaLimitPrintfFifoSize must be performed before
1183 * launching any kernel that uses the ::printf() device
1184 * system call, otherwise ::cudaErrorInvalidValue will be returned.
1185 *
1186 * - ::cudaLimitMallocHeapSize controls the size of the heap used
1187 * by the ::malloc() and ::free() device system calls. Setting
1188 * ::cudaLimitMallocHeapSize must be performed before launching
1189 * any kernel that uses the ::malloc() or ::free() device system calls,
1190 * otherwise ::cudaErrorInvalidValue will be returned.
1191 *
1192 * \param limit - Limit to set
1193 * \param value - Size in bytes of limit
1194 *
1195 * \return
1196 * ::cudaSuccess,
1197 * ::cudaErrorUnsupportedLimit,
1198 * ::cudaErrorInvalidValue
1199 * \notefnerr
1200 * \note_init_rt
