From dd297fb19002295e5ab1d14223dc6416e49c181e Mon Sep 17 00:00:00 2001 From: Luc Grosheintz Date: Mon, 21 Oct 2024 12:11:55 +0200 Subject: [PATCH] Rename 'shared_global'. --- test/usecases/global/simulate.py | 26 +++++++++---------- test/usecases/global/test_callables.py | 10 +++---- ...ead_variable.mod => threading_effects.mod} | 2 +- 3 files changed, 19 insertions(+), 19 deletions(-) rename test/usecases/global/{thread_variable.mod => threading_effects.mod} (95%) diff --git a/test/usecases/global/simulate.py b/test/usecases/global/simulate.py index 8de8df686..793a7dce0 100644 --- a/test/usecases/global/simulate.py +++ b/test/usecases/global/simulate.py @@ -16,11 +16,11 @@ nseg = 1 s0 = h.Section() -s0.insert("shared_global") +s0.insert("threading_effects") s0.nseg = nseg s1 = h.Section() -s1.insert("shared_global") +s1.insert("threading_effects") s1.nseg = nseg pc = h.ParallelContext() @@ -29,8 +29,8 @@ pc.partition(1, h.SectionList([s1])) t = h.Vector().record(h._ref_t) -y0 = h.Vector().record(s0(0.5).shared_global._ref_y) -y1 = h.Vector().record(s1(0.5).shared_global._ref_y) +y0 = h.Vector().record(s0(0.5).threading_effects._ref_y) +y1 = h.Vector().record(s1(0.5).threading_effects._ref_y) # Bunch of arbitrary values: z0, z1 = 3.0, 4.0 @@ -38,25 +38,25 @@ g_w_init = 48.0 # Ensure that the two threads will set different value to `g_w`. -s0(0.5).shared_global.z = z0 -s1(0.5).shared_global.z = z1 +s0(0.5).threading_effects.z = z0 +s1(0.5).threading_effects.z = z1 -h.g_w_shared_global = g_w0 -assert h.g_w_shared_global == g_w0 +h.g_w_threading_effects = g_w0 +assert h.g_w_threading_effects == g_w0 h.stdinit() -assert h.g_w_shared_global == g_w_init -h.g_w_shared_global = g_w1 -assert h.g_w_shared_global == g_w1 +assert h.g_w_threading_effects == g_w_init +h.g_w_threading_effects = g_w1 +assert h.g_w_threading_effects == g_w1 h.continuerun(1.0 * ms) # Arguably the value is unspecified, but currently it's the value of # on thread 0. -assert h.g_w_shared_global == z0 +assert h.g_w_threading_effects == z0 t = np.array(t.as_numpy()) y0 = np.array(y0.as_numpy()) y1 = np.array(y1.as_numpy()) -w = h.g_w_shared_global +w = h.g_w_threading_effects # The solution is piecewise constant. These are the pieces: i0 = [0] diff --git a/test/usecases/global/test_callables.py b/test/usecases/global/test_callables.py index ef7b54411..ba0a38133 100644 --- a/test/usecases/global/test_callables.py +++ b/test/usecases/global/test_callables.py @@ -3,21 +3,21 @@ def test_function(): s = h.Section() - s.insert("shared_global") + s.insert("threading_effects") h.finitialize() - assert s(0.5).shared_global.sum_arr() == 30.3 + assert s(0.5).threading_effects.sum_arr() == 30.3 def test_procedure(): s = h.Section() - s.insert("shared_global") + s.insert("threading_effects") h.finitialize() - s(0.5).shared_global.set_g_w(44.4) - assert h.g_w_shared_global == 44.4 + s(0.5).threading_effects.set_g_w(44.4) + assert h.g_w_threading_effects == 44.4 if __name__ == "__main__": diff --git a/test/usecases/global/thread_variable.mod b/test/usecases/global/threading_effects.mod similarity index 95% rename from test/usecases/global/thread_variable.mod rename to test/usecases/global/threading_effects.mod index 8383258b0..185abca84 100644 --- a/test/usecases/global/thread_variable.mod +++ b/test/usecases/global/threading_effects.mod @@ -1,5 +1,5 @@ NEURON { - SUFFIX shared_global + SUFFIX threading_effects NONSPECIFIC_CURRENT il RANGE y, z GLOBAL g_v1, g_w, g_arr