def get_fill_function(dtype, pitch = True):
type_dst = dtype_to_ctype(dtype)
name = "fill"
if pitch:
func = SourceModule(
fill_pitch_template % {
"name": name,
"type_dst": type_dst
}, options=["--ptxas-options=-v"]).get_function(name)
func.prepare('iiPi'+np.dtype(dtype).char)
# [np.int32, np.int32, np.intp, np.int32, _get_type(dtype)])
else:
func = SourceModule(
fill_nonpitch_template % {
"name": name,
"type_dst": type_dst
},
options=["--ptxas-options=-v"]).get_function(name)
func.prepare('iP'+np.dtype(dtype).char)#[np.int32, np.intp, _get_type(dtype)])
return func
评论列表
文章目录