Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
subs={'_THREADS_': THREADS}
)
_cuda_sample_circle = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/circle.cu'),
'circle',
subs={'_THREADS_': THREADS}
)
_cuda_sample_stroke = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/stroke.cu'),
'stroke',
subs={'_THREADS_': THREADS}
)
_cuda_sample_bzspl = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/bzspl.cu'),
'bzspl',
subs={'_THREADS_': THREADS}
)
def add_noise(f):
@wraps(f)
def inside(*args, **kwargs):
res = f(*args, **kwargs)
self = args[0]
if self.noise is not None:
rad = npfloat(self.noise)
ng = res.shape[0]
xy = zeros((ng, 2), npfloat)
mid = zeros((1, 2), npfloat)
_cuda_sample_circle(npint(ng),
RGEN = Rgen(offset=0)
THREADS = int(getenv('THREADS', 512))
TWOPI = 2.0*PI
_cuda_sample_box = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/box.cu'),
'box',
subs={'_THREADS_': THREADS}
)
_cuda_sample_circle = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/circle.cu'),
'circle',
subs={'_THREADS_': THREADS}
)
_cuda_sample_stroke = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/stroke.cu'),
'stroke',
subs={'_THREADS_': THREADS}
)
_cuda_sample_bzspl = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/bzspl.cu'),
'bzspl',
subs={'_THREADS_': THREADS}
)
assert self.gsamples >= 5000, 'you must set gsamples to at least 5000.'
self.cuda_agg = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/agg.cu'),
'agg',
subs={'_THREADS_': THREADS}
)
self.cuda_agg_bin = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/agg_bin.cu'),
'agg_bin',
subs={'_THREADS_': THREADS}
)
self.cuda_dot = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/dot.cu'),
'dot',
subs={'_THREADS_': THREADS}
)
self.fig = None
if show:
self.fig = plt.figure()
self.fig.patch.set_facecolor('gray')
self._updated = False
self.verbose = verbose
self.fg = None
self.bg = None
TWOPI = 2.0*PI
_cuda_sample_box = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/box.cu'),
'box',
subs={'_THREADS_': THREADS}
)
_cuda_sample_circle = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/circle.cu'),
'circle',
subs={'_THREADS_': THREADS}
)
_cuda_sample_stroke = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/stroke.cu'),
'stroke',
subs={'_THREADS_': THREADS}
)
_cuda_sample_bzspl = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/bzspl.cu'),
'bzspl',
subs={'_THREADS_': THREADS}
)
def add_noise(f):
@wraps(f)
def inside(*args, **kwargs):
res = f(*args, **kwargs)
self = args[0]
def __init__(self, imsize, show=True,
gsamples=1000000, verbose=False):
self.imsize = imsize
self.imsize2 = imsize*imsize
self.img = zeros((self.imsize2, 4), npfloat)
self._img = cuda.mem_alloc(self.img.nbytes)
self.gsamples = gsamples
assert self.gsamples >= 5000, 'you must set gsamples to at least 5000.'
self.cuda_agg = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/agg.cu'),
'agg',
subs={'_THREADS_': THREADS}
)
self.cuda_agg_bin = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/agg_bin.cu'),
'agg_bin',
subs={'_THREADS_': THREADS}
)
self.cuda_dot = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/dot.cu'),
'dot',
subs={'_THREADS_': THREADS}
)
self.imsize = imsize
self.imsize2 = imsize*imsize
self.img = zeros((self.imsize2, 4), npfloat)
self._img = cuda.mem_alloc(self.img.nbytes)
self.gsamples = gsamples
assert self.gsamples >= 5000, 'you must set gsamples to at least 5000.'
self.cuda_agg = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/agg.cu'),
'agg',
subs={'_THREADS_': THREADS}
)
self.cuda_agg_bin = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/agg_bin.cu'),
'agg_bin',
subs={'_THREADS_': THREADS}
)
self.cuda_dot = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/dot.cu'),
'dot',
subs={'_THREADS_': THREADS}
)
self.fig = None
if show:
self.fig = plt.figure()
self.fig.patch.set_facecolor('gray')
from .helpers import is_verbose
from .helpers import json_array
from .helpers import load_kernel
from .helpers import pfloat
from .color import Rgba
RGEN = Rgen(offset=0)
THREADS = int(getenv('THREADS', 512))
TWOPI = 2.0*PI
_cuda_sample_box = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/box.cu'),
'box',
subs={'_THREADS_': THREADS}
)
_cuda_sample_circle = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/circle.cu'),
'circle',
subs={'_THREADS_': THREADS}
)
_cuda_sample_stroke = load_kernel(
pkg_resources.resource_filename('desert', 'cuda/stroke.cu'),
'stroke',
subs={'_THREADS_': THREADS}
)