From 403ee3072a1a6534b3a75bc3553baeb5f2e326c9 Mon Sep 17 00:00:00 2001 From: Matt Wala <wala1@illinois.edu> Date: Thu, 18 Jan 2018 18:48:58 -0600 Subject: [PATCH] Use a function instead of a wrapper class to create a RanluxGenerator. --- test/test_clrandom.py | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/test/test_clrandom.py b/test/test_clrandom.py index 2be2e46f..2846e24c 100644 --- a/test/test_clrandom.py +++ b/test/test_clrandom.py @@ -40,21 +40,13 @@ else: faulthandler.enable() -class RanluxGeneratorShim(object): - - def __init__(self, cl_ctx): - self.queue = cl.CommandQueue(cl_ctx) - self.gen = clrandom.RanluxGenerator(self.queue) - - def uniform(self, *args, **kwargs): - return self.gen.uniform(*args, **kwargs) - - def normal(self, *args, **kwargs): - return self.gen.normal(*args, **kwargs) +def make_ranlux_generator(cl_ctx): + queue = cl.CommandQueue(cl_ctx) + return clrandom.RanluxGenerator(queue) @pytest.mark.parametrize("rng_class", [ - RanluxGeneratorShim, + make_ranlux_generator, clrandom.PhiloxGenerator, clrandom.ThreefryGenerator]) @pytest.mark.parametrize("dtype", [ -- GitLab