From f5e44430049d5e0c08f6d65ace4fbb84672b92ed Mon Sep 17 00:00:00 2001 From: Steven Robertson Date: Fri, 16 Dec 2011 12:13:55 -0500 Subject: [PATCH] Handle primes.bin automatically --- cuburn/code/mwc.py | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/cuburn/code/mwc.py b/cuburn/code/mwc.py index 206f290..5b07d92 100644 --- a/cuburn/code/mwc.py +++ b/cuburn/code/mwc.py @@ -2,6 +2,8 @@ The multiply-with-carry random number generator. """ +import os +import warnings import numpy as np from util import * @@ -41,20 +43,34 @@ __device__ float mwc_next_11(mwc_st &st) { """ @staticmethod - def make_seeds(nthreads, host_seed=None): + def load_mults(): + pfpath = os.path.join(os.path.dirname(__file__), 'primes.bin') + if os.path.isfile(pfpath): + with open(pfpath) as fp: + return np.frombuffer(fp.read(), dtype='