#530: Change default for --num-threads --------------------------+------------------------------------------------- Reporter: eschnett | Owner: hinder Type: enhancement | Status: assigned Priority: major | Milestone: Component: SimFactory | Version: Resolution: | Keywords: --------------------------+-------------------------------------------------
Comment (by knarf):
The usual mechanism using OMP_NUM_THREADS works quite well, and I would not force users to use something else instead. That would only create confusion.
Our problem here is that in some cases OMP_NUM_THREADS as set by something like simfactory should be ignored depending on which thorns are active in a simulation. Simfactory does not really know that, Cactus does. The flesh would also know which thorns are flagged 'single-thread' by some mechanism. So, the flesh could contain code which sets the number of used openmp-threads to something else than OMP_NUM_THREADS, depending on some conditions. I don't like to introduce another environment variable and use this. Instead I propose:
- The flesh gets a new accumulator parameter 'single-threaded' (name to be discussed) which can be added to by thorns to force single-threaded execution. No user would have to know or could set this parameter. - The flesh gets another new parameter 'ignore-single-threaded' (name to be discussed), but this one intended for interaction with the user to be able to ignore the accumulator parameter, for testing primarily. - The flesh would then do nothing if 'single-threaded' is 0 (the default), which means no thorns requested to be executed only single-threaded. - The flesh would set the number of threads to 1 (using the openmp C api) if 'single-threaded' is something else than 0, unless 'ignore-single- threaded' is set to 'yes' in which case it would also not do anything.
This would ensure that a mere user wouldn't have to do anything to Cactus, the parameter file or simfactory, assuming single-threaded thorns use the accumulator parameter. It's also easy to do that for developers of such thorns. The only action a user would have to take if this is not what is intended is to set one parameter in the parameter file, which should not occur often and which is reasonably easy.
Frank