Changeset 249a7c6 in sasview for src


Ignore:
Timestamp:
Jun 4, 2014 5:13:05 PM (10 years ago)
Author:
pkienzle
Branches:
master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.1.1, release-4.1.2, release-4.2.2, release_4.0.1, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
Children:
191c648
Parents:
880f170
Message:

use multiprocessing for bumps fits if OMP_NUM_THREADS=1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sans/fit/BumpsFitting.py

    r35086c3 r249a7c6  
    22BumpsFitting module runs the bumps optimizer. 
    33""" 
     4import os 
    45from datetime import timedelta, datetime 
    56 
     
    78 
    89from bumps import fitters 
    9 from bumps.mapper import SerialMapper 
     10from bumps.mapper import SerialMapper, MPMapper 
    1011from bumps import parameter 
    1112from bumps.fitproblem import FitProblem 
     
    294295    fitdriver = fitters.FitDriver(fitclass, problem=problem, 
    295296                                  abort_test=abort_test, **options) 
    296     mapper = SerialMapper  
     297    omp_threads = int(os.environ.get('OMP_NUM_THREADS','0')) 
     298    mapper = MPMapper if omp_threads == 1 else SerialMapper        
    297299    fitdriver.mapper = mapper.start_mapper(problem, None) 
    298300    #import time; T0 = time.time() 
Note: See TracChangeset for help on using the changeset viewer.