From 11e2862e5c03694a2d62ddeae8710d24e662e095 Mon Sep 17 00:00:00 2001 From: Patrick Kreissl Date: Mon, 3 Aug 2020 19:29:59 +0200 Subject: [PATCH] Make lb_pressure_tensor_acf test faster. --- testsuite/python/CMakeLists.txt | 2 +- testsuite/python/lb_pressure_tensor_acf.py | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/testsuite/python/CMakeLists.txt b/testsuite/python/CMakeLists.txt index febd1db3ded..b94e8bb6f89 100644 --- a/testsuite/python/CMakeLists.txt +++ b/testsuite/python/CMakeLists.txt @@ -123,7 +123,7 @@ python_test(FILE widom_insertion.py MAX_NUM_PROC 1) python_test(FILE constant_pH.py MAX_NUM_PROC 4) python_test(FILE writevtf.py MAX_NUM_PROC 4) python_test(FILE lb_stokes_sphere.py MAX_NUM_PROC 4 LABELS gpu long) -python_test(FILE lb_pressure_tensor_acf.py MAX_NUM_PROC 4 LABELS gpu long) +python_test(FILE lb_pressure_tensor_acf.py MAX_NUM_PROC 1 LABELS gpu long) python_test(FILE ek_fluctuations.py MAX_NUM_PROC 1 LABELS gpu) python_test(FILE ek_charged_plate.py MAX_NUM_PROC 1 LABELS gpu) python_test(FILE ek_eof_one_species_x.py MAX_NUM_PROC 1 LABELS gpu) diff --git a/testsuite/python/lb_pressure_tensor_acf.py b/testsuite/python/lb_pressure_tensor_acf.py index ecda879c512..86918ab10b4 100644 --- a/testsuite/python/lb_pressure_tensor_acf.py +++ b/testsuite/python/lb_pressure_tensor_acf.py @@ -58,20 +58,19 @@ def test(self): system.integrator.run(500) # sampling - steps = 50000 - p_global = np.zeros((steps, 3, 3)) - p_node = np.zeros((steps, 3, 3)) + p_global = np.zeros((self.steps, 3, 3)) + p_node = np.zeros((self.steps, 3, 3)) node = lb[0, 0, 0] - for i in range(steps): + for i in range(self.steps): p_node[i] = node.pressure_tensor p_global[i] = lb.pressure_tensor system.integrator.run(2) # Test that ~=0 and sigma_[ij]=sigma_[ji] - tol_global = 4 / np.sqrt(steps) + tol_global = 4 / np.sqrt(self.steps) tol_node = tol_global * np.sqrt(N_CELLS**3) # check single node @@ -101,7 +100,7 @@ def test(self): # Calculate acf tmp = np.correlate( p_global[:, i, j], p_global[:, i, j], mode="full") - acf = tmp[len(tmp) // 2:] / steps + acf = tmp[len(tmp) // 2:] / self.steps # integrate first part numerically, fit exponential to tail t_max_fit = 50 * TAU @@ -132,6 +131,7 @@ class TestLBPressureACFCPU(TestLBPressureACF, ut.TestCase): def setUp(self): self.lb_class = espressomd.lb.LBFluid + self.steps = 4000 @utx.skipIfMissingGPU() @@ -139,6 +139,7 @@ class TestLBPressureACFGPU(TestLBPressureACF, ut.TestCase): def setUp(self): self.lb_class = espressomd.lb.LBFluidGPU + self.steps = 15000 if __name__ == "__main__":