From 7cc958a58affdc46879ab4a62ca06bb0a145fc67 Mon Sep 17 00:00:00 2001 From: "Timothy A. Smith" <tasmith4@illinois.edu> Date: Tue, 6 Aug 2019 21:35:22 -0500 Subject: [PATCH] added empty_array utility --- utilities.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/utilities.py b/utilities.py index 61771fd..0026bf5 100644 --- a/utilities.py +++ b/utilities.py @@ -18,16 +18,20 @@ def identity_matrix(n): return np.identity(n).astype(np.float32).copy(order="F") -def random_array_on_device(queue, *shape): - ary = empty_array_on_device(queue, *shape) - cl.clrandom.fill_rand(ary) - return ary +def empty_array(*shape): + return np.empty(shape, dtype=np.float32, order="F") def empty_array_on_device(queue, *shape): return cl.array.empty(queue, shape, dtype=np.float32, order="F") +def random_array_on_device(queue, *shape): + ary = empty_array_on_device(queue, *shape) + cl.clrandom.fill_rand(ary) + return ary + + def arrays_from_string(string_arrays): return split_map_to_list(string_arrays, array_from_string, ":") -- GitLab