Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: 15 Nov 2016

URL: http://cxc.harvard.edu/sherpa/threads/multicore/

Utilizing Sherpa's Parallelized Functions

Sherpa Threads (CIAO 4.9 Sherpa v1)


Overview

Synopsis:

Several computationally intensive functions in Sherpa are parallelized to make use of multi-core systems (i.e., laptops or desktops with two or more cores), providing users with significant improvements in efficiency. This thread describes the options available for specifying the number of cores to use when these commands are executed.

Last Update: 15 Nov 2016 - reviewed for CIAO 4.9: no content change


Contents


Parallelized Sherpa Commands

Each of the parallelized commands in Sherpa, listed below, contains a numcores argument for specifying the number of cores which should be utilized when these commands are run; the default is to use all available cores. Note that the number of cores is set for the conf and proj commands via set_conf_opt and set_proj_opt.

    conf 
    projection 
    int_proj 
    int_unc 
    get_int_proj 
    get_int_unc 
    reg_proj
    reg_unc
    get_reg_proj 
    get_reg_unc
    plot_photon_flux 
    plot_energy_flux 
    get_photon_flux_hist 
    get_energy_flux_hist 
    gridsearch 
    normal_sample
    t_sample
    uniform_sample
    plot_pvalue
    get_pvalue_plot
   

Specifying the Number of Cores

The number of cores to use when running a parallelized command may be set in one of two ways: when the command is run in the Sherpa session, or in the ~/sherpa.rc customization file.

Sherpa Command-Line

When a given parallelized command is run on the Sherpa command-line, its numcores argument is set as shown in the following example:

sherpa> plot_energy_flux(id="src", numcores=2) 

The plot_energy_flux command in this example will utilize two cores of the user's system in creating a plot of the energy flux distribution of the data set "src".

Another example is shown below, where the numcores option of the set_conf_opt command is used to specify that four cores should be used when the computationally intensive confidence command is run, after a fit to estimate the errors on the fit parameters:

sherpa> fit()

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

Sherpa Customization File

The user can also specify a default number of cores to use whenever a parallelized command is run in Sherpa, to avoid having to set the numcores argument each time the command is run. This is done by setting the number of cores to the desired value in the parallel section of the Sherpa customization file, sherpa.rc, located in the user's home directory.

unix% more ~/.sherpa.rc

[options]
# Plotting packages available- pylab, chips
plot_pkg   : chips

# IO packages available- pyfits, crates
io_pkg     : crates

# For shell script "sherpa", NOT a Python config option
# Which language will shell script choose?  By default
# load modules into IPython, but set to "slang" to 
# start slsh and import Sherpa S-Lang wrapper.
shell      : python

.
.
.


[parallel]
numcores:  4

The default numcores value in the customization file is None to indicate that all available cores will be used for parallelized functions. This setting may be overridden on the Sherpa command-line by using a parallelized function's numcores argument, as demonstrated in the previous section.


History

30 Mar 2012 original version
04 Dec 2013 reviewed for CIAO 4.6: no changes
04 Dec 2014 reviewed and edited for CIAO 4.7: no content change
01 Dec 2015 reviewed for CIAO 4.8: no content change
15 Nov 2016 reviewed for CIAO 4.9: no content change


Last modified: 15 Nov 2016
Smithsonian Institute Smithsonian Institute

The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory. 60 Garden Street, Cambridge, MA 02138 USA.   Email:   cxchelp@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2017. All rights reserved.