nlcpy.sca.create_kernel
- nlcpy.sca.create_kernel(description desc_i, description desc_o=None)
- Creates a SCA kernel. - Creates a SCA kernel from a stencil description that denotes stencil shapes. If the keyword argument desc_o is omitted, the SCA kernel’s output array is automatically created when the SCA kernel is executed. - Parameters
- desc_inlcpy.sca.description.description
- The stenil description that is associated with the input ndarray. 
- desc_onlcpy.sca.description.description, optional
- The stenil description that is associated with the output ndarray. If not given or None, the kernel creates a new output ndarray when the kernel execution is done. 
 
- Returns
- kernelnlcpy.sca.kernel.kernel
- The SCA kernel. 
 
 - See also - nlcpy.sca.kernel.kernel.execute
- Executes the created SCA kernel and returns the result of stencil computations. 
- nlcpy.sca.destroy_kernel
- Destroy a SCA kernel. It is recommended that the kernel be properly destroyed by the function after you finish using the kernel. 
 - Examples - >>> import nlcpy as vp >>> xin = vp.arange(10, dtype='f4') >>> xout = vp.zeros_like(xin) >>> dxin, dxout = vp.sca.create_descriptor((xin, xout)) >>> desc_i = dxin[-1] + dxin[0] + dxin[1] >>> desc_o = dxout[0] >>> kern = vp.sca.create_kernel(desc_i, desc_o=desc_o) >>> kern.execute() array([ 0., 3., 6., 9., 12., 15., 18., 21., 24., 0.], dtype=float32)