From 78412b3d720ef53554916cee3a17bfb53cdbbafe Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Mon, 3 Aug 2015 23:15:07 -0400 Subject: [PATCH] Increase number of points used in multiprocessing example This helps average out some performance variability to make the effect of multiprocessing more clear. --- .../examples/transport/multiprocessing_viscosity.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/interfaces/cython/cantera/examples/transport/multiprocessing_viscosity.py b/interfaces/cython/cantera/examples/transport/multiprocessing_viscosity.py index a32d6ab6f..4358d341d 100644 --- a/interfaces/cython/cantera/examples/transport/multiprocessing_viscosity.py +++ b/interfaces/cython/cantera/examples/transport/multiprocessing_viscosity.py @@ -72,16 +72,19 @@ def serial(mech, predicate, nTemps): return y if __name__ == '__main__': + nPoints = 5000 + nProcs = 4 + # For functions where the work done in each subprocess is substantial, # significant speedup can be obtained using the multiprocessing module. print('Thermal conductivity') t1 = time() - parallel('gri30.xml', get_thermal_conductivity, 4, 1000) + parallel('gri30.xml', get_thermal_conductivity, nProcs, nPoints) t2 = time() print('Parallel: {0:.3f} seconds'.format(t2-t1)) t1 = time() - serial('gri30.xml', get_thermal_conductivity, 1000) + serial('gri30.xml', get_thermal_conductivity, nPoints) t2 = time() print('Serial: {0:.3f} seconds'.format(t2-t1)) @@ -89,11 +92,11 @@ if __name__ == '__main__': # small, there may be no advantage to using multiprocessing. print('\nViscosity') t1 = time() - parallel('gri30.xml', get_viscosity, 4, 1000) + parallel('gri30.xml', get_viscosity, nProcs, nPoints) t2 = time() print('Parallel: {0:.3f} seconds'.format(t2-t1)) t1 = time() - serial('gri30.xml', get_viscosity, 1000) + serial('gri30.xml', get_viscosity, nPoints) t2 = time() print('Serial: {0:.3f} seconds'.format(t2-t1))