Running Cantera simulations on a multi core machine

269 views
Skip to first unread message

George Eeppachan

unread,
Dec 18, 2018, 1:46:50 PM12/18/18
to Cantera Users' Group
Dear Cantera  community,

I had Cantera (2.4.0) installed on a Windows 10 desktop using the conda installation method as described here [link]. The installation has been successful and Cantera works fine with Anaconda. I am presently calculating the ignition delay of many mixtures using a detailed chemical kinetic model, to be specific the LLNL gasoline surrogate model available here [link].

The ignition delay simulations work fine, however the time to complete simulations at present is 2 hours, which I am fine with. Would it be possible to submit parallel jobs without affecting the simulation time ~ 2 hours. I tried submitting 4 jobs in parallel; however, this increases the simulation time of each to 4-5 hours. I am not sure but does doing this run all the jobs on one core, how can I dedicate each job to a single core on a multi core machine. Or is there any workaround for running simulations in parallel on Windows 10/Conda/Cantera 2.4.0?

Best regards,
GE

Bryan W. Weber

unread,
Dec 18, 2018, 2:41:55 PM12/18/18
to Cantera Users' Group
Hi,

This depends on how your code is working and how many cores you have on your machine. Can you please post the script you're using (along with any necessary CTI files), as well as provide the processor information for your computer? If you open the Task Manager while your script is running, what is the % CPU usage you see for the "python.exe" process?

Best,
Bryan
Message has been deleted

Nick Curtis

unread,
Dec 18, 2018, 3:36:14 PM12/18/18
to Cantera Users' Group
Hi George,

One thing to be careful of is the multiple levels of parallelism available.
Generally in the python interface you have two different parallel processes:

1.  BLAS/LAPACK parallelism -- i.e., how many threads are used during matrix LU factorization & other linear algebra processes.  This is typically controlled by the OMP_NUM_THREADS environment variable.  Generally for small models (e.g., say 50-1000 species depending on your machine), you'll likely see the best performance using a single thread here, however it seems like you're using a very large model (since your ignition delay calculated take so long!), so you may want to play with the number of threads you allocate for BLAS/LAPACK to see the performance increase.  Note: this assumes you're using MKL or another parallel library as the BLAS/LAPACK implementation, I believe this is the only option for the conda install currently, but I thought I'd mention it.

2.  Python level parallelism, e.g., via the multiprocessing library.  In order to see what's going on here, we'll need the info that Bryan requested.  However, one thing I'll note is that the product of OMP_NUM_THREADS and the number of python processes you spawn shouldn't exceed the total physical core count of your machine for best performance.  Note: Hyperthreading is evil for chemical kinetics, be really reaaaaally sure you have the actual physical core count, e.g. via the psutils' cpu_count (with logical=False) or you'll take a performance hit.

Best,

Nick

On Tuesday, December 18, 2018 at 1:46:50 PM UTC-5, George Eeppachan wrote:

Bryan W. Weber

unread,
Dec 18, 2018, 7:13:38 PM12/18/18
to Cantera Users' Group
Hi Nick (and George),

On Windows, the Cantera conda package is not built with MKL, because Anaconda don't (can't?) distribute the parts of the library necessary to do the linking. Windows is strange...

On a related note, the macOS conda package is also not built with MKL because of a bug in MKL that resulted in tests failing. Instead, we build on macOS with the Apple-provided Accelerate framework, which provides a similar parallelization mechanism as MKL, in that it proves a parallel BLAS/LAPACK implementation. I'm not sure which environment variables control that though.

Best,
Bryan

George Eeppachan

unread,
Dec 20, 2018, 8:41:24 PM12/20/18
to Cantera Users' Group
Dear Bryan,

See attached the script and the chemical kinetic model in CTI format. The processor information of my computer is Intel Xeon CPU W3670 @ 3.2 GHz (6 cores). The CPU used is ~ 10 %.

Best regards,
GE
idt.py
gasoline_surrogate_detailed_llnl_without_transport_parameters.cti
Reply all
Reply to author
Forward
0 new messages