Ignore:
Timestamp:
Sep 20, 2017 5:36:05 PM (4 years ago)
Author:
toby
Message:

fix multiprocessing with constraints

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIstrMath.py

    r3068 r3093  
    39273927    # now process derivatives in constraints
    39283928    dMdv[:,ma.getmaskarray(x)] = 0.  # instead of masking, zero out masked values
    3929     G2mv.Dict2Deriv(varylist,depDerivDict,dMdv)
    3930     return dMdv
     3929    #G2mv.Dict2Deriv(varylist,depDerivDict,dMdv)
     3930    return dMdv,depDerivDict
    39313931   
    39323932def UserRejectHKL(ref,im,userReject):
     
    40704070            xB = np.searchsorted(x,Limits[0])
    40714071            xF = np.searchsorted(x,Limits[1])+1
    4072             dMdvh = np.sqrt(w[xB:xF])*getPowderProfileDervMP([parmDict,x[xB:xF],
     4072            dMdv,depDerivDict = getPowderProfileDervMP([parmDict,x[xB:xF],
    40734073                varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars])
     4074            G2mv.Dict2Deriv(varylist,depDerivDict,dMdv)
     4075            dMdvh = np.sqrt(w[xB:xF])*dMdv
    40744076        elif 'HKLF' in histogram[:4]:
    40754077            Histogram = Histograms[histogram]
     
    41344136                MPpool = mp.Pool(ncores)
    41354137                dMdvh = None
     4138                depDerivDict = None
    41364139                profArgs = [
    41374140                    (parmDict,x[xB:xF],varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars,
    41384141                     i,ncores) for i in range(ncores)]
    4139                 for dmdv in MPpool.imap_unordered(getPowderProfileDervMP,profArgs):
     4142                for dmdv,depDerivs in MPpool.imap_unordered(getPowderProfileDervMP,profArgs):
    41404143                    if dMdvh is None:
    41414144                       dMdvh = dmdv
     4145                       depDerivDict = depDerivs
    41424146                    else:
    41434147                       dMdvh += dmdv
     4148                       for key in depDerivs.keys(): depDerivDict[key] += depDerivs[key]                       
    41444149            else:
    4145                 dMdvh = getPowderProfileDervMP([parmDict,x[xB:xF],
     4150                dMdvh,depDerivDict = getPowderProfileDervMP([parmDict,x[xB:xF],
    41464151                    varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars])
    41474152                #dMdvh = getPowderProfileDerv(parmDict,x[xB:xF],
    41484153                #    varylist,Histogram,Phases,rigidbodyDict,calcControls,pawleyLookup,dependentVars)
     4154            G2mv.Dict2Deriv(varylist,depDerivDict,dMdvh)
    41494155            if GSASIIpath.GetConfigValue('debug'): print 'getPowderProfileDerv t=',time.time()-starttime
    41504156            Wt = ma.sqrt(W[xB:xF])[nxs,:]
Note: See TracChangeset for help on using the changeset viewer.