Skip to content

Commit

Permalink
Make lb_pressure_tensor_acf test faster.
Browse files Browse the repository at this point in the history
  • Loading branch information
pkreissl committed Aug 3, 2020
1 parent ad9a70f commit 11e2862
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion testsuite/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
13 changes: 7 additions & 6 deletions testsuite/python/lb_pressure_tensor_acf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <sigma_[i!=j]> ~=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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -132,13 +131,15 @@ class TestLBPressureACFCPU(TestLBPressureACF, ut.TestCase):

def setUp(self):
self.lb_class = espressomd.lb.LBFluid
self.steps = 4000


@utx.skipIfMissingGPU()
class TestLBPressureACFGPU(TestLBPressureACF, ut.TestCase):

def setUp(self):
self.lb_class = espressomd.lb.LBFluidGPU
self.steps = 15000


if __name__ == "__main__":
Expand Down

0 comments on commit 11e2862

Please sign in to comment.