mirror of
https://github.com/stevenrobertson/cuburn.git
synced 2025-02-05 11:40:04 -05:00
Move 'mktref' to util
This commit is contained in:
parent
bdcaca1f97
commit
6bf428caee
@ -52,6 +52,13 @@ def launch2(name, mod, stream, dim, *args, **kwargs):
|
|||||||
block, grid = (32, 8, 1), (dim.astride / 32, dim.ah / 8)
|
block, grid = (32, 8, 1), (dim.astride / 32, dim.ah / 8)
|
||||||
launch(name, mod, stream, block, grid, *args, **kwargs)
|
launch(name, mod, stream, block, grid, *args, **kwargs)
|
||||||
|
|
||||||
|
def mktref(mod, n):
|
||||||
|
tref = mod.get_texref(n)
|
||||||
|
tref.set_filter_mode(cuda.filter_mode.POINT)
|
||||||
|
tref.set_address_mode(0, cuda.address_mode.WRAP)
|
||||||
|
tref.set_address_mode(1, cuda.address_mode.WRAP)
|
||||||
|
return tref
|
||||||
|
|
||||||
def crep(s):
|
def crep(s):
|
||||||
"""Multiline literal escape for inline PTX assembly."""
|
"""Multiline literal escape for inline PTX assembly."""
|
||||||
if isinstance(s, unicode):
|
if isinstance(s, unicode):
|
||||||
|
@ -6,7 +6,7 @@ import pycuda.compiler
|
|||||||
from pycuda.gpuarray import vec
|
from pycuda.gpuarray import vec
|
||||||
|
|
||||||
import code.filters
|
import code.filters
|
||||||
from code.util import ClsMod, argset, launch2
|
from code.util import ClsMod, argset, launch2, mktref
|
||||||
|
|
||||||
def set_blur_width(mod, pool, stdev=1, stream=None):
|
def set_blur_width(mod, pool, stdev=1, stream=None):
|
||||||
coefs = pool.allocate((7,), f32)
|
coefs = pool.allocate((7,), f32)
|
||||||
@ -15,13 +15,6 @@ def set_blur_width(mod, pool, stdev=1, stream=None):
|
|||||||
ptr, size = mod.get_global('gauss_coefs')
|
ptr, size = mod.get_global('gauss_coefs')
|
||||||
cuda.memcpy_htod_async(ptr, coefs, stream)
|
cuda.memcpy_htod_async(ptr, coefs, stream)
|
||||||
|
|
||||||
def mktref(mod, n):
|
|
||||||
tref = mod.get_texref(n)
|
|
||||||
tref.set_filter_mode(cuda.filter_mode.POINT)
|
|
||||||
tref.set_address_mode(0, cuda.address_mode.WRAP)
|
|
||||||
tref.set_address_mode(1, cuda.address_mode.WRAP)
|
|
||||||
return tref
|
|
||||||
|
|
||||||
def mkdsc(dim, ch):
|
def mkdsc(dim, ch):
|
||||||
return argset(cuda.ArrayDescriptor(), height=dim.ah,
|
return argset(cuda.ArrayDescriptor(), height=dim.ah,
|
||||||
width=dim.astride, num_channels=ch,
|
width=dim.astride, num_channels=ch,
|
||||||
|
Loading…
Reference in New Issue
Block a user