Sophie

Sophie

distrib > Mageia > 5 > x86_64 > media > nonfree-release > by-pkgid > d44b02ea46d82d6a48df31bbd1a088f3 > files > 1771

nvidia-cuda-toolkit-devel-6.5.14-6.mga5.nonfree.x86_64.rpm

.TH "Interactions with the CUDA Driver API" 3 "7 Aug 2014" "Version 6.0" "Doxygen" \" -*- nroff -*-
.ad l
.nh
.SH NAME
Interactions with the CUDA Driver API \- \\brief interactions between CUDA Driver API and CUDA Runtime API (cuda_runtime_api.h)
.PP
This section describes the interactions between the CUDA Driver API and the CUDA Runtime API
.SH "Primary Contexts"
.PP
There exists a one to one relationship between CUDA devices in the CUDA Runtime API and CUcontext s in the CUDA Driver API within a process. The specific context which the CUDA Runtime API uses for a device is called the device's primary context. From the perspective of the CUDA Runtime API, a device and its primary context are synonymous.
.SH "Initialization and Tear-Down"
.PP
CUDA Runtime API calls operate on the CUDA Driver API CUcontext which is current to to the calling host thread.
.PP
The function \fBcudaSetDevice()\fP makes the primary context for the specified device current to the calling thread by calling cuCtxSetCurrent().
.PP
The CUDA Runtime API will automatically initialize the primary context for a device at the first CUDA Runtime API call which requires an active context. If no CUcontext is current to the calling thread when a CUDA Runtime API call which requires an active context is made, then the primary context for a device will be selected, made current to the calling thread, and initialized.
.PP
The context which the CUDA Runtime API initializes will be initialized using the parameters specified by the CUDA Runtime API functions \fBcudaSetDeviceFlags()\fP, \fBcudaD3D9SetDirect3DDevice()\fP, \fBcudaD3D10SetDirect3DDevice()\fP, \fBcudaD3D11SetDirect3DDevice()\fP, \fBcudaGLSetGLDevice()\fP, and \fBcudaVDPAUSetVDPAUDevice()\fP. Note that these functions will fail with \fBcudaErrorSetOnActiveProcess\fP if they are called when the primary context for the specified device has already been initialized. (or if the current device has already been initialized, in the case of \fBcudaSetDeviceFlags()\fP).
.PP
Primary contexts will remain active until they are explicitly deinitialized using \fBcudaDeviceReset()\fP. The function \fBcudaDeviceReset()\fP will deinitialize the primary context for the calling thread's current device immediately. The context will remain current to all of the threads that it was current to. The next CUDA Runtime API call on any thread which requires an active context will trigger the reinitialization of that device's primary context.
.PP
Note that there is no reference counting of the primary context's lifetime. It is recommended that the primary context not be deinitialized except just before exit or to recover from an unspecified launch failure.
.SH "Context Interoperability"
.PP
Note that the use of multiple CUcontext s per device within a single process will substantially degrade performance and is strongly discouraged. Instead, it is highly recommended that the implicit one-to-one device-to-context mapping for the process provided by the CUDA Runtime API be used.
.PP
If a non-primary CUcontext created by the CUDA Driver API is current to a thread then the CUDA Runtime API calls to that thread will operate on that CUcontext, with some exceptions listed below. Interoperability between data types is discussed in the following sections.
.PP
The function \fBcudaPointerGetAttributes()\fP will return the error \fBcudaErrorIncompatibleDriverContext\fP if the pointer being queried was allocated by a non-primary context. The function \fBcudaDeviceEnablePeerAccess()\fP and the rest of the peer access API may not be called when a non-primary CUcontext is current. To use the pointer query and peer access APIs with a context created using the CUDA Driver API, it is necessary that the CUDA Driver API be used to access these features.
.PP
All CUDA Runtime API state (e.g, global variables' addresses and values) travels with its underlying CUcontext. In particular, if a CUcontext is moved from one thread to another then all CUDA Runtime API state will move to that thread as well.
.PP
Please note that attaching to legacy contexts (those with a version of 3010 as returned by cuCtxGetApiVersion()) is not possible. The CUDA Runtime will return \fBcudaErrorIncompatibleDriverContext\fP in such cases.
.SH "Interactions between CUstream and cudaStream_t"
.PP
The types CUstream and \fBcudaStream_t\fP are identical and may be used interchangeably.
.SH "Interactions between CUevent and cudaEvent_t"
.PP
The types CUevent and \fBcudaEvent_t\fP are identical and may be used interchangeably.
.SH "Interactions between CUarray and cudaArray_t"
.PP
The types CUarray and struct cudaArray * represent the same data type and may be used interchangeably by casting the two types between each other.
.PP
In order to use a CUarray in a CUDA Runtime API function which takes a struct cudaArray *, it is necessary to explicitly cast the CUarray to a struct cudaArray *.
.PP
In order to use a struct cudaArray * in a CUDA Driver API function which takes a CUarray, it is necessary to explicitly cast the struct cudaArray * to a CUarray .
.SH "Interactions between CUgraphicsResource and cudaGraphicsResource_t"
.PP
The types CUgraphicsResource and \fBcudaGraphicsResource_t\fP represent the same data type and may be used interchangeably by casting the two types between each other.
.PP
In order to use a CUgraphicsResource in a CUDA Runtime API function which takes a \fBcudaGraphicsResource_t\fP, it is necessary to explicitly cast the CUgraphicsResource to a \fBcudaGraphicsResource_t\fP.
.PP
In order to use a \fBcudaGraphicsResource_t\fP in a CUDA Driver API function which takes a CUgraphicsResource, it is necessary to explicitly cast the \fBcudaGraphicsResource_t\fP to a CUgraphicsResource. 
.SH "Author"
.PP 
Generated automatically by Doxygen from the source code.