Changeset 369 for sans/Dev/trunk/NCNR_User_Procedures/SANS/Analysis
- Timestamp:
- May 22, 2008 4:45:39 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/SANS/Analysis/Models/NewModels_2006/Cylinder_PolyRadius_v40.ipf
r273 r369 280 280 End 281 281 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 // 290 Function 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) 318 End 283 319 284 320 //// experimental threaded version... … … 293 329 #if exists("Cyl_PolyRadiusX") //this check is done in the calling function, simply hide from compiler 294 330 yw[p1,p2] = Cyl_PolyRadiusX(cw,xw) 295 //#else296 //yw[p1,p2] = fCyl_PolyRadius(cw,xw)331 #else 332 yw[p1,p2] = fCyl_PolyRadius(cw,xw) 297 333 #endif 298 334 299 335 return 0 300 336 End 301 302 //303 // Fit function that is actually a wrapper to dispatch the calculation to N threads304 //305 // nthreads is 1 or an even number, typically 2306 // it doesn't matter if npt is odd. In this case, fractional point numbers are passed307 // and the wave indexing works just fine - I tested this with test waves of 7 and 8 points308 // and the points "2.5" and "3.5" evaluate correctly as 2 and 3309 //310 Function Cyl_PolyRadius(cw,yw,xw) : FitFunc311 Wave cw,yw,xw312 313 #if exists("Cyl_PolyRadiusX")314 315 Variable npt=numpnts(yw)316 Variable i,nthreads= ThreadProcessorCount317 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 endfor325 326 do327 variable tgs= ThreadGroupWait(mt,100)328 while( tgs != 0 )329 330 variable dummy= ThreadGroupRelease(mt)331 332 // Print "elapsed time = ",(StopMSTimer(-2) - t1)/1e6333 334 #else335 yw = fCyl_PolyRadius(cw,xw) //the Igor, non-XOP, non-threaded calculation336 #endif337 return(0)338 End
Note: See TracChangeset
for help on using the changeset viewer.