Ignore:
Timestamp:
May 29, 2008 10:16:31 AM (15 years ago)
Author:
srkline
Message:

Merging r367+ into Release for version 6.003

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Release/trunk/NCNR_User_Procedures/SANS/Analysis/Models/NewModels_2006/Cylinder_PolyRadius_v40.ipf

    r345 r374  
    280280End 
    281281 
    282  
     282// 
     283//  Fit function that is actually a wrapper to dispatch the calculation to N threads 
     284// 
     285// nthreads is 1 or an even number, typically 2 
     286// it doesn't matter if npt is odd. In this case, fractional point numbers are passed 
     287// and the wave indexing works just fine - I tested this with test waves of 7 and 8 points 
     288// and the points "2.5" and "3.5" evaluate correctly as 2 and 3 
     289// 
     290Function Cyl_PolyRadius(cw,yw,xw) : FitFunc 
     291        Wave cw,yw,xw 
     292         
     293#if exists("Cyl_PolyRadiusX") 
     294 
     295        Variable npt=numpnts(yw) 
     296        Variable i,nthreads= ThreadProcessorCount 
     297        variable mt= ThreadGroupCreate(nthreads) 
     298 
     299//      Variable t1=StopMSTimer(-2) 
     300         
     301        for(i=0;i<nthreads;i+=1) 
     302        //      Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 
     303                ThreadStart mt,i,Cyl_PolyRadius_T(cw,yw,xw,(i*npt/nthreads),((i+1)*npt/nthreads-1)) 
     304        endfor 
     305 
     306        do 
     307                variable tgs= ThreadGroupWait(mt,100) 
     308        while( tgs != 0 ) 
     309 
     310        variable dummy= ThreadGroupRelease(mt) 
     311         
     312//      Print "elapsed time = ",(StopMSTimer(-2) - t1)/1e6 
     313         
     314#else 
     315                yw = fCyl_PolyRadius(cw,xw)             //the Igor, non-XOP, non-threaded calculation 
     316#endif 
     317        return(0) 
     318End 
    283319 
    284320//// experimental threaded version... 
     
    293329#if exists("Cyl_PolyRadiusX")                   //this check is done in the calling function, simply hide from compiler 
    294330        yw[p1,p2] = Cyl_PolyRadiusX(cw,xw) 
    295 //#else 
    296 //      yw[p1,p2] = fCyl_PolyRadius(cw,xw) 
     331#else 
     332        yw[p1,p2] = fCyl_PolyRadius(cw,xw) 
    297333#endif 
    298334 
    299335        return 0 
    300336End 
    301  
    302 // 
    303 //  Fit function that is actually a wrapper to dispatch the calculation to N threads 
    304 // 
    305 // nthreads is 1 or an even number, typically 2 
    306 // it doesn't matter if npt is odd. In this case, fractional point numbers are passed 
    307 // and the wave indexing works just fine - I tested this with test waves of 7 and 8 points 
    308 // and the points "2.5" and "3.5" evaluate correctly as 2 and 3 
    309 // 
    310 Function Cyl_PolyRadius(cw,yw,xw) : FitFunc 
    311         Wave cw,yw,xw 
    312          
    313 #if exists("Cyl_PolyRadiusX") 
    314  
    315         Variable npt=numpnts(yw) 
    316         Variable i,nthreads= ThreadProcessorCount 
    317         variable mt= ThreadGroupCreate(nthreads) 
    318  
    319 //      Variable t1=StopMSTimer(-2) 
    320          
    321         for(i=0;i<nthreads;i+=1) 
    322         //      Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 
    323                 ThreadStart mt,i,Cyl_PolyRadius_T(cw,yw,xw,(i*npt/nthreads),((i+1)*npt/nthreads-1)) 
    324         endfor 
    325  
    326         do 
    327                 variable tgs= ThreadGroupWait(mt,100) 
    328         while( tgs != 0 ) 
    329  
    330         variable dummy= ThreadGroupRelease(mt) 
    331          
    332 //      Print "elapsed time = ",(StopMSTimer(-2) - t1)/1e6 
    333          
    334 #else 
    335                 yw = fCyl_PolyRadius(cw,xw)             //the Igor, non-XOP, non-threaded calculation 
    336 #endif 
    337         return(0) 
    338 End 
Note: See TracChangeset for help on using the changeset viewer.