Morpho-lang / morpho

The Morpho language 🦋. Morpho is a small embeddable language for scientific computing applications.
MIT License
30 stars 10 forks source link

Multithreaded force and energy calculations #204

Closed softmattertheory closed 1 year ago

softmattertheory commented 1 year ago

This PR uses a thread pool to parallelize force and energy calculations, giving a considerable speedup for programs where these are the limiting factor.

To use, simply run morpho with -wX where X is the number of worker threads to use.

Note that there is an outstanding (and tricky) issue to resolve with clock(): it reports the CPU time not the wall time. For now, use an external timing utility. There seems to be a lack of platform independent solutions to report wall time at the right level of granularity.