yang
This project has not described itself yet.
Brought by drakestapleton
yang / src / ufbi_check7_gb10.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note src/ufbi_check7_gb10.om: Pure Seeded-OM-2 Zero-CUDA GB10 Runner for UFBI Check #7 |
| 3 | note (Smooth k=0 Infrared Collars: 't Hooft Z_2 Center-Vortex Twist Plane + Smooth Constant |
| 4 | note Non-Abelian Holonomy + Fully Continuum-Regular Smeared Wave-3 Observable W3_reg_scaled, |
| 5 | note 512 sweeps across 3-point non-perturbative scaled ladder L in {8, 12, 16}, beta=2.30..2.50 vs beta=6.00). |
| 6 | note |
| 7 | note Directly resolves both Check #6 referee checks: |
| 8 | note 1. Smooth (k=0) IR collars instead of checkerboard (k=pi/a) UV-alternating C6: |
| 9 | note C7_smooth_thooft: smooth identity collar with a single clean topological Z_2 |
| 10 | note center-vortex twist plane (c0=0, c1>=L/2, mu=0 -> -I). |
| 11 | note C8_smooth_hol: spatially constant (k=0) non-Abelian holonomy across the entire |
| 12 | note boundary shell (U_0=i*s1, U_1=i*s2, U_2=i*s3, U_3=(1+i+j+k)/2). |
| 13 | note 2. UV-regularized Wave-3 Symanzik observable (eliminating bare R1x2(0) UV sigma inflation): |
| 14 | note O2 = W3_reg_scaled = P(t1) - (R1x2(t1) - Chair6(t2)) [ALL 3 terms flow-time smeared!] |
| 15 | note O3 = W3_bareR_scaled = P(t1) - (R1x2(0) - Chair6(t2)) [Check #6 comparison] |
| 16 | note Exact physical flow-time matching t_flow = (alpha/6)*n_s*a^2 across L=8, 12, 16: |
| 17 | note L=8: alpha_w3=0.25000, (n1=1, n2=2) -> t1=(1/24)*a8^2, t2=(2/24)*a8^2 |
| 18 | note L=12: alpha_w3=0.28125, (n1=2, n2=4) -> t1=(1/24)*a8^2, t2=(2/24)*a8^2 |
| 19 | note L=16: alpha_w3=0.50000, (n1=2, n2=4) -> t1=(1/24)*a8^2, t2=(2/24)*a8^2 |
| 20 | note 3. Runtime ZERO_CONTACT_ASSERT verifies max_direct_err == 0.000000 on ALL 5 observables |
| 21 | note across ALL 6 geometries before running MC. |
| 22 | note |
| 23 | note Composed after: |
| 24 | note gpu/nvidia/native/nvrm/context.om |
| 25 | note gpu/nvidia/native/blackwell/vector.om |
| 26 | note gpu/nvidia/native/blackwell/launch.om |
| 27 | note gpu/nvidia/native/blackwell/batch.om |
| 28 | note om/encoder/bw_enc_sm121.om |
| 29 | note src/ufbi_math.om |
| 30 | note src/ufbi_check3_kernels.om |
| 31 | |
| 32 | global uCodePos ulong 1 |
| 33 | global uEntry ulong 8 |
| 34 | global uCodeMap long 1 |
| 35 | global uCodeFail uint 1 |
| 36 | global uBind uint 32 |
| 37 | global uBindN ulong 1 |
| 38 | global uDirty uint 1 |
| 39 | |
| 40 | global dLinks long 1 |
| 41 | global dStaples long 1 |
| 42 | global dFlags long 1 |
| 43 | global dNbSite long 1 |
| 44 | global dRng long 1 |
| 45 | |
| 46 | global hLinks f32 1048576 |
| 47 | global hSm1 f32 1048576 |
| 48 | global hSm2 f32 1048576 |
| 49 | global hNb uint 524288 |
| 50 | global hStage uchar 65536 |
| 51 | |
| 52 | global tsData f64 2560 |
| 53 | global baseMean f64 5 |
| 54 | global baseErr f64 5 |
| 55 | global baseSig f64 5 |
| 56 | global curMean f64 5 |
| 57 | global curErr f64 5 |
| 58 | global curSig f64 5 |
| 59 | global curDelta f64 5 |
| 60 | global curZ f64 5 |
| 61 | global curRBulk f64 5 |
| 62 | global mcAcc f64 8 |
| 63 | global mcCnt ulong 2 |
| 64 | global armBeta f32 1 |
| 65 | global armSeed ulong 1 |
| 66 | global armC1 ulong 1 |
| 67 | global armC2 ulong 1 |
| 68 | global armRMode ulong 1 |
| 69 | global armNSmear ulong 1 |
| 70 | global apeAlpha f32 1 |
| 71 | |
| 72 | text tC7Hdr "=== UFBI CHECK #7: SMOOTH k=0 IR COLLARS & UV-REGULAR WAVE-3 SCALED CONTINUUM TEST (PURE OM-2 GB10) ===\n" |
| 73 | text tC7Err "FAIL: GB10 native NVRM/kernel error stage=" |
| 74 | text tC7ZcFail "FAIL: ZERO_CONTACT_ASSERT violated! err=" |
| 75 | text tC7ZcOk "ZERO_CONTACT_ASSERT L=" |
| 76 | text tC7ZcR " r_mode=" |
| 77 | text tC7ZcN " n_smear=" |
| 78 | text tC7ZcE " max_direct_err=" |
| 79 | text tC7ZcP " status=PASS\n" |
| 80 | text tC7Cols "exp\tL\tbeta\tr_mode\tn_s\tcollar\tsweeps\tO0_d\tO0_Z\tO0_Rbulk\tO1_d\tO1_Z\tO1_Rbulk\tO2_d\tO2_Z\tO2_Rbulk\tO3_d\tO3_Z\tO3_Rbulk\tO4_d\tO4_Z\tO4_Rbulk\tO0_m\tO0_sig\tO2_m\tO2_sig\tus\n" |
| 81 | text tTab "\t" |
| 82 | text tNl "\n" |
| 83 | text tE7B "phys_scaled_su2" |
| 84 | text tE7C "gapless_ctrl_b6" |
| 85 | text tK0 "C0_cold" |
| 86 | text tK7 "C7_smooth_thooft" |
| 87 | text tK8 "C8_smooth_hol" |
| 88 | text tC7Done "CHECK7_GB10_DONE status=PASS zero_contact_verified=1\n" |
| 89 | |
| 90 | fn uCodeWrite w view ulong 4 to void |
| 91 | p = get uCodePos 0 |
| 92 | b = new uchar 16 0 |
| 93 | if gt get uCodeMap 0 0 |
| 94 | for i ulong 16 |
| 95 | put b i uchar and shr get w div i 4 mul rem i 4 8 255 |
| 96 | end |
| 97 | if ne mapwrite get uCodeMap 0 p b 0 16 16 |
| 98 | put uCodeFail 0 1 |
| 99 | end |
| 100 | end |
| 101 | put uCodePos 0 add p 16 |
| 102 | end |
| 103 | |
| 104 | fn uEmitAllKernels to void |
| 105 | put uCodePos 0 0 |
| 106 | for id ulong 3 |
| 107 | p = mul div add get uCodePos 0 255 256 256 |
| 108 | put uEntry id p |
| 109 | put uCodePos 0 p |
| 110 | put uPc 0 0 |
| 111 | put uGuard 0 0 |
| 112 | ok = false |
| 113 | if eq id 0 |
| 114 | ok = uEmitSu2Staple |
| 115 | end |
| 116 | if eq id 1 |
| 117 | ok = uEmitSu2Overrelax |
| 118 | end |
| 119 | if eq id 2 |
| 120 | ok = uEmitSu2Heatbath |
| 121 | end |
| 122 | if not ok |
| 123 | exit 4 |
| 124 | end |
| 125 | uDone |
| 126 | end |
| 127 | end |
| 128 | |
| 129 | fn uArg u uint to void |
| 130 | i = get uBindN 0 |
| 131 | put uBind i u |
| 132 | put uBindN 0 add i 1 |
| 133 | end |
| 134 | |
| 135 | fn uPtr va ulong to void |
| 136 | uArg gblo va |
| 137 | uArg gbhi va |
| 138 | end |
| 139 | |
| 140 | fn uRecord id ulong gx uint bx uint to bool |
| 141 | gbqmd 1 |
| 142 | a = add mapaddr get uCodeMap 0 get uEntry id |
| 143 | put gbq1 32 gblo shr a 4 |
| 144 | put gbq1 33 or uint and shr a 36 2097151 20971520 |
| 145 | put gbq1 59 gblo shr a 8 |
| 146 | put gbq1 34 or uint 65536 bx |
| 147 | put gbq1 35 or uint 131073 shl uint 64 8 |
| 148 | put gbq1 36 78923784 |
| 149 | put gbq1 37 0 |
| 150 | put gbq1 39 gx |
| 151 | put gbq1 40 1 |
| 152 | put gbq1 41 1 |
| 153 | put gbcb 216 bx |
| 154 | put gbcb 220 gx |
| 155 | put gbcb 221 1 |
| 156 | put gbcb 222 1 |
| 157 | cb = mapaddr get gbmem 1 |
| 158 | words = get uBindN 0 |
| 159 | endva = add cb add 896 mul words 4 |
| 160 | put gbcb 212 gbhi endva |
| 161 | put gbcb 213 gblo endva |
| 162 | put gbused 0 0 |
| 163 | gbsetup |
| 164 | if ne get uDirty 0 0 |
| 165 | gbmth 0 40 4 |
| 166 | gbemit 0 |
| 167 | gbemit 0 |
| 168 | gbemit 0 |
| 169 | gbemit 2281701376 |
| 170 | put uDirty 0 0 |
| 171 | end |
| 172 | gbdma cb 224 |
| 173 | for j ulong 224 |
| 174 | gbemit get gbcb j |
| 175 | end |
| 176 | gbdma add cb 896 uint words |
| 177 | for j ulong words bound 32 |
| 178 | gbemit get uBind j |
| 179 | end |
| 180 | q = mapaddr get gbmem 2 |
| 181 | gbinline q false |
| 182 | gbdma add q 8192 1 |
| 183 | gbemit 1 |
| 184 | gbinline add q 4096 true |
| 185 | gbrel add mapaddr get gbmem 3 32 6 |
| 186 | put uBindN 0 0 |
| 187 | ret gbappend id get gbst 1 |
| 188 | end |
| 189 | |
| 190 | fn uRunKernel id ulong gx uint bx uint to bool |
| 191 | put uDirty 0 1 |
| 192 | if not gbbegin 1 |
| 193 | ret false |
| 194 | end |
| 195 | if not uRecord id gx bx |
| 196 | ret false |
| 197 | end |
| 198 | ret gbbsubmit 2000000000 |
| 199 | end |
| 200 | |
| 201 | fn stageU32 k ulong v uint to void |
| 202 | b = mul k 4 |
| 203 | put hStage b uchar and v 255 |
| 204 | put hStage add b 1 uchar and shr v 8 255 |
| 205 | put hStage add b 2 uchar and shr v 16 255 |
| 206 | put hStage add b 3 uchar and shr v 24 255 |
| 207 | end |
| 208 | |
| 209 | fn stageF32 k ulong v f32 to void |
| 210 | stageU32 k bitcast uint v |
| 211 | end |
| 212 | |
| 213 | fn flushStage m long offBytes ulong nWords ulong to bool |
| 214 | nb = mul nWords 4 |
| 215 | ret eq mapwrite m offBytes hStage 0 nb long nb |
| 216 | end |
| 217 | |
| 218 | fn uploadLinks N ulong to bool |
| 219 | totalF = mul N 16 |
| 220 | off = ulong 0 |
| 221 | while lt off totalF bound 128 |
| 222 | cnt = sub totalF off |
| 223 | if gt cnt 16384 |
| 224 | cnt = ulong 16384 |
| 225 | end |
| 226 | for k ulong cnt bound 16384 |
| 227 | stageF32 k get hLinks add off k |
| 228 | end |
| 229 | if not flushStage get dLinks 0 mul off 4 cnt |
| 230 | ret false |
| 231 | end |
| 232 | off = add off cnt |
| 233 | end |
| 234 | ret true |
| 235 | end |
| 236 | |
| 237 | fn coordIdx c0 ulong c1 ulong c2 ulong c3 ulong L ulong to ulong |
| 238 | r = add mul c0 L c1 |
| 239 | r = add mul r L c2 |
| 240 | ret add mul r L c3 |
| 241 | end |
| 242 | |
| 243 | fn buildNbTable L ulong to bool |
| 244 | N = mul mul L L mul L L |
| 245 | for s ulong N bound 65536 |
| 246 | c3 = rem s L |
| 247 | t = div s L |
| 248 | c2 = rem t L |
| 249 | t = div t L |
| 250 | c1 = rem t L |
| 251 | c0 = div t L |
| 252 | b = mul s 8 |
| 253 | put hNb b uint coordIdx rem add c0 1 L c1 c2 c3 L |
| 254 | put hNb add b 1 uint coordIdx rem add c0 sub L 1 L c1 c2 c3 L |
| 255 | put hNb add b 2 uint coordIdx c0 rem add c1 1 L c2 c3 L |
| 256 | put hNb add b 3 uint coordIdx c0 rem add c1 sub L 1 L c2 c3 L |
| 257 | put hNb add b 4 uint coordIdx c0 c1 rem add c2 1 L c3 L |
| 258 | put hNb add b 5 uint coordIdx c0 c1 rem add c2 sub L 1 L c3 L |
| 259 | put hNb add b 6 uint coordIdx c0 c1 c2 rem add c3 1 L L |
| 260 | put hNb add b 7 uint coordIdx c0 c1 c2 rem add c3 sub L 1 L L |
| 261 | end |
| 262 | totalW = mul N 8 |
| 263 | off = ulong 0 |
| 264 | while lt off totalW bound 64 |
| 265 | cnt = sub totalW off |
| 266 | if gt cnt 16384 |
| 267 | cnt = ulong 16384 |
| 268 | end |
| 269 | for k ulong cnt bound 16384 |
| 270 | stageU32 k get hNb add off k |
| 271 | end |
| 272 | if not flushStage get dNbSite 0 mul off 4 cnt |
| 273 | ret false |
| 274 | end |
| 275 | off = add off cnt |
| 276 | end |
| 277 | ret true |
| 278 | end |
| 279 | |
| 280 | fn isBdryL s ulong L ulong to bool |
| 281 | c3 = rem s L |
| 282 | t = div s L |
| 283 | c2 = rem t L |
| 284 | t = div t L |
| 285 | c1 = rem t L |
| 286 | c0 = div t L |
| 287 | lm1 = sub L 1 |
| 288 | if or eq c0 0 eq c0 lm1 |
| 289 | ret true |
| 290 | end |
| 291 | if or eq c1 0 eq c1 lm1 |
| 292 | ret true |
| 293 | end |
| 294 | if or eq c2 0 eq c2 lm1 |
| 295 | ret true |
| 296 | end |
| 297 | if or eq c3 0 eq c3 lm1 |
| 298 | ret true |
| 299 | end |
| 300 | ret false |
| 301 | end |
| 302 | |
| 303 | fn isBox4 s ulong L ulong lo ulong hi ulong to bool |
| 304 | c3 = rem s L |
| 305 | t = div s L |
| 306 | c2 = rem t L |
| 307 | t = div t L |
| 308 | c1 = rem t L |
| 309 | c0 = div t L |
| 310 | if or lt c0 lo ge c0 hi |
| 311 | ret false |
| 312 | end |
| 313 | if or lt c1 lo ge c1 hi |
| 314 | ret false |
| 315 | end |
| 316 | if or lt c2 lo ge c2 hi |
| 317 | ret false |
| 318 | end |
| 319 | if or lt c3 lo ge c3 hi |
| 320 | ret false |
| 321 | end |
| 322 | ret true |
| 323 | end |
| 324 | |
| 325 | fn downloadHalo L ulong lo ulong hi ulong to void |
| 326 | N = mul mul L L mul L L |
| 327 | lm = get dLinks 0 |
| 328 | for s ulong N bound 65536 |
| 329 | if isBox4 s L lo hi |
| 330 | base = mul s 16 |
| 331 | for k ulong 16 |
| 332 | put hLinks add base k bitcast f32 uint mapget lm mul add base k 4 4 |
| 333 | end |
| 334 | end |
| 335 | end |
| 336 | end |
| 337 | |
| 338 | fn siteFlag s ulong L ulong freezeCollar bool to uint |
| 339 | if and freezeCollar isBdryL s L |
| 340 | ret uint 2 |
| 341 | end |
| 342 | c3 = rem s L |
| 343 | t = div s L |
| 344 | c2 = rem t L |
| 345 | t = div t L |
| 346 | c1 = rem t L |
| 347 | c0 = div t L |
| 348 | ret uint and add add c0 c1 add c2 c3 1 |
| 349 | end |
| 350 | |
| 351 | fn buildFlags L ulong freezeCollar bool to bool |
| 352 | N = mul mul L L mul L L |
| 353 | totalW = mul N 4 |
| 354 | off = ulong 0 |
| 355 | while lt off totalW bound 32 |
| 356 | cnt = sub totalW off |
| 357 | if gt cnt 16384 |
| 358 | cnt = ulong 16384 |
| 359 | end |
| 360 | for k ulong cnt bound 16384 |
| 361 | stageU32 k siteFlag div add off k 4 L freezeCollar |
| 362 | end |
| 363 | if not flushStage get dFlags 0 mul off 4 cnt |
| 364 | ret false |
| 365 | end |
| 366 | off = add off cnt |
| 367 | end |
| 368 | ret true |
| 369 | end |
| 370 | |
| 371 | fn seedGpuRng N ulong seed ulong to bool |
| 372 | uRngSeed seed |
| 373 | off = ulong 0 |
| 374 | while lt off N bound 16 |
| 375 | cnt = sub N off |
| 376 | if gt cnt 16384 |
| 377 | cnt = ulong 16384 |
| 378 | end |
| 379 | for k ulong cnt bound 16384 |
| 380 | r = uint and uRngNext 0xffffffff |
| 381 | if eq r 0 |
| 382 | r = uint 0x9e3779b9 |
| 383 | end |
| 384 | stageU32 k r |
| 385 | end |
| 386 | if not flushStage get dRng 0 mul off 4 cnt |
| 387 | ret false |
| 388 | end |
| 389 | off = add off cnt |
| 390 | end |
| 391 | ret true |
| 392 | end |
| 393 | |
| 394 | fn qNormHost base ulong to void |
| 395 | a0 = get hLinks base |
| 396 | a1 = get hLinks add base 1 |
| 397 | a2 = get hLinks add base 2 |
| 398 | a3 = get hLinks add base 3 |
| 399 | n2 = add add mul a0 a0 mul a1 a1 add mul a2 a2 mul a3 a3 |
| 400 | if le n2 0.0000000001f32 |
| 401 | put hLinks base 1.0f32 |
| 402 | put hLinks add base 1 0.0f32 |
| 403 | put hLinks add base 2 0.0f32 |
| 404 | put hLinks add base 3 0.0f32 |
| 405 | ret |
| 406 | end |
| 407 | inv = f32 div 1.0f64 uSqrt64 f64 n2 |
| 408 | put hLinks base mul a0 inv |
| 409 | put hLinks add base 1 mul a1 inv |
| 410 | put hLinks add base 2 mul a2 inv |
| 411 | put hLinks add base 3 mul a3 inv |
| 412 | end |
| 413 | |
| 414 | note Smooth k=0 Infrared Collars: |
| 415 | note cid=0 (C0_cold): all identity I |
| 416 | note cid=3 (C3_hot_haar): Haar random (used for ZERO_CONTACT_ASSERT) |
| 417 | note cid=7 (C7_smooth_thooft): smooth identity collar with a single clean topological |
| 418 | note Z_2 center-vortex twist plane (c0=0, c1>=L/2, mu=0 -> -I) |
| 419 | note AND orthogonal Z_2 twist plane (c2=0, c3>=L/2, mu=2 -> -I) |
| 420 | note cid=8 (C8_smooth_hol): spatially constant (k=0) non-Abelian boundary holonomy |
| 421 | note U_0=i*s1, U_1=i*s2, U_2=i*s3, U_3=(1+i+j+k)/2 everywhere |
| 422 | fn setCollarLink s ulong mu ulong L ulong cid ulong to void |
| 423 | base = mul add mul s 4 mu 4 |
| 424 | put hLinks base 1.0f32 |
| 425 | put hLinks add base 1 0.0f32 |
| 426 | put hLinks add base 2 0.0f32 |
| 427 | put hLinks add base 3 0.0f32 |
| 428 | if eq cid 0 |
| 429 | ret |
| 430 | end |
| 431 | if eq cid 3 |
| 432 | put hLinks base f32 uRngNorm64 |
| 433 | put hLinks add base 1 f32 uRngNorm64 |
| 434 | put hLinks add base 2 f32 uRngNorm64 |
| 435 | put hLinks add base 3 f32 uRngNorm64 |
| 436 | qNormHost base |
| 437 | ret |
| 438 | end |
| 439 | c3 = rem s L |
| 440 | c2 = rem div s L L |
| 441 | c1 = rem div s mul L L L |
| 442 | c0 = div s mul mul L L L |
| 443 | half = div L 2 |
| 444 | if eq cid 7 |
| 445 | if and eq mu 0 and eq c0 0 ge c1 half |
| 446 | put hLinks base neg 1.0f32 |
| 447 | end |
| 448 | if and eq mu 2 and eq c2 0 ge c3 half |
| 449 | put hLinks base neg 1.0f32 |
| 450 | end |
| 451 | ret |
| 452 | end |
| 453 | if eq cid 8 |
| 454 | if eq mu 0 |
| 455 | put hLinks base 0.0f32 |
| 456 | put hLinks add base 1 1.0f32 |
| 457 | end |
| 458 | if eq mu 1 |
| 459 | put hLinks base 0.0f32 |
| 460 | put hLinks add base 2 1.0f32 |
| 461 | end |
| 462 | if eq mu 2 |
| 463 | put hLinks base 0.0f32 |
| 464 | put hLinks add base 3 1.0f32 |
| 465 | end |
| 466 | if eq mu 3 |
| 467 | put hLinks base 0.5f32 |
| 468 | put hLinks add base 1 0.5f32 |
| 469 | put hLinks add base 2 0.5f32 |
| 470 | put hLinks add base 3 0.5f32 |
| 471 | end |
| 472 | end |
| 473 | end |
| 474 | |
| 475 | fn initLatticeHost L ulong cid ulong freezeCollar bool seed ulong to void |
| 476 | N = mul mul L L mul L L |
| 477 | uRngSeed seed |
| 478 | for s ulong N bound 65536 |
| 479 | isB = and freezeCollar isBdryL s L |
| 480 | for mu ulong 4 |
| 481 | if isB |
| 482 | setCollarLink s mu L cid |
| 483 | else |
| 484 | base = mul add mul s 4 mu 4 |
| 485 | put hLinks base 0.85f32 |
| 486 | put hLinks add base 1 mul 0.25f32 f32 uRngNorm64 |
| 487 | put hLinks add base 2 mul 0.25f32 f32 uRngNorm64 |
| 488 | put hLinks add base 3 mul 0.25f32 f32 uRngNorm64 |
| 489 | qNormHost base |
| 490 | end |
| 491 | end |
| 492 | end |
| 493 | end |
| 494 | |
| 495 | fn initLattice L ulong cid ulong freezeCollar bool seed ulong to bool |
| 496 | N = mul mul L L mul L L |
| 497 | initLatticeHost L cid freezeCollar seed |
| 498 | ret uploadLinks N |
| 499 | end |
| 500 | |
| 501 | fn gpuRunStaple N ulong mu ulong par ulong to bool |
| 502 | gx = uint div add N 255 256 |
| 503 | nu0 = ulong 0 |
| 504 | nu1 = ulong 1 |
| 505 | nu2 = ulong 2 |
| 506 | if eq mu 0 |
| 507 | nu0 = ulong 1 |
| 508 | nu1 = ulong 2 |
| 509 | nu2 = ulong 3 |
| 510 | end |
| 511 | if eq mu 1 |
| 512 | nu0 = ulong 0 |
| 513 | nu1 = ulong 2 |
| 514 | nu2 = ulong 3 |
| 515 | end |
| 516 | if eq mu 2 |
| 517 | nu0 = ulong 0 |
| 518 | nu1 = ulong 1 |
| 519 | nu2 = ulong 3 |
| 520 | end |
| 521 | uPtr mapaddr get dLinks 0 |
| 522 | uPtr mapaddr get dStaples 0 |
| 523 | uPtr mapaddr get dFlags 0 |
| 524 | uPtr mapaddr get dNbSite 0 |
| 525 | uArg uint N |
| 526 | uArg uint mu |
| 527 | uArg uint par |
| 528 | uArg uint nu0 |
| 529 | uArg uint nu1 |
| 530 | uArg uint nu2 |
| 531 | ret uRunKernel 0 gx 256 |
| 532 | end |
| 533 | |
| 534 | fn gpuRunOverrelax N ulong mu ulong par ulong to bool |
| 535 | gx = uint div add N 255 256 |
| 536 | uPtr mapaddr get dLinks 0 |
| 537 | uPtr mapaddr get dStaples 0 |
| 538 | uPtr mapaddr get dFlags 0 |
| 539 | uArg uint N |
| 540 | uArg uint mu |
| 541 | uArg uint par |
| 542 | ret uRunKernel 1 gx 256 |
| 543 | end |
| 544 | |
| 545 | fn gpuRunHeatbath N ulong mu ulong par ulong beta f32 to bool |
| 546 | gx = uint div add N 255 256 |
| 547 | uPtr mapaddr get dLinks 0 |
| 548 | uPtr mapaddr get dStaples 0 |
| 549 | uPtr mapaddr get dFlags 0 |
| 550 | uPtr mapaddr get dRng 0 |
| 551 | uArg uint N |
| 552 | uArg uint mu |
| 553 | uArg uint par |
| 554 | uArg bitcast uint beta |
| 555 | ret uRunKernel 2 gx 256 |
| 556 | end |
| 557 | |
| 558 | fn gpuSweep N ulong beta f32 nOr ulong to bool |
| 559 | for mu ulong 4 |
| 560 | for par ulong 2 |
| 561 | if not gpuRunStaple N mu par |
| 562 | ret false |
| 563 | end |
| 564 | if not gpuRunHeatbath N mu par beta |
| 565 | ret false |
| 566 | end |
| 567 | for r ulong nOr bound 8 |
| 568 | if not gpuRunStaple N mu par |
| 569 | ret false |
| 570 | end |
| 571 | if not gpuRunOverrelax N mu par |
| 572 | ret false |
| 573 | end |
| 574 | end |
| 575 | end |
| 576 | end |
| 577 | ret true |
| 578 | end |
| 579 | |
| 580 | note ========================================================================= |
| 581 | note Host Quaternion Helpers + Parameterized-Alpha Exact-Box APE Smearing |
| 582 | note ========================================================================= |
| 583 | fn hQMul a view f32 4 b view f32 4 o edit f32 4 to void |
| 584 | v = mul get a 0 get b 0 |
| 585 | v = sub v mul get a 1 get b 1 |
| 586 | v = sub v mul get a 2 get b 2 |
| 587 | v = sub v mul get a 3 get b 3 |
| 588 | put o 0 v |
| 589 | v = mul get a 0 get b 1 |
| 590 | v = add v mul get a 1 get b 0 |
| 591 | v = add v mul get a 2 get b 3 |
| 592 | v = sub v mul get a 3 get b 2 |
| 593 | put o 1 v |
| 594 | v = mul get a 0 get b 2 |
| 595 | v = sub v mul get a 1 get b 3 |
| 596 | v = add v mul get a 2 get b 0 |
| 597 | v = add v mul get a 3 get b 1 |
| 598 | put o 2 v |
| 599 | v = mul get a 0 get b 3 |
| 600 | v = add v mul get a 1 get b 2 |
| 601 | v = sub v mul get a 2 get b 1 |
| 602 | v = add v mul get a 3 get b 0 |
| 603 | put o 3 v |
| 604 | end |
| 605 | |
| 606 | fn hQConj q edit f32 4 to void |
| 607 | put q 1 neg get q 1 |
| 608 | put q 2 neg get q 2 |
| 609 | put q 3 neg get q 3 |
| 610 | end |
| 611 | |
| 612 | fn hQNorm q edit f32 4 to void |
| 613 | n2 = mul get q 0 get q 0 |
| 614 | n2 = add n2 mul get q 1 get q 1 |
| 615 | n2 = add n2 mul get q 2 get q 2 |
| 616 | n2 = add n2 mul get q 3 get q 3 |
| 617 | if le n2 0.0000000001f32 |
| 618 | put q 0 1.0f32 |
| 619 | put q 1 0.0f32 |
| 620 | put q 2 0.0f32 |
| 621 | put q 3 0.0f32 |
| 622 | ret |
| 623 | end |
| 624 | inv = f32 div 1.0f64 uSqrt64 f64 n2 |
| 625 | for c ulong 4 |
| 626 | put q c mul get q c inv |
| 627 | end |
| 628 | end |
| 629 | |
| 630 | fn hLoadS slot ulong s ulong mu ulong dst edit f32 4 to void |
| 631 | b = mul add mul s 4 mu 4 |
| 632 | if eq slot 0 |
| 633 | put dst 0 get hLinks b |
| 634 | put dst 1 get hLinks add b 1 |
| 635 | put dst 2 get hLinks add b 2 |
| 636 | put dst 3 get hLinks add b 3 |
| 637 | ret |
| 638 | end |
| 639 | if eq slot 1 |
| 640 | put dst 0 get hSm1 b |
| 641 | put dst 1 get hSm1 add b 1 |
| 642 | put dst 2 get hSm1 add b 2 |
| 643 | put dst 3 get hSm1 add b 3 |
| 644 | ret |
| 645 | end |
| 646 | put dst 0 get hSm2 b |
| 647 | put dst 1 get hSm2 add b 1 |
| 648 | put dst 2 get hSm2 add b 2 |
| 649 | put dst 3 get hSm2 add b 3 |
| 650 | end |
| 651 | |
| 652 | fn hStoreS slot ulong s ulong mu ulong src view f32 4 to void |
| 653 | b = mul add mul s 4 mu 4 |
| 654 | if eq slot 1 |
| 655 | put hSm1 b get src 0 |
| 656 | put hSm1 add b 1 get src 1 |
| 657 | put hSm1 add b 2 get src 2 |
| 658 | put hSm1 add b 3 get src 3 |
| 659 | ret |
| 660 | end |
| 661 | put hSm2 b get src 0 |
| 662 | put hSm2 add b 1 get src 1 |
| 663 | put hSm2 add b 2 get src 2 |
| 664 | put hSm2 add b 3 get src 3 |
| 665 | end |
| 666 | |
| 667 | fn getNb s ulong dir ulong isMinus ulong to ulong |
| 668 | ret ulong get hNb add mul s 8 add mul dir 2 isMinus |
| 669 | end |
| 670 | |
| 671 | fn hStapleAdd slot ulong s ulong mu ulong nu ulong isBack bool dst edit f32 4 to void |
| 672 | t1 = new f32 4 0.0f32 |
| 673 | t2 = new f32 4 0.0f32 |
| 674 | t3 = new f32 4 0.0f32 |
| 675 | p1 = new f32 4 0.0f32 |
| 676 | p2 = new f32 4 0.0f32 |
| 677 | xp = getNb s mu 0 |
| 678 | if not isBack |
| 679 | hLoadS slot s nu t1 |
| 680 | hLoadS slot getNb s nu 0 mu t2 |
| 681 | hLoadS slot xp nu t3 |
| 682 | hQConj t3 |
| 683 | else |
| 684 | xm = getNb s nu 1 |
| 685 | hLoadS slot xm nu t1 |
| 686 | hQConj t1 |
| 687 | hLoadS slot xm mu t2 |
| 688 | hLoadS slot getNb xp nu 1 nu t3 |
| 689 | end |
| 690 | hQMul t1 t2 p1 |
| 691 | hQMul p1 t3 p2 |
| 692 | for c ulong 4 |
| 693 | put dst c add get dst c get p2 c |
| 694 | end |
| 695 | end |
| 696 | |
| 697 | fn hApeLink srcSlot ulong dstSlot ulong s ulong mu ulong to void |
| 698 | st = new f32 4 0.0f32 |
| 699 | u = new f32 4 0.0f32 |
| 700 | al = get apeAlpha 0 |
| 701 | w0 = sub 1.0f32 al |
| 702 | w1 = div al 6.0f32 |
| 703 | for nu ulong 4 |
| 704 | if ne nu mu |
| 705 | hStapleAdd srcSlot s mu nu false st |
| 706 | hStapleAdd srcSlot s mu nu true st |
| 707 | end |
| 708 | end |
| 709 | hLoadS srcSlot s mu u |
| 710 | for c ulong 4 |
| 711 | put u c add mul w0 get u c mul w1 get st c |
| 712 | end |
| 713 | hQNorm u |
| 714 | hStoreS dstSlot s mu u |
| 715 | end |
| 716 | |
| 717 | fn hApeBox L ulong srcSlot ulong dstSlot ulong lo ulong hi ulong to void |
| 718 | N = mul mul L L mul L L |
| 719 | for s ulong N bound 65536 |
| 720 | if isBox4 s L lo hi |
| 721 | for mu ulong 4 |
| 722 | hApeLink srcSlot dstSlot s mu |
| 723 | end |
| 724 | end |
| 725 | end |
| 726 | end |
| 727 | |
| 728 | fn runApeChain L ulong nSmear ulong needLo ulong needHi ulong to ulong |
| 729 | if eq nSmear 0 |
| 730 | ret ulong 0 |
| 731 | end |
| 732 | src = ulong 0 |
| 733 | dst = ulong 1 |
| 734 | for step ulong nSmear bound 8 |
| 735 | remSteps = sub sub nSmear 1 step |
| 736 | lo = sub needLo remSteps |
| 737 | hi = add needHi remSteps |
| 738 | hApeBox L src dst lo hi |
| 739 | src = dst |
| 740 | if eq dst 1 |
| 741 | dst = ulong 2 |
| 742 | else |
| 743 | dst = ulong 1 |
| 744 | end |
| 745 | end |
| 746 | ret src |
| 747 | end |
| 748 | |
| 749 | fn hPlaqS slot ulong s ulong mu ulong nu ulong to f64 |
| 750 | a = new f32 4 0.0f32 |
| 751 | b = new f32 4 0.0f32 |
| 752 | p = new f32 4 0.0f32 |
| 753 | q = new f32 4 0.0f32 |
| 754 | hLoadS slot s mu a |
| 755 | hLoadS slot getNb s mu 0 nu b |
| 756 | hQMul a b p |
| 757 | hLoadS slot getNb s nu 0 mu a |
| 758 | hQConj a |
| 759 | hQMul p a q |
| 760 | hLoadS slot s nu b |
| 761 | hQConj b |
| 762 | hQMul q b p |
| 763 | ret f64 get p 0 |
| 764 | end |
| 765 | |
| 766 | fn hRect1x2S slot ulong s ulong mu ulong nu ulong to f64 |
| 767 | a = new f32 4 0.0f32 |
| 768 | b = new f32 4 0.0f32 |
| 769 | p = new f32 4 0.0f32 |
| 770 | q = new f32 4 0.0f32 |
| 771 | s1 = getNb s mu 0 |
| 772 | s2 = getNb s1 mu 0 |
| 773 | hLoadS slot s mu a |
| 774 | hLoadS slot s1 mu b |
| 775 | hQMul a b p |
| 776 | hLoadS slot s2 nu a |
| 777 | hQMul p a q |
| 778 | hLoadS slot getNb s1 nu 0 mu a |
| 779 | hQConj a |
| 780 | hQMul q a p |
| 781 | hLoadS slot getNb s nu 0 mu a |
| 782 | hQConj a |
| 783 | hQMul p a q |
| 784 | hLoadS slot s nu b |
| 785 | hQConj b |
| 786 | hQMul q b p |
| 787 | ret f64 get p 0 |
| 788 | end |
| 789 | |
| 790 | fn hRect2x2S slot ulong s ulong mu ulong nu ulong to f64 |
| 791 | a = new f32 4 0.0f32 |
| 792 | p = new f32 4 0.0f32 |
| 793 | q = new f32 4 0.0f32 |
| 794 | cur = s |
| 795 | hLoadS slot cur mu p |
| 796 | cur = getNb cur mu 0 |
| 797 | hLoadS slot cur mu a |
| 798 | hQMul p a q |
| 799 | cur = getNb cur mu 0 |
| 800 | hLoadS slot cur nu a |
| 801 | hQMul q a p |
| 802 | cur = getNb cur nu 0 |
| 803 | hLoadS slot cur nu a |
| 804 | hQMul p a q |
| 805 | cur = getNb cur nu 0 |
| 806 | cur = getNb cur mu 1 |
| 807 | hLoadS slot cur mu a |
| 808 | hQConj a |
| 809 | hQMul q a p |
| 810 | cur = getNb cur mu 1 |
| 811 | hLoadS slot cur mu a |
| 812 | hQConj a |
| 813 | hQMul p a q |
| 814 | cur = getNb cur nu 1 |
| 815 | hLoadS slot cur nu a |
| 816 | hQConj a |
| 817 | hQMul q a p |
| 818 | cur = getNb cur nu 1 |
| 819 | hLoadS slot cur nu a |
| 820 | hQConj a |
| 821 | hQMul p a q |
| 822 | ret f64 get q 0 |
| 823 | end |
| 824 | |
| 825 | fn hChair6S slot ulong s ulong d0 ulong d1 ulong d2 ulong to f64 |
| 826 | a = new f32 4 0.0f32 |
| 827 | p = new f32 4 0.0f32 |
| 828 | q = new f32 4 0.0f32 |
| 829 | cur = s |
| 830 | hLoadS slot cur d0 p |
| 831 | cur = getNb cur d0 0 |
| 832 | hLoadS slot cur d1 a |
| 833 | hQMul p a q |
| 834 | cur = getNb cur d1 0 |
| 835 | hLoadS slot cur d2 a |
| 836 | hQMul q a p |
| 837 | cur = getNb cur d2 0 |
| 838 | cur = getNb cur d0 1 |
| 839 | hLoadS slot cur d0 a |
| 840 | hQConj a |
| 841 | hQMul p a q |
| 842 | cur = getNb cur d1 1 |
| 843 | hLoadS slot cur d1 a |
| 844 | hQConj a |
| 845 | hQMul q a p |
| 846 | cur = getNb cur d2 1 |
| 847 | hLoadS slot cur d2 a |
| 848 | hQConj a |
| 849 | hQMul p a q |
| 850 | ret f64 get q 0 |
| 851 | end |
| 852 | |
| 853 | note ========================================================================= |
| 854 | note Measurement Engine for Check #7: |
| 855 | note O0: W_phys (scaled smeared loop: L=8 1x1 n=1; L=12 1x2 n=2; L=16 2x2 n=4) |
| 856 | note O1: Adj_phys (4*W_phys^2 - 1) |
| 857 | note O2: W3_reg_scaled (FULLY UV-REGULAR: P(t1) - (R1x2(t1) - Chair6(t2)), zero bare UV noise!) |
| 858 | note O3: W3_bareR_scaled (Check #6 version: P(t1) - (R1x2(0) - Chair6(t2)) for direct comparison) |
| 859 | note O4: Plaq_t1 (single-term smeared P(t1) at center site) |
| 860 | note ========================================================================= |
| 861 | fn accumMainSite s ulong sl ulong rMode ulong to void |
| 862 | for mu ulong 4 |
| 863 | for nu ulong 4 |
| 864 | if lt mu nu |
| 865 | vs = f64 0.0f64 |
| 866 | if eq rMode 0 |
| 867 | vs = hPlaqS sl s mu nu |
| 868 | end |
| 869 | if eq rMode 1 |
| 870 | vs = hRect1x2S sl s mu nu |
| 871 | end |
| 872 | if eq rMode 2 |
| 873 | vs = hRect2x2S sl s mu nu |
| 874 | end |
| 875 | put mcAcc 0 add get mcAcc 0 vs |
| 876 | put mcAcc 1 add get mcAcc 1 sub mul 4.0f64 mul vs vs 1.0f64 |
| 877 | put mcCnt 0 add get mcCnt 0 1 |
| 878 | end |
| 879 | end |
| 880 | end |
| 881 | end |
| 882 | |
| 883 | fn evalCtrPlaq sl ulong ctrSite ulong to f64 |
| 884 | s = f64 0.0f64 |
| 885 | for mu ulong 4 |
| 886 | for nu ulong 4 |
| 887 | if lt mu nu |
| 888 | s = add s hPlaqS sl ctrSite mu nu |
| 889 | end |
| 890 | end |
| 891 | end |
| 892 | ret div s 6.0f64 |
| 893 | end |
| 894 | |
| 895 | fn evalCtrRect sl ulong ctrSite ulong to f64 |
| 896 | s = f64 0.0f64 |
| 897 | for mu ulong 4 |
| 898 | for nu ulong 4 |
| 899 | if lt mu nu |
| 900 | s = add s hRect1x2S sl ctrSite mu nu |
| 901 | end |
| 902 | end |
| 903 | end |
| 904 | ret div s 6.0f64 |
| 905 | end |
| 906 | |
| 907 | fn evalCtrChair sl ulong ctrSite ulong to f64 |
| 908 | c = hChair6S sl ctrSite 0 1 2 |
| 909 | c = add c hChair6S sl ctrSite 0 1 3 |
| 910 | c = add c hChair6S sl ctrSite 0 2 3 |
| 911 | c = add c hChair6S sl ctrSite 1 2 3 |
| 912 | ret mul 0.25f64 c |
| 913 | end |
| 914 | |
| 915 | fn evalHost7Main L ulong rMode ulong nSmear ulong res edit f64 5 to void |
| 916 | lo = ulong 3 |
| 917 | hi = ulong 5 |
| 918 | needHi = ulong 6 |
| 919 | if eq L 12 |
| 920 | lo = ulong 5 |
| 921 | hi = ulong 7 |
| 922 | needHi = ulong 9 |
| 923 | end |
| 924 | if eq L 16 |
| 925 | lo = ulong 6 |
| 926 | hi = ulong 8 |
| 927 | needHi = ulong 10 |
| 928 | end |
| 929 | put apeAlpha 0 0.50f32 |
| 930 | sl = runApeChain L nSmear lo needHi |
| 931 | put mcAcc 0 0.0f64 |
| 932 | put mcAcc 1 0.0f64 |
| 933 | put mcCnt 0 0 |
| 934 | N = mul mul L L mul L L |
| 935 | for s ulong N bound 65536 |
| 936 | if isBox4 s L lo hi |
| 937 | accumMainSite s sl rMode |
| 938 | end |
| 939 | end |
| 940 | fc = f64 get mcCnt 0 |
| 941 | put res 0 div get mcAcc 0 fc |
| 942 | put res 1 div get mcAcc 1 fc |
| 943 | end |
| 944 | |
| 945 | note Evaluate UV-regular W3_reg = P(t1) - (R1x2(t1) - Chair6(t2)) AND W3_bareR = P(t1) - (R1x2(0) - Chair6(t2)) |
| 946 | note R1x2 at ctrLo uses links in [ctrLo, ctrLo+3), so t1 smearing needs [ctrLo, ctrLo+3): |
| 947 | note L=8 (ctrLo=3, n1=1): [3,6) + 1 -> [2,6] ZERO contact with {0,7}! |
| 948 | note L=12 (ctrLo=5, n1=2): [5,8) + 2 -> [3,9] ZERO contact with {0,11}! |
| 949 | note L=16 (ctrLo=7, n1=2): [7,10) + 2 -> [5,11] ZERO contact with {0,15}! |
| 950 | fn evalHost7W3 L ulong res edit f64 5 to void |
| 951 | ctrLo = ulong 3 |
| 952 | w3Al = f32 0.25f32 |
| 953 | w3N1 = ulong 1 |
| 954 | w3N2 = ulong 2 |
| 955 | if eq L 12 |
| 956 | ctrLo = ulong 5 |
| 957 | w3Al = f32 0.28125f32 |
| 958 | w3N1 = ulong 2 |
| 959 | w3N2 = ulong 4 |
| 960 | end |
| 961 | if eq L 16 |
| 962 | ctrLo = ulong 7 |
| 963 | w3Al = f32 0.50f32 |
| 964 | w3N1 = ulong 2 |
| 965 | w3N2 = ulong 4 |
| 966 | end |
| 967 | ctrSite = coordIdx ctrLo ctrLo ctrLo ctrLo L |
| 968 | r0 = evalCtrRect 0 ctrSite |
| 969 | put apeAlpha 0 w3Al |
| 970 | sl1 = runApeChain L w3N1 ctrLo add ctrLo 3 |
| 971 | p1 = evalCtrPlaq sl1 ctrSite |
| 972 | r1 = evalCtrRect sl1 ctrSite |
| 973 | sl2 = runApeChain L w3N2 ctrLo add ctrLo 2 |
| 974 | ch2 = evalCtrChair sl2 ctrSite |
| 975 | put res 2 sub p1 sub r1 ch2 |
| 976 | put res 3 sub p1 sub r0 ch2 |
| 977 | put res 4 p1 |
| 978 | end |
| 979 | |
| 980 | fn evalHost7 L ulong rMode ulong nSmear ulong res edit f64 5 to void |
| 981 | evalHost7Main L rMode nSmear res |
| 982 | evalHost7W3 L res |
| 983 | end |
| 984 | |
| 985 | fn assertZeroContact7 L ulong rMode ulong nSmear ulong to void |
| 986 | N = mul mul L L mul L L |
| 987 | initLatticeHost L 0 true 0x77771234 |
| 988 | v0 = new f64 5 0.0f64 |
| 989 | v1 = new f64 5 0.0f64 |
| 990 | evalHost7 L rMode nSmear v0 |
| 991 | uRngSeed 0x99995678 |
| 992 | for s ulong N bound 65536 |
| 993 | if isBdryL s L |
| 994 | for mu ulong 4 |
| 995 | setCollarLink s mu L 3 |
| 996 | end |
| 997 | end |
| 998 | end |
| 999 | evalHost7 L rMode nSmear v1 |
| 1000 | maxE = f64 0.0f64 |
| 1001 | for o ulong 5 |
| 1002 | e = uAbs64 sub get v1 o get v0 o |
| 1003 | if gt e maxE |
| 1004 | maxE = e |
| 1005 | end |
| 1006 | end |
| 1007 | if gt maxE 0.000000000001f64 |
| 1008 | uPrint tC7ZcFail |
| 1009 | uPrintF64 maxE |
| 1010 | uPrint tNl |
| 1011 | exit 99 |
| 1012 | end |
| 1013 | uPrint tC7ZcOk |
| 1014 | uPrintU L |
| 1015 | uPrint tC7ZcR |
| 1016 | uPrintU rMode |
| 1017 | uPrint tC7ZcN |
| 1018 | uPrintU nSmear |
| 1019 | uPrint tC7ZcE |
| 1020 | uPrintF64 maxE |
| 1021 | uPrint tC7ZcP |
| 1022 | end |
| 1023 | |
| 1024 | fn storeMeas7 L ulong rMode ulong nSmear ulong k ulong to void |
| 1025 | downloadHalo L 1 sub L 1 |
| 1026 | v = new f64 5 0.0f64 |
| 1027 | evalHost7 L rMode nSmear v |
| 1028 | b = mul k 5 |
| 1029 | for o ulong 5 |
| 1030 | put tsData add b o get v o |
| 1031 | end |
| 1032 | end |
| 1033 | |
| 1034 | fn sumBlk7 o ulong st ulong blkSz ulong to f64 |
| 1035 | s = f64 0.0f64 |
| 1036 | for j ulong blkSz bound 64 |
| 1037 | s = add s get tsData add mul add st j 5 o |
| 1038 | end |
| 1039 | ret s |
| 1040 | end |
| 1041 | |
| 1042 | fn summarizeOne7 o ulong nMeas ulong to void |
| 1043 | blkSz = div nMeas 16 |
| 1044 | tot = f64 0.0f64 |
| 1045 | for k ulong nMeas bound 512 |
| 1046 | tot = add tot get tsData add mul k 5 o |
| 1047 | end |
| 1048 | mean = div tot f64 nMeas |
| 1049 | put curMean o mean |
| 1050 | vSum = f64 0.0f64 |
| 1051 | for k ulong nMeas bound 512 |
| 1052 | dv = sub get tsData add mul k 5 o mean |
| 1053 | vSum = add vSum mul dv dv |
| 1054 | end |
| 1055 | put curSig o uSqrt64 div vSum f64 sub nMeas 1 |
| 1056 | jkSum = f64 0.0f64 |
| 1057 | for b ulong 16 |
| 1058 | bs = sumBlk7 o mul b blkSz blkSz |
| 1059 | d = sub div sub tot bs f64 sub nMeas blkSz mean |
| 1060 | jkSum = add jkSum mul d d |
| 1061 | end |
| 1062 | put curErr o uSqrt64 mul 0.9375f64 jkSum |
| 1063 | end |
| 1064 | |
| 1065 | fn summarizeTs7 nMeas ulong to void |
| 1066 | for o ulong 5 |
| 1067 | summarizeOne7 o nMeas |
| 1068 | end |
| 1069 | end |
| 1070 | |
| 1071 | fn computeDiffZR7 cid ulong to void |
| 1072 | if eq cid 0 |
| 1073 | for o ulong 5 |
| 1074 | put baseMean o get curMean o |
| 1075 | put baseErr o get curErr o |
| 1076 | put baseSig o get curSig o |
| 1077 | put curDelta o 0.0f64 |
| 1078 | put curZ o 0.0f64 |
| 1079 | put curRBulk o 0.0f64 |
| 1080 | end |
| 1081 | ret |
| 1082 | end |
| 1083 | for o ulong 5 |
| 1084 | diff = uAbs64 sub get curMean o get baseMean o |
| 1085 | se = uSqrt64 add mul get curErr o get curErr o mul get baseErr o get baseErr o |
| 1086 | z = f64 0.0f64 |
| 1087 | if gt se 0.0000001f64 |
| 1088 | z = div diff se |
| 1089 | end |
| 1090 | rBulk = f64 0.0f64 |
| 1091 | sb = get baseSig o |
| 1092 | if gt sb 0.0000001f64 |
| 1093 | rBulk = div diff sb |
| 1094 | end |
| 1095 | put curDelta o diff |
| 1096 | put curZ o z |
| 1097 | put curRBulk o rBulk |
| 1098 | end |
| 1099 | end |
| 1100 | |
| 1101 | fn printRow7 expId ulong L ulong cid ulong nMeas ulong us ulong to void |
| 1102 | if eq expId 1 |
| 1103 | uPrint tE7B |
| 1104 | else |
| 1105 | uPrint tE7C |
| 1106 | end |
| 1107 | uPrint tTab |
| 1108 | uPrintU L |
| 1109 | uPrint tTab |
| 1110 | uPrintF64 f64 get armBeta 0 |
| 1111 | uPrint tTab |
| 1112 | uPrintU get armRMode 0 |
| 1113 | uPrint tTab |
| 1114 | uPrintU get armNSmear 0 |
| 1115 | uPrint tTab |
| 1116 | if eq cid 0 |
| 1117 | uPrint tK0 |
| 1118 | end |
| 1119 | if eq cid 7 |
| 1120 | uPrint tK7 |
| 1121 | end |
| 1122 | if eq cid 8 |
| 1123 | uPrint tK8 |
| 1124 | end |
| 1125 | uPrint tTab |
| 1126 | uPrintU nMeas |
| 1127 | for o ulong 5 |
| 1128 | uPrint tTab |
| 1129 | uPrintF64 get curDelta o |
| 1130 | uPrint tTab |
| 1131 | uPrintF64 get curZ o |
| 1132 | uPrint tTab |
| 1133 | uPrintF64 get curRBulk o |
| 1134 | end |
| 1135 | uPrint tTab |
| 1136 | uPrintF64 get curMean 0 |
| 1137 | uPrint tTab |
| 1138 | uPrintF64 get curSig 0 |
| 1139 | uPrint tTab |
| 1140 | uPrintF64 get curMean 2 |
| 1141 | uPrint tTab |
| 1142 | uPrintF64 get curSig 2 |
| 1143 | uPrint tTab |
| 1144 | uPrintU us |
| 1145 | uPrint tNl |
| 1146 | end |
| 1147 | |
| 1148 | fn runArm7 expId ulong L ulong beta f32 cid ulong nTherm ulong nMeas ulong to void |
| 1149 | t0 = monons |
| 1150 | put armBeta 0 beta |
| 1151 | seed = get armSeed 0 |
| 1152 | N = mul mul L L mul L L |
| 1153 | if not seedGpuRng N add seed mul cid 7919 |
| 1154 | exit 31 |
| 1155 | end |
| 1156 | if not initLattice L cid true add seed mul cid 104729 |
| 1157 | exit 32 |
| 1158 | end |
| 1159 | for sw ulong nTherm bound 128 |
| 1160 | if not gpuSweep N beta 3 |
| 1161 | exit 33 |
| 1162 | end |
| 1163 | end |
| 1164 | rm = get armRMode 0 |
| 1165 | ns = get armNSmear 0 |
| 1166 | for k ulong nMeas bound 512 |
| 1167 | if not gpuSweep N beta 2 |
| 1168 | exit 34 |
| 1169 | end |
| 1170 | if not gpuSweep N beta 2 |
| 1171 | exit 35 |
| 1172 | end |
| 1173 | storeMeas7 L rm ns k |
| 1174 | end |
| 1175 | summarizeTs7 nMeas |
| 1176 | computeDiffZR7 cid |
| 1177 | us = div ulong sub monons t0 1000 |
| 1178 | printRow7 expId L cid nMeas us |
| 1179 | end |
| 1180 | |
| 1181 | fn runBox7 expId ulong L ulong beta f32 nTh ulong nMs ulong to bool |
| 1182 | if not buildNbTable L |
| 1183 | ret false |
| 1184 | end |
| 1185 | if not buildFlags L true |
| 1186 | ret false |
| 1187 | end |
| 1188 | assertZeroContact7 L get armRMode 0 get armNSmear 0 |
| 1189 | runArm7 expId L beta 0 nTh nMs |
| 1190 | runArm7 expId L beta get armC1 0 nTh nMs |
| 1191 | runArm7 expId L beta get armC2 0 nTh nMs |
| 1192 | ret true |
| 1193 | end |
| 1194 | |
| 1195 | fn allocBuf bytes ulong cached bool to long |
| 1196 | m = nvalloc bytes cached |
| 1197 | if le m 0 |
| 1198 | uPrint tC7Err |
| 1199 | uPrintU ulong get nvstage 0 |
| 1200 | uPrint tNl |
| 1201 | exit 6 |
| 1202 | end |
| 1203 | ret m |
| 1204 | end |
| 1205 | |
| 1206 | fn main to int |
| 1207 | uPrint tC7Hdr |
| 1208 | if not gbopen 1 |
| 1209 | uPrint tC7Err |
| 1210 | uPrintU ulong get nvstage 0 |
| 1211 | uPrint tNl |
| 1212 | ret 2 |
| 1213 | end |
| 1214 | if not gbbopen |
| 1215 | ret 3 |
| 1216 | end |
| 1217 | put uCodeMap 0 0 |
| 1218 | uEmitAllKernels |
| 1219 | csize = mul div add get uCodePos 0 4095 4096 4096 |
| 1220 | cm = nvalloc csize false |
| 1221 | if le cm 0 |
| 1222 | ret 4 |
| 1223 | end |
| 1224 | put uCodeMap 0 cm |
| 1225 | put uCodeFail 0 0 |
| 1226 | uEmitAllKernels |
| 1227 | if ne get uCodeFail 0 0 |
| 1228 | ret 5 |
| 1229 | end |
| 1230 | |
| 1231 | put dLinks 0 allocBuf 4194304 true |
| 1232 | put dStaples 0 allocBuf 4194304 true |
| 1233 | put dFlags 0 allocBuf 1048576 true |
| 1234 | put dNbSite 0 allocBuf 2097152 true |
| 1235 | put dRng 0 allocBuf 262144 true |
| 1236 | |
| 1237 | uPrint tC7Cols |
| 1238 | |
| 1239 | note Experiment 7B: Smooth k=0 IR Collars (C7_smooth_thooft & C8_smooth_hol) in Confining SU(2) |
| 1240 | put armSeed 0 0x7b7b0001 |
| 1241 | put armC1 0 7 |
| 1242 | put armC2 0 8 |
| 1243 | put armRMode 0 0 |
| 1244 | put armNSmear 0 1 |
| 1245 | if not runBox7 1 8 2.300f32 80 512 |
| 1246 | rc = nvmclose |
| 1247 | ret 15 |
| 1248 | end |
| 1249 | put armRMode 0 1 |
| 1250 | put armNSmear 0 2 |
| 1251 | if not runBox7 1 12 2.426f32 80 512 |
| 1252 | rc = nvmclose |
| 1253 | ret 16 |
| 1254 | end |
| 1255 | put armRMode 0 2 |
| 1256 | put armNSmear 0 4 |
| 1257 | if not runBox7 1 16 2.500f32 80 512 |
| 1258 | rc = nvmclose |
| 1259 | ret 17 |
| 1260 | end |
| 1261 | |
| 1262 | note Experiment 7C: Smooth k=0 IR Collars in Weak-Coupling Control (beta=6.00, xi >> L) |
| 1263 | put armSeed 0 0x7c7c0001 |
| 1264 | put armC1 0 7 |
| 1265 | put armC2 0 8 |
| 1266 | put armRMode 0 0 |
| 1267 | put armNSmear 0 1 |
| 1268 | if not runBox7 2 8 6.000f32 80 512 |
| 1269 | rc = nvmclose |
| 1270 | ret 18 |
| 1271 | end |
| 1272 | put armRMode 0 1 |
| 1273 | put armNSmear 0 2 |
| 1274 | if not runBox7 2 12 6.000f32 80 512 |
| 1275 | rc = nvmclose |
| 1276 | ret 19 |
| 1277 | end |
| 1278 | put armRMode 0 2 |
| 1279 | put armNSmear 0 4 |
| 1280 | if not runBox7 2 16 6.000f32 80 512 |
| 1281 | rc = nvmclose |
| 1282 | ret 20 |
| 1283 | end |
| 1284 | |
| 1285 | uPrint tC7Done |
| 1286 | rc = nvmclose |
| 1287 | ret 0 |
| 1288 | end |