Changeset 457
- Timestamp:
- Nov 26, 2008 2:37:41 PM (14 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/NewModels_2006/Cylinder_PolyRadius_v40.ipf
r455 r457 294 294 295 295 ///////NON-THREADED VERSION /////// 296 #if exists("Cyl_PolyRadiusX") 297 yw = Cyl_PolyRadiusX(cw,xw) 296 //#if exists("Cyl_PolyRadiusX") 297 // yw = Cyl_PolyRadiusX(cw,xw) 298 //#else 299 // yw = fCyl_PolyRadius(cw,xw) 300 //#endif 301 302 ///// THREADED VERSION NEEDS Igor 6.10B04 or higher to avoid crashes ////// 303 #if exists("Cyl_PolyRadiusX") 304 305 Variable npt=numpnts(yw) 306 Variable i,nthreads= ThreadProcessorCount 307 variable mt= ThreadGroupCreate(nthreads) 308 309 for(i=0;i<nthreads;i+=1) 310 // Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 311 ThreadStart mt,i,Cyl_PolyRadius_T(cw,yw,xw,(i*npt/nthreads),((i+1)*npt/nthreads-1)) 312 endfor 313 314 do 315 variable tgs= ThreadGroupWait(mt,100) 316 while( tgs != 0 ) 317 318 variable dummy= ThreadGroupRelease(mt) 319 298 320 #else 299 yw = fCyl_PolyRadius(cw,xw)321 yw = fCyl_PolyRadius(cw,xw) //the Igor, non-XOP, non-threaded calculation, messy to make ThreadSafe 300 322 #endif 301 302 /// THREADED VERSION HAS BEEN REMOVED DUE TO CRASHES //////303 //#if exists("Cyl_PolyRadiusX")304 //305 // Variable npt=numpnts(yw)306 // Variable i,nthreads= ThreadProcessorCount307 // variable mt= ThreadGroupCreate(nthreads)308 //309 // for(i=0;i<nthreads;i+=1)310 // // Print (i*npt/nthreads),((i+1)*npt/nthreads-1)311 // ThreadStart mt,i,Cyl_PolyRadius_T(cw,yw,xw,(i*npt/nthreads),((i+1)*npt/nthreads-1))312 // endfor313 //314 // do315 // variable tgs= ThreadGroupWait(mt,100)316 // while( tgs != 0 )317 //318 // variable dummy= ThreadGroupRelease(mt)319 //320 //#else321 // yw = fCyl_PolyRadius(cw,xw) //the Igor, non-XOP, non-threaded calculation, messy to make ThreadSafe322 //#endif323 323 324 324 // Print "elapsed time = ",(StopMSTimer(-2) - t1)/1e6 -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/NewModels_2008/BCC_ParaCrystal_v40.ipf
r455 r457 105 105 Wave cw,yw,xw 106 106 107 ///// NO threading ///////// 107 /////// NO threading ///////// 108 //#if exists("BCC_ParaCrystalX") 109 // yw = BCC_ParaCrystalX(cw,xw) 110 //#else 111 // yw = fBCC_ParaCrystal(cw,xw) 112 //#endif 113 114 115 /// THREADING /////// 116 117 // Variable t1=StopMSTimer(-2) 118 108 119 #if exists("BCC_ParaCrystalX") 109 yw = BCC_ParaCrystalX(cw,xw) 120 121 Variable npt=numpnts(yw) 122 Variable i,nthreads= ThreadProcessorCount 123 variable mt= ThreadGroupCreate(nthreads) 124 125 for(i=0;i<nthreads;i+=1) 126 // Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 127 ThreadStart mt,i,BCC_ParaCrystal_T(cw,yw,xw,(i*npt/nthreads),((i+1)*npt/nthreads-1)) 128 endfor 129 130 do 131 variable tgs= ThreadGroupWait(mt,100) 132 while( tgs != 0 ) 133 134 variable dummy= ThreadGroupRelease(mt) 135 110 136 #else 111 yw = fBCC_ParaCrystal(cw,xw)137 yw = fBCC_ParaCrystal(cw,xw) //the Igor, non-XOP, non-threaded calculation, messy to make ThreadSafe 112 138 #endif 113 139 114 115 /// THREADING /////// 116 117 //// Variable t1=StopMSTimer(-2) 118 // 119 //#if exists("BCC_ParaCrystalX") 120 // 121 // Variable npt=numpnts(yw) 122 // Variable i,nthreads= ThreadProcessorCount 123 // variable mt= ThreadGroupCreate(nthreads) 124 // 125 // for(i=0;i<nthreads;i+=1) 126 // // Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 127 // ThreadStart mt,i,BCC_ParaCrystal_T(cw,yw,xw,(i*npt/nthreads),((i+1)*npt/nthreads-1)) 128 // endfor 129 // 130 // do 131 // variable tgs= ThreadGroupWait(mt,100) 132 // while( tgs != 0 ) 133 // 134 // variable dummy= ThreadGroupRelease(mt) 135 // 136 //#else 137 // yw = fBCC_ParaCrystal(cw,xw) //the Igor, non-XOP, non-threaded calculation, messy to make ThreadSafe 138 //#endif 139 // 140 //// Print "elapsed time = ",(StopMSTimer(-2) - t1)/1e6 140 // Print "elapsed time = ",(StopMSTimer(-2) - t1)/1e6 141 141 142 142 -
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Packages/ModelPicker/SANSModelPicker_v40.ipf
r455 r457 576 576 DeletePoints ii, 1, includedFileWave,selToDel 577 577 // 578 // be sure to kill the dependencies, otherwise some nasty crashes can result 579 // (a bug in the WM's threading??? 580 funcToDelStr = FunctionList("*",";","WIN:"+fname+fileVerExt+".ipf") 581 KillAllDependentObjects("root:",funcToDelStr, 1, 1, 0) 578 // could kill dependencies connected to the procedure file, but really not necessary 579 //funcToDelStr = FunctionList("*",";","WIN:"+fname+fileVerExt+".ipf") 580 //KillAllDependentObjects("root:",funcToDelStr, 1, 1, 0) 582 581 583 582 endif -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MultScatter_MonteCarlo_2D.ipf
r456 r457 102 102 WAVE inputWave1,ran_dev1,nt1,j11,j21,nn1,linear_data1,retWave1 103 103 //retWave1[0] = -1*datetime //to initialize ran3 104 ThreadStart mt,i,Monte_SANS_W 1(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) 105 105 Print "started thread 1" 106 106 endif … … 191 191 WAVE inputWave,ran_dev,nt,j1,j2,nn,linear_data,results 192 192 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) 195 195 #else 196 196 Monte_SANS(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf
r456 r457 758 758 t0 = stopMStimer(-2) 759 759 inputWave[0] = 1000 760 // Monte_SANS_Threaded(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 760 761 Monte_SANS_NotThreaded(inputWave,ran_dev,nt,j1,j2,nn,linear_data,results) 761 762 t0 = (stopMSTimer(-2) - t0)*1e-6 762 t0 *= imon/1000 //projected time, in seconds763 t0 *= imon/1000/ThreadProcessorCount //projected time, in seconds (using threads for the calculation) 763 764 inputWave[0] = imon //reset 764 765 … … 774 775 775 776 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. 777 780 t0 = stopMStimer(-2) 778 781 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) 781 784 782 785 t0 = (stopMSTimer(-2) - t0)*1e-6
Note: See TracChangeset
for help on using the changeset viewer.