brey / pyPoseidon

Framework for hydrodynamic simulations of geoflows
https://pyposeidon.readthedocs.io/
European Union Public License 1.2
7 stars 8 forks source link

tests: Stop hardcoding the number of cores #22

Closed pmav99 closed 3 years ago

pmav99 commented 3 years ago

Hardcoding the number of cores is suboptimal. It makes it difficult to develop on low end machines (up to 4 cores) and is wasting time on higher end machines (4+ cores are available).

A reasonable default is to use the maximum number of cores minus one or two. E.g.

import multiprocessing

NCORES = max(1, multiprocessing.cpu_count() - 1)

Alternatively, the number of cores could be specified via an ENV variable, but not sure that something like this is that much useful at the moment.

The files that need to be updated can be found with:

ag --python ncores
brey commented 3 years ago

Done with 01b817af4f9c4d68702191a0a0972510debd7697