Ignore:
Timestamp:
Nov 26, 2008 2:37:41 PM (14 years ago)
Author:
srkline
Message:

Threading is now included in MonteCarlo?, and CylPolyRad?, and BCC, as WaveMetrics? has fixed teh bug in Igor in version 6.10B04

Threading can now be added to all appropriate fit functions, provided we require 6.10 (when it is a release version)

Threading issues with MonteCarlo? appear to be due to NR ran() routines, which are not thread safe. Duplicate function instances (with different names) have been created. This works, but is inelegant.

Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MultScatter_MonteCarlo_2D.ipf

    r456 r457  
    102102                        WAVE inputWave1,ran_dev1,nt1,j11,j21,nn1,linear_data1,retWave1 
    103103                        //retWave1[0] = -1*datetime             //to initialize ran3 
    104                         ThreadStart mt,i,Monte_SANS_W1(inputWave1,ran_dev1,nt1,j11,j21,nn1,linear_data1,retWave1) 
     104                        ThreadStart mt,i,Monte_SANS_W2(inputWave1,ran_dev1,nt1,j11,j21,nn1,linear_data1,retWave1) 
    105105                        Print "started thread 1" 
    106106                endif 
     
    191191        WAVE inputWave,ran_dev,nt,j1,j2,nn,linear_data,results 
    192192         
    193 #if exists("xxxxMonte_SANSX") 
    194         Monte_SANSX(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 
     193#if exists("Monte_SANSX2") 
     194        Monte_SANSX2(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 
    195195#else 
    196196        Monte_SANS(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf

    r456 r457  
    758758                t0 = stopMStimer(-2) 
    759759                inputWave[0] = 1000 
     760//              Monte_SANS_Threaded(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 
    760761                Monte_SANS_NotThreaded(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 
    761762                t0 = (stopMSTimer(-2) - t0)*1e-6 
    762                 t0 *= imon/1000         //projected time, in seconds 
     763                t0 *= imon/1000/ThreadProcessorCount                    //projected time, in seconds (using threads for the calculation) 
    763764                inputWave[0] = imon             //reset 
    764765                 
     
    774775                 
    775776                linear_data = 0         //initialize 
    776 // threading crashes!! - there must be some operation in the XOP that is not threadSafe. What, I don't know...           
     777// threading crashes!! - there must be some operation in the XOP that is not threadSafe. What, I don't know... 
     778// I think it's the ran() calls, being "non-reentrant". So the XOP now defines two separate functions, that each 
     779// use a different rng. This works. 1.75x speedup.       
    777780                t0 = stopMStimer(-2) 
    778781 
    779 //              xMonte_SANS_Threaded(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 
    780                 Monte_SANS_NotThreaded(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 
     782                Monte_SANS_Threaded(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 
     783//              Monte_SANS_NotThreaded(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 
    781784 
    782785                t0 = (stopMSTimer(-2) - t0)*1e-6 
Note: See TracChangeset for help on using the changeset viewer.