1 pCtx, unsigned int Flags)pCtx, unsigned int Flags, \fBCUdevice\fP dev)ctx)pCtx)device)pCtx)NewCtx).TH "Module Management" 3 "30 Mar 2009" "Version 2.2" "NVIDIA CUDA Library" \" -*- nroff -*-
10 .RI "\fBCUresult\fP \fBcuModuleGetFunction\fP (\fBCUfunction\fP *func, \fBCUmodule\fP mod, const char *name)"
12 .RI "\fIReturns a function handle. \fP"
14 .RI "\fBCUresult\fP \fBcuModuleGetGlobal\fP (\fBCUdeviceptr\fP *ret_dptr, unsigned int *ret_bytes, \fBCUmodule\fP mod, const char *name)"
16 .RI "\fIReturns a global pointer from a module. \fP"
18 .RI "\fBCUresult\fP \fBcuModuleGetTexRef\fP (\fBCUtexref\fP *ppTexRef, \fBCUmodule\fP mod, const char *name)"
20 .RI "\fIReturns a handle to a texture-reference. \fP"
22 .RI "\fBCUresult\fP \fBcuModuleLoad\fP (\fBCUmodule\fP *phMod, const char *fname)"
24 .RI "\fILoads a compute module. \fP"
26 .RI "\fBCUresult\fP \fBcuModuleLoadData\fP (\fBCUmodule\fP *phMod, const void *p)"
28 .RI "\fILoad a module's data. \fP"
30 .RI "\fBCUresult\fP \fBcuModuleLoadDataEx\fP (\fBCUmodule\fP *phMod, const void *p, unsigned int numOptions, \fBCUjit_option\fP *options, void **optionValues)"
32 .RI "\fILoad a module's data with options. \fP"
34 .RI "\fBCUresult\fP \fBcuModuleLoadFatBinary\fP (\fBCUmodule\fP *phMod, const void *vfatCubin)"
36 .RI "\fILoad a module's data. \fP"
38 .RI "\fBCUresult\fP \fBcuModuleUnload\fP (\fBCUmodule\fP mod)"
40 .RI "\fIUnloads a module. \fP"
42 .SH "Detailed Description"
44 This section describes the module management functions of the low-level CUDA driver application programming interface.
45 .SH "Function Documentation"
47 .SS "\fBCUresult\fP cuModuleGetFunction (\fBCUfunction\fP * func, \fBCUmodule\fP mod, const char * name)"
49 Returns in \fC*func\fP the handle of the function of name \fCname\fP located in module \fCmod\fP. If no function of that name exists, \fBcuModuleGetFunction()\fP returns \fBCUDA_ERROR_NOT_FOUND\fP.
53 \fIfunc\fP - Returned function handle
55 \fImod\fP - Module to retrieve function from
57 \fIname\fP - Name of function to retrieve
62 \fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_NOT_FOUND\fP
67 Note that this function may also return error codes from previous, asynchronous launches.
72 \fBcuModuleGetGlobal\fP, \fBcuModuleGetTexRef\fP, \fBcuModuleLoad\fP, \fBcuModuleLoadData\fP, \fBcuModuleLoadDataEx\fP, \fBcuModuleLoadFatBinary\fP, \fBcuModuleUnload\fP
76 .SS "\fBCUresult\fP cuModuleGetGlobal (\fBCUdeviceptr\fP * ret_dptr, unsigned int * ret_bytes, \fBCUmodule\fP mod, const char * name)"
78 Returns in \fC*ret_dptr\fP and \fC*ret_bytes\fP the base pointer and size of the global of name \fCname\fP located in module \fCmod\fP. If no variable of that name exists, \fBcuModuleGetGlobal()\fP returns \fBCUDA_ERROR_NOT_FOUND\fP. Both parameters \fCret_dptr\fP and \fCret_bytes\fP are optional. If one of them is NULL, it is ignored.
82 \fIret_dptr\fP - Returned global device pointer
84 \fIret_bytes\fP - Returned global size in bytes
86 \fImod\fP - Module to retrieve function from
88 \fIname\fP - Name of global to retrieve
93 \fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_NOT_FOUND\fP
98 Note that this function may also return error codes from previous, asynchronous launches.
103 \fBcuModuleGetFunction\fP, \fBcuModuleGetTexRef\fP, \fBcuModuleLoad\fP, \fBcuModuleLoadData\fP, \fBcuModuleLoadDataEx\fP, \fBcuModuleLoadFatBinary\fP, \fBcuModuleUnload\fP
107 .SS "\fBCUresult\fP cuModuleGetTexRef (\fBCUtexref\fP * ppTexRef, \fBCUmodule\fP mod, const char * name)"
109 Returns in \fC*ppTexRef\fP the handle of the texture reference of name \fCname\fP in the module \fCmod\fP. If no texture reference of that name exists, \fBcuModuleGetTexRef()\fP returns \fBCUDA_ERROR_NOT_FOUND\fP. This texture reference handle should not be destroyed, since it will be destroyed when the module is unloaded.
113 \fIppTexRef\fP - Returned global device pointer
115 \fImod\fP - Module to retrieve texture-reference from
117 \fIname\fP - Name of texture-reference to retrieve
122 \fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_NOT_FOUND\fP
127 Note that this function may also return error codes from previous, asynchronous launches.
132 \fBcuModuleGetFunction\fP, \fBcuModuleGetGlobal\fP, \fBcuModuleLoad\fP, \fBcuModuleLoadData\fP, \fBcuModuleLoadDataEx\fP, \fBcuModuleLoadFatBinary\fP, \fBcuModuleUnload\fP
136 .SS "\fBCUresult\fP cuModuleLoad (\fBCUmodule\fP * phMod, const char * fname)"
138 Takes a filename \fCfname\fP and loads the corresponding module \fCphMod\fP into the current context. The CUDA driver API does not attempt to lazily allocate the resources needed by a module; if the memory for functions and data (constant and global) needed by the module cannot be allocated, \fBcuModuleLoad()\fP fails. The file should be a \fIcubin\fP file as output by \fBnvcc\fP or a \fIPTX\fP file, either as output by \fBnvcc\fP or handwrtten.
142 \fIphMod\fP - Returned module
144 \fIfname\fP - Filename of module to load
149 \fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_NOT_FOUND\fP, \fBCUDA_ERROR_OUT_OF_MEMORY\fP, \fBCUDA_ERROR_FILE_NOT_FOUND\fP
154 Note that this function may also return error codes from previous, asynchronous launches.
159 \fBcuModuleGetFunction\fP, \fBcuModuleGetGlobal\fP, \fBcuModuleGetTexRef\fP, \fBcuModuleLoadData\fP, \fBcuModuleLoadDataEx\fP, \fBcuModuleLoadFatBinary\fP, \fBcuModuleUnload\fP
163 .SS "\fBCUresult\fP cuModuleLoadData (\fBCUmodule\fP * phMod, const void * p)"
165 Takes a pointer \fCp\fP and loads the corresponding module \fCphMod\fP into the current context. The pointer may be obtained by mapping a \fIcubin\fP or \fIPTX\fP file, passing a \fIcubin\fP or \fIPTX\fP file as a text string, or incorporating a \fIcubin\fP object into the executable resources and using operating system calls such as Windows \fCFindResource()\fP to obtain the pointer.
169 \fIphMod\fP - Returned module
171 \fIp\fP - Module data to load
176 \fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_OUT_OF_MEMORY\fP
181 Note that this function may also return error codes from previous, asynchronous launches.
186 \fBcuModuleGetFunction\fP, \fBcuModuleGetGlobal\fP, \fBcuModuleGetTexRef\fP, \fBcuModuleLoad\fP, \fBcuModuleLoadDataEx\fP, \fBcuModuleLoadFatBinary\fP, \fBcuModuleUnload\fP
190 .SS "\fBCUresult\fP cuModuleLoadDataEx (\fBCUmodule\fP * phMod, const void * p, unsigned int numOptions, \fBCUjit_option\fP * options, void ** optionValues)"
192 Takes a pointer \fCp\fP and loads the corresponding module \fCphMod\fP into the current context. The pointer may be obtained by mapping a \fIcubin\fP or \fIPTX\fP file, passing a \fIcubin\fP or \fIPTX\fP file as a text string, or incorporating a \fIcubin\fP object into the executable resources and using operating system calls such as Windows \fCFindResource()\fP to obtain the pointer. Options are passed as an array via \fCoptions\fP and any corresponding parameters are passed in \fCoptionValues\fP. The number of total options is supplied via \fCnumOptions\fP. Any outputs will be returned via \fCoptionValues\fP. Supported options are:
195 \fBCU_JIT_MAX_REGISTERS\fP: input specifies the maximum number of registers per thread;
197 \fBCU_JIT_THREADS_PER_BLOCK\fP: input specifies number of threads per block to target compilation for; output returns the number of threads the compiler actually targeted;
199 \fBCU_JIT_WALL_TIME\fP: output returns the float value of wall clock time, in milliseconds, spent compiling the \fIPTX\fP code;
201 \fBCU_JIT_INFO_LOG_BUFFER\fP: input is a pointer to a buffer in which to print any informational log messages from \fIPTX\fP assembly;
203 \fBCU_JIT_INFO_LOG_BUFFER_SIZE_BYTES\fP: input is the size in bytes of the buffer; output is the number of bytes filled with messages;
205 \fBCU_JIT_ERROR_LOG_BUFFER\fP: input is a pointer to a buffer in which to print any error log messages from \fIPTX\fP assembly;
207 \fBCU_JIT_ERROR_LOG_BUFFER_SIZE_BYTES\fP: input is the size in bytes of the buffer; output is the number of bytes filled with messages;
209 \fBCU_JIT_OPTIMIZATION_LEVEL\fP: input is the level of optimization to apply to generated code (0 - 4), with 4 being the default and highest level;
211 \fBCU_JIT_TARGET_FROM_CUCONTEXT\fP: causes compilation target to be determined based on current attached context (default);
213 \fBCU_JIT_TARGET\fP: input is the compilation target based on supplied \fBCUjit_target_enum\fP; possible values are:
215 \fBCU_TARGET_COMPUTE_10\fP
217 \fBCU_TARGET_COMPUTE_11\fP
219 \fBCU_TARGET_COMPUTE_12\fP
221 \fBCU_TARGET_COMPUTE_13\fP
228 \fIphMod\fP - Returned module
230 \fIp\fP - Module data to load
232 \fInumOptions\fP - Number of options
234 \fIoptions\fP - Options for JIT
236 \fIoptionValues\fP - Option values for JIT
241 \fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_OUT_OF_MEMORY\fP, \fBCUDA_ERROR_NO_BINARY_FOR_GPU\fP
246 Note that this function may also return error codes from previous, asynchronous launches.
251 \fBcuModuleGetFunction\fP, \fBcuModuleGetGlobal\fP, \fBcuModuleGetTexRef\fP, \fBcuModuleLoad\fP, \fBcuModuleLoadData\fP, \fBcuModuleLoadFatBinary\fP, \fBcuModuleUnload\fP
255 .SS "\fBCUresult\fP cuModuleLoadFatBinary (\fBCUmodule\fP * phMod, const void * vfatCubin)"
257 Takes a pointer \fCvfatCubin\fP and loads the corresponding module \fCphMod\fP into the current context. The pointer represents a \fIfat binary\fP object, which is a collection of different \fIcubin\fP files, all representing the same device code, but compiled and optimized for different architectures. There is currently no documented API for constructing and using fat binary objects by programmers, and therefore this function is an internal function in this version of CUDA. More information can be found in the \fBnvcc\fP document.
261 \fIphMod\fP - Returned module
263 \fIvfatCubin\fP - Fat binary to load
268 \fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_VALUE\fP, \fBCUDA_ERROR_NOT_FOUND\fP, \fBCUDA_ERROR_OUT_OF_MEMORY\fP, \fBCUDA_ERROR_NO_BINARY_FOR_GPU\fP
273 Note that this function may also return error codes from previous, asynchronous launches.
278 \fBcuModuleGetFunction\fP, \fBcuModuleGetGlobal\fP, \fBcuModuleGetTexRef\fP, \fBcuModuleLoad\fP, \fBcuModuleLoadData\fP, \fBcuModuleLoadDataEx\fP, \fBcuModuleUnload\fP
282 .SS "\fBCUresult\fP cuModuleUnload (\fBCUmodule\fP mod)"
284 Unloads a module \fCmod\fP from the current context.
288 \fImod\fP - Module to unload
293 \fBCUDA_SUCCESS\fP, \fBCUDA_ERROR_DEINITIALIZED\fP, \fBCUDA_ERROR_NOT_INITIALIZED\fP, \fBCUDA_ERROR_INVALID_CONTEXT\fP, \fBCUDA_ERROR_INVALID_VALUE\fP
298 Note that this function may also return error codes from previous, asynchronous launches.
303 \fBcuModuleGetFunction\fP, \fBcuModuleGetGlobal\fP, \fBcuModuleGetTexRef\fP, \fBcuModuleLoad\fP, \fBcuModuleLoadData\fP, \fBcuModuleLoadDataEx\fP, \fBcuModuleLoadFatBinary\fP
309 Generated automatically by Doxygen for NVIDIA CUDA Library from the source code.