Last modified: 11 October 2018

How can I specify the number of system cores to use for computationally intensive functions?


Several computationally intensive functions in Sherpa are parallelized to make use of multi-core systems. The number of cores to use when these commands are run may be specified using either of the following two options:

Setting 'numcores' when the individual command is run:

sherpa> set_conf_opt('numcores', 2)
sherpa> conf() 

sherpa> plot_energy_flux(numcores=2)    

The "numcores" argument of each of the parallelized commands is available for specifying the number of cores which should be utilized when these commands are run; the default is to use all cores available. Note that the conf and proj commands do not explicitly use a "numcores" argument like the rest of the commands; the "numcores" option of set_conf_opt and set_proj_opt should be used.

Setting 'numcores' in the Sherpa ~/.sherpa.rc customization file:

[parallel]
numcores:  3

In order to specify the default number of cores to use each time a parallelized command is run, you can add a "parallel" section to the ~/.sherpa.rc file and set the desired 'numcores' value there. Note that the default setting in this file may be overridden at the Sherpa command line.