6.23. 执行控制 [已弃用]

本节介绍低级别CUDA驱动程序应用程序编程接口中已弃用的执行控制函数。

Functions

CUresult cuFuncSetBlockShape ( CUfunction hfunc, int  x, int  y, int  z )
Sets the block-dimensions for the function.
CUresult cuFuncSetSharedMemConfig ( CUfunction hfunc, CUsharedconfig config )
Sets the shared memory configuration for a device function.
CUresult cuFuncSetSharedSize ( CUfunction hfunc, unsigned int  bytes )
Sets the dynamic shared-memory size for the function.
CUresult cuLaunch ( CUfunction f )
Launches a CUDA function.
CUresult cuLaunchGrid ( CUfunction f, int  grid_width, int  grid_height )
Launches a CUDA function.
CUresult cuLaunchGridAsync ( CUfunction f, int  grid_width, int  grid_height, CUstream hStream )
Launches a CUDA function.
CUresult cuParamSetSize ( CUfunction hfunc, unsigned int  numbytes )
Sets the parameter size for the function.
CUresult cuParamSetTexRef ( CUfunction hfunc, int  texunit, CUtexref hTexRef )
Adds a texture-reference to the function's argument list.
CUresult cuParamSetf ( CUfunction hfunc, int  offset, float  value )
Adds a floating-point parameter to the function's argument list.
CUresult cuParamSeti ( CUfunction hfunc, int  offset, unsigned int  value )
Adds an integer parameter to the function's argument list.
CUresult cuParamSetv ( CUfunction hfunc, int  offset, void* ptr, unsigned int  numbytes )
Adds arbitrary data to the function's argument list.

Functions

CUresult cuFuncSetBlockShape ( CUfunction hfunc, int  x, int  y, int  z )
设置该函数的块维度。
参数
hfunc
- Kernel to specify dimensions of
x
- X dimension
y
- Y dimension
z
- Z dimension
已弃用

描述
Specifies the x, y, and z dimensions of the thread blocks that are created when the kernel given by hfunc is launched.

Note:

请注意,此函数也可能返回之前异步启动的错误代码。

另请参阅:

cuFuncSetSharedSize, cuFuncSetCacheConfig, cuFuncGetAttribute, cuParamSetSize, cuParamSeti, cuParamSetf, cuParamSetv, cuLaunch, cuLaunchGrid, cuLaunchGridAsync, cuLaunchKernel

CUresult cuFuncSetSharedMemConfig ( CUfunction hfunc, CUsharedconfig config )
设置设备函数的共享内存配置。
参数
hfunc
- kernel to be given a shared memory config
config
- requested shared memory configuration
已弃用

描述
On devices with configurable shared memory banks, this function will force all subsequent launches of the specified device function to have the given shared memory bank size configuration. On any given launch of the function, the shared memory configuration of the device will be temporarily changed if needed to suit the function's preferred configuration. Changes in shared memory configuration between subsequent launches of functions, may introduce a device side synchronization point.

通过cuFuncSetSharedMemConfig设置的每个函数的共享内存库大小设置将覆盖通过cuCtxSetSharedMemConfig设置的上下文范围内的设置。

更改共享内存的存储体大小不会增加共享内存的使用量或影响内核的占用率,但可能会对性能产生重大影响。较大的存储体大小可以带来更高的共享内存潜在带宽,但会改变哪些类型的共享内存访问会导致存储体冲突。

此函数在具有固定共享内存库大小的设备上将不执行任何操作。

支持的银行配置包括:

Note:

请注意,此函数也可能返回之前异步启动的错误代码。

另请参阅:

cuCtxGetCacheConfig, cuCtxSetCacheConfig, cuCtxGetSharedMemConfig, cuCtxSetSharedMemConfig, cuFuncGetAttribute, cuLaunchKernel, cudaFuncSetSharedMemConfig

CUresult cuFuncSetSharedSize ( CUfunction hfunc, unsigned int  bytes )
设置该函数的动态共享内存大小。
参数
hfunc
- Kernel to specify dynamic shared-memory size for
bytes
- Dynamic shared-memory size per thread in bytes
已弃用

描述
Sets through bytes the amount of dynamic shared memory that will be available to each thread block when the kernel given by hfunc is launched.

Note:

请注意,此函数也可能返回之前异步启动的错误代码。

另请参阅:

cuFuncSetBlockShape, cuFuncSetCacheConfig, cuFuncGetAttribute, cuParamSetSize, cuParamSeti, cuParamSetf, cuParamSetv, cuLaunch, cuLaunchGrid, cuLaunchGridAsync, cuLaunchKernel

CUresult cuLaunch ( CUfunction f )
启动一个CUDA函数。
参数
f
- Kernel to launch
已弃用

描述
Invokes the kernel f on a 1 x 1 x 1 grid of blocks. The block contains the number of threads specified by a previous call to cuFuncSetBlockShape().

在调用此函数之前,必须使用cuFuncSetBlockShape()cuFuncSetSharedSize()cuParamSetSize()cuParamSeti()cuParamSetf()cuParamSetv()设置块形状、动态共享内存大小和参数信息。

通过cuLaunchKernel()启动函数会使该函数的块形状、动态共享内存大小和参数信息失效。通过cuLaunchKernel启动后,在调用此函数之前必须重新初始化这些状态。否则会导致未定义行为。

Note:

请注意,此函数也可能返回之前异步启动的错误代码。

另请参阅:

cuFuncSetBlockShape, cuFuncSetSharedSize, cuFuncGetAttribute, cuParamSetSize, cuParamSetf, cuParamSeti, cuParamSetv, cuLaunchGrid, cuLaunchGridAsync, cuLaunchKernel

CUresult cuLaunchGrid ( CUfunction f, int  grid_width, int  grid_height )
启动一个CUDA函数。
参数
f
- Kernel to launch
grid_width
- Width of grid in blocks
grid_height
- Height of grid in blocks
已弃用

描述
Invokes the kernel f on a grid_width x grid_height grid of blocks. Each block contains the number of threads specified by a previous call to cuFuncSetBlockShape().

在调用此函数之前,必须使用cuFuncSetBlockShape()cuFuncSetSharedSize()cuParamSetSize()cuParamSeti()cuParamSetf()cuParamSetv()设置块形状、动态共享内存大小和参数信息。

通过cuLaunchKernel()启动函数会使该函数的块形状、动态共享内存大小和参数信息失效。通过cuLaunchKernel启动后,在调用此函数之前必须重新初始化这些状态。否则会导致未定义行为。

Note:

请注意,此函数也可能返回之前异步启动的错误代码。

另请参阅:

cuFuncSetBlockShape, cuFuncSetSharedSize, cuFuncGetAttribute, cuParamSetSize, cuParamSetf, cuParamSeti, cuParamSetv, cuLaunch, cuLaunchGridAsync, cuLaunchKernel

CUresult cuLaunchGridAsync ( CUfunction f, int  grid_width, int  grid_height, CUstream hStream )
启动一个CUDA函数。
参数
f
- Kernel to launch
grid_width
- Width of grid in blocks
grid_height
- Height of grid in blocks
hStream
- Stream identifier
已弃用

描述
Invokes the kernel f on a grid_width x grid_height grid of blocks. Each block contains the number of threads specified by a previous call to cuFuncSetBlockShape().

在调用此函数之前,必须使用cuFuncSetBlockShape()cuFuncSetSharedSize()cuParamSetSize()cuParamSeti()cuParamSetf()cuParamSetv()来设置块形状、动态共享内存大小和参数信息。

通过cuLaunchKernel()启动函数会使该函数的块形状、动态共享内存大小和参数信息失效。通过cuLaunchKernel启动后,在调用此函数之前必须重新初始化这些状态。否则会导致未定义行为。

Note:
  • 在某些情况下,使用ptxas--abi-compileno创建没有ABI的cubin时,此函数可能会序列化内核启动。CUDA驱动程序通过根据需要为每次启动增加每线程堆栈并在此后不收缩它来保持异步行为。

  • 此函数使用标准的默认流语义。

  • 请注意,此函数也可能返回之前异步启动的错误代码。

另请参阅:

cuFuncSetBlockShape, cuFuncSetSharedSize, cuFuncGetAttribute, cuParamSetSize, cuParamSetf, cuParamSeti, cuParamSetv, cuLaunch, cuLaunchGrid, cuLaunchKernel

CUresult cuParamSetSize ( CUfunction hfunc, unsigned int  numbytes )
设置函数的参数大小。
参数
hfunc
- Kernel to set parameter size for
numbytes
- Size of parameter list in bytes
已弃用

描述
Sets through numbytes the total size in bytes needed by the function parameters of the kernel corresponding to hfunc.

Note:

请注意,此函数也可能返回之前异步启动的错误代码。

另请参阅:

cuFuncSetBlockShape, cuFuncSetSharedSize, cuFuncGetAttribute, cuParamSetf, cuParamSeti, cuParamSetv, cuLaunch, cuLaunchGrid, cuLaunchGridAsync, cuLaunchKernel

CUresult cuParamSetTexRef ( CUfunction hfunc, int  texunit, CUtexref hTexRef )
向函数的参数列表中添加一个纹理引用。
参数
hfunc
- Kernel to add texture-reference to
texunit
- Texture unit (must be CU_PARAM_TR_DEFAULT)
hTexRef
- Texture-reference to add to argument list
已弃用

描述
Makes the CUDA array or linear memory bound to the texture reference hTexRef available to a device program as a texture. In this version of CUDA, the texture-reference must be obtained via cuModuleGetTexRef() and the texunit parameter must be set to CU_PARAM_TR_DEFAULT.

Note:

请注意,此函数也可能返回之前异步启动的错误代码。

CUresult cuParamSetf ( CUfunction hfunc, int  offset, float  value )
向函数的参数列表中添加一个浮点参数。
参数
hfunc
- Kernel to add parameter to
offset
- Offset to add parameter to argument list
value
- Value of parameter
已弃用

描述
Sets a floating-point parameter that will be specified the next time the kernel corresponding to hfunc will be invoked. offset is a byte offset.

Note:

请注意,此函数也可能返回之前异步启动的错误代码。

另请参阅:

cuFuncSetBlockShape, cuFuncSetSharedSize, cuFuncGetAttribute, cuParamSetSize, cuParamSeti, cuParamSetv, cuLaunch, cuLaunchGrid, cuLaunchGridAsync, cuLaunchKernel

CUresult cuParamSeti ( CUfunction hfunc, int  offset, unsigned int  value )
向函数的参数列表中添加一个整数参数。
参数
hfunc
- Kernel to add parameter to
offset
- Offset to add parameter to argument list
value
- Value of parameter
已弃用

描述
Sets an integer parameter that will be specified the next time the kernel corresponding to hfunc will be invoked. offset is a byte offset.

Note:

请注意,此函数也可能返回之前异步启动的错误代码。

另请参阅:

cuFuncSetBlockShape, cuFuncSetSharedSize, cuFuncGetAttribute, cuParamSetSize, cuParamSetf, cuParamSetv, cuLaunch, cuLaunchGrid, cuLaunchGridAsync, cuLaunchKernel

CUresult cuParamSetv ( CUfunction hfunc, int  offset, void* ptr, unsigned int  numbytes )
向函数的参数列表中添加任意数据。
参数
hfunc
- Kernel to add data to
offset
- Offset to add data to argument list
ptr
- Pointer to arbitrary data
numbytes
- Size of data to copy in bytes
已弃用

描述
Copies an arbitrary amount of data (specified in numbytes) from ptr into the parameter space of the kernel corresponding to hfunc. offset is a byte offset.

Note:

请注意,此函数也可能返回之前异步启动的错误代码。

另请参阅:

cuFuncSetBlockShape, cuFuncSetSharedSize, cuFuncGetAttribute, cuParamSetSize, cuParamSetf, cuParamSeti, cuLaunch, cuLaunchGrid, cuLaunchGridAsync, cuLaunchKernel