Changeset 3005


Ignore:
Timestamp:
Aug 14, 2017 3:31:41 PM (4 years ago)
Author:
vondreele
Message:

fix multiprocess for getProfileDerivMP - useMP=False

Location:
trunk
Files:
1 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r3004 r3005  
    31983198    return yc,yb
    31993199   
    3200 def getPowderProfileDerv(parmDict,x,varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup):
     3200def getPowderProfileDerv(parmDict,x,varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars):
    32013201    '''Computes the derivatives of the computed powder pattern with respect to all
    32023202    refined parameters
     
    32293229           
    32303230    # create a list of dependent variables and set up a dictionary to hold their derivatives
    3231     dependentVars = G2mv.GetDependentVars()
    32323231    depDerivDict = {}
    32333232    for j in dependentVars:
     
    35543553    Multiprocessing version.
    35553554    '''
    3556     parmDict,x,varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup = args[:8]
     3555    parmDict,x,varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars = args[:9]
    35573556    prc=0
    35583557    tprc=1
    3559     if len(args) >= 9: prc=args[8]
    3560     if len(args) >= 10: tprc=args[9]
     3558    if len(args) >= 10: prc=args[9]
     3559    if len(args) >= 11: tprc=args[10]
    35613560    def cellVaryDerv(pfx,SGData,dpdA):
    35623561        if SGData['SGLaue'] in ['-1',]:
     
    35823581           
    35833582    # create a list of dependent variables and set up a dictionary to hold their derivatives
    3584     dependentVars = G2mv.GetDependentVars()
     3583#    dependentVars = G2mv.GetDependentVars()
    35853584    depDerivDict = {}
    35863585    for j in dependentVars:
    35873586        depDerivDict[j] = np.zeros(shape=(len(x)))
    3588     #print 'dependent vars',dependentVars
     3587#    print 'dependent vars',dependentVars
    35893588    hId = Histogram['hId']
    35903589    hfx = ':%d:'%(hId)
     
    40064005    G2mv.Dict2Map(parmDict,varylist)
    40074006    Histograms,Phases,restraintDict,rigidbodyDict = HistoPhases
     4007    dependentVars = G2mv.GetDependentVars()
    40084008    dMdv = np.empty(0)
    40094009    histoList = Histograms.keys()
     
    40204020            xF = np.searchsorted(x,Limits[1])+1
    40214021            dMdvh = np.sqrt(w[xB:xF])*getPowderProfileDerv(parmDict,x[xB:xF],
    4022                 varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup)
     4022                varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars)
    40234023        elif 'HKLF' in histogram[:4]:
    40244024            Histogram = Histograms[histogram]
     
    40594059    G2mv.Dict2Map(parmDict,varylist)
    40604060    Histograms,Phases,restraintDict,rigidbodyDict = HistoPhases
     4061    dependentVars = G2mv.GetDependentVars()
    40614062    #fixup H atom positions here?
    40624063    ApplyRBModels(parmDict,Phases,rigidbodyDict)        #,Update=True??
     
    40814082            #G2mp.InitMP()
    40824083            useMP = False
    4083             ncores = 0
     4084            ncores = GSASIIpath.GetConfigValue('Multiprocessing_cores')
    40844085            #useMP = G2mp.useMP #and len(refDict['RefList']) > 100
    40854086            if GSASIIpath.GetConfigValue('debug'):
    40864087                starttime = time.time()
    4087                 print 'starting getPowderProfileDerv'
     4088#                print 'starting getPowderProfileDerv'
    40884089            #useMP = True
    40894090            if useMP and ncores > 1:
     
    40934094                dMdvh = None
    40944095                profArgs = [
    4095                     (parmDict,x[xB:xF],varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,
     4096                    (parmDict,x[xB:xF],varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars,
    40964097                     i,ncores) for i in range(ncores)]
    40974098                for dmdv in MPpool.imap_unordered(getPowderProfileDervMP,profArgs):
     
    41044105                #    varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup])
    41054106                dMdvh = getPowderProfileDerv(parmDict,x[xB:xF],
    4106                     varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup)
     4107                    varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars)
    41074108            if GSASIIpath.GetConfigValue('debug'):
    41084109                print 'end getPowderProfileDerv t=',time.time()-starttime
Note: See TracChangeset for help on using the changeset viewer.