Changeset 520 for sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models
- Timestamp:
- Jul 2, 2009 4:51:52 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Analysis/Models/NewModels_2008/FCC_ParaCrystal_v40.ipf
r516 r520 98 98 99 99 100 // nothing to change here101 // 102 // AAO version, uses XOP if available103 // simply calls the original single point calculation with104 // a wave assignment (this will behave nicely if given point ranges)100 // Threaded version 101 // Threaded XOP = 2.4 s 102 // non-threaded, non-XOP = 46.8 s 103 // = x 19.5 speedup ! 104 // 105 105 Function FCC_ParaCrystal(cw,yw,xw) : FitFunc 106 106 Wave cw,yw,xw 107 107 108 // Variable t1=StopMSTimer(-2) 109 110 111 /////// NO threading ///////// 112 //#if exists("FCC_ParaCrystalX") 113 // yw = FCC_ParaCrystalX(cw,xw) 114 //#else 115 // yw = fFCC_ParaCrystal(cw,xw) 116 //#endif 117 118 119 ///// THREADING /////// 120 121 108 122 #if exists("FCC_ParaCrystalX") 109 yw = FCC_ParaCrystalX(cw,xw) 123 124 Variable npt=numpnts(yw) 125 Variable i,nthreads= ThreadProcessorCount 126 variable mt= ThreadGroupCreate(nthreads) 127 128 for(i=0;i<nthreads;i+=1) 129 // Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 130 ThreadStart mt,i,FCC_ParaCrystal_T(cw,yw,xw,(i*npt/nthreads),((i+1)*npt/nthreads-1)) 131 endfor 132 133 do 134 variable tgs= ThreadGroupWait(mt,100) 135 while( tgs != 0 ) 136 137 variable dummy= ThreadGroupRelease(mt) 110 138 111 139 //// to return just Z(q), undo the form factor calculation … … 115 143 // yw /= SphereForm_FCC(cw[3],cw[4]-cw[5],xw)*latticeScale 116 144 //// 145 117 146 #else 118 yw = fFCC_ParaCrystal(cw,xw) 147 yw = fFCC_ParaCrystal(cw,xw) // Igor code is NOT threaded, for lots of good reasons 119 148 #endif 149 150 // Print "elapsed time = ",(StopMSTimer(-2) - t1)/1e6 151 120 152 return(0) 121 153 End 122 154 155 156 157 // nothing to change here 158 // 159 //AAO version, uses XOP if available 160 // simply calls the original single point calculation with 161 // a wave assignment (this will behave nicely if given point ranges) 162 // 163 // Threaded Version 164 ThreadSafe Function FCC_ParaCrystal_T(cw,yw,xw,p1,p2) : FitFunc 165 Wave cw,yw,xw 166 Variable p1,p2 167 168 // Variable t1=StopMSTimer(-2) 169 170 #if exists("FCC_ParaCrystalX") 171 yw[p1,p2] = FCC_ParaCrystalX(cw,xw) 172 #else 173 yw[p1,p2] = fFCC_ParaCrystal(cw,xw) // shouldn't ever see this... 174 #endif 175 176 // Print "elapsed time = ",(StopMSTimer(-2) - t1)/1e6 177 178 return(0) 179 End 123 180 124 181 //
Note: See TracChangeset
for help on using the changeset viewer.