yang
This project has not described itself yet.
Brought by drakestapleton
yang / src / ufbi_check5_gb10.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note src/ufbi_check5_gb10.om: Pure Seeded-OM-2 Zero-CUDA GB10 Runner for UFBI Check #5 |
| 3 | note (Referee-Proof Continuum Scaling & Contact-Free Exponential Decay Validation). |
| 4 | note |
| 5 | note Fixes all 3 lattice artifacts identified in Experiment 4B: |
| 6 | note 1. Runtime ZERO_CONTACT_ASSERT: before running MC, swaps frozen collar C0_cold vs |
| 7 | note C3_hot_haar on a fixed interior config and asserts |O(U_int,B1) - O(U_int,B0)| == 0 |
| 8 | note for EVERY (L, r_loop, n_s) geometry (mathematically ruling out collar contact). |
| 9 | note 2. Physical observable + smearing scaling: holds physical box l*sqrt(sigma), physical |
| 10 | note loop size r*a, and physical APE diffusion radius sqrt(n_s)*a FIXED simultaneously: |
| 11 | note Coarse: (L=8, beta=2.300, r=1 [1x1], n_s=1 APE) a*sqrt(sigma) ~ 0.369 -> l*sqrt(sigma) ~ 2.95 |
| 12 | note Fine: (L=16, beta=2.500, r=2 [2x2], n_s=4 APE) a*sqrt(sigma) ~ 0.186 -> l*sqrt(sigma) ~ 2.98 |
| 13 | note (Non-perturbative SU(2) string-tension matching: Hart & Teper / Teper.) |
| 14 | note 3. Dimensionless bulk-fluctuation normalization: reports BOTH jackknife Z = delta/SE |
| 15 | note AND R_bulk = delta / sigma_bulk (within-arm sweep std on C0_cold), which cancels |
| 16 | note additive UV shifts AND multiplicative a^4 operator renormalization identically. |
| 17 | note 4. Gapless/Weak-Coupling Negative Control (Experiment 5C, beta=6.00): runs the EXACT |
| 18 | note same physically scaled pair (L=8,r=1,n_s=1) -> (L=16,r=2,n_s=4) at beta=6.00 where |
| 19 | note correlation length xi >> L, verifying that R_bulk does NOT spuriously vanish from |
| 20 | note operator decoupling! |
| 21 | note 5. Contact-Free Exponential Decay (Experiment 5A, beta=2.30, L in {8,10,12,14,16}): |
| 22 | note drops contact-contaminated L=6, uses 160 sweeps with verified zero-contact footprint. |
| 23 | note |
| 24 | note Composed after: |
| 25 | note gpu/nvidia/native/nvrm/context.om |
| 26 | note gpu/nvidia/native/blackwell/vector.om |
| 27 | note gpu/nvidia/native/blackwell/launch.om |
| 28 | note gpu/nvidia/native/blackwell/batch.om |
| 29 | note om/encoder/bw_enc_sm121.om |
| 30 | note src/ufbi_math.om |
| 31 | note src/ufbi_check3_kernels.om |
| 32 | |
| 33 | global uCodePos ulong 1 |
| 34 | global uEntry ulong 8 |
| 35 | global uCodeMap long 1 |
| 36 | global uCodeFail uint 1 |
| 37 | global uBind uint 32 |
| 38 | global uBindN ulong 1 |
| 39 | global uDirty uint 1 |
| 40 | |
| 41 | global dLinks long 1 |
| 42 | global dStaples long 1 |
| 43 | global dFlags long 1 |
| 44 | global dNbSite long 1 |
| 45 | global dRng long 1 |
| 46 | |
| 47 | note Host link buffers (L<=16 -> 65536 sites x 16 f32 = 1048576 f32 each) |
| 48 | global hLinks f32 1048576 |
| 49 | global hSm1 f32 1048576 |
| 50 | global hSm2 f32 1048576 |
| 51 | global hNb uint 524288 |
| 52 | global hStage uchar 65536 |
| 53 | |
| 54 | note 5 observables x up to 160 sweeps = 800 f64 |
| 55 | global tsData f64 800 |
| 56 | global baseMean f64 5 |
| 57 | global baseErr f64 5 |
| 58 | global baseSig f64 5 |
| 59 | global curMean f64 5 |
| 60 | global curErr f64 5 |
| 61 | global curSig f64 5 |
| 62 | global curDelta f64 5 |
| 63 | global curZ f64 5 |
| 64 | global curRBulk f64 5 |
| 65 | global mcAcc f64 8 |
| 66 | global mcCnt ulong 2 |
| 67 | global zcRef f64 5 |
| 68 | global armBeta f32 1 |
| 69 | global armSeed ulong 1 |
| 70 | global armC1 ulong 1 |
| 71 | global armC2 ulong 1 |
| 72 | global armRLoop ulong 1 |
| 73 | global armNSmear ulong 1 |
| 74 | |
| 75 | text tC5Hdr "=== UFBI CHECK #5: REFEREE-PROOF CONTACT-FREE DECAY & PHYSICALLY-SCALED CONTINUUM TEST (PURE OM-2 GB10) ===\n" |
| 76 | text tC5Err "FAIL: GB10 native NVRM/kernel error stage=" |
| 77 | text tC5ZcFail "FAIL: ZERO_CONTACT_ASSERT violated! err=" |
| 78 | text tC5ZcOk "ZERO_CONTACT_ASSERT L=" |
| 79 | text tC5ZcR " r_loop=" |
| 80 | text tC5ZcN " n_smear=" |
| 81 | text tC5ZcE " max_direct_err=" |
| 82 | text tC5ZcP " status=PASS\n" |
| 83 | text tC5Cols "exp\tL\tbeta\tr_loop\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\tus\n" |
| 84 | text tTab "\t" |
| 85 | text tNl "\n" |
| 86 | text tE5A "decay_b230_clean" |
| 87 | text tE5B "phys_scaled_su2" |
| 88 | text tE5C "gapless_ctrl_b6" |
| 89 | text tK0 "C0_cold" |
| 90 | text tK3 "C3_hot_haar" |
| 91 | text tK5 "C5_nonab_twist" |
| 92 | text tK6 "C6_trick_vort" |
| 93 | text tC5Done "CHECK5_GB10_DONE status=PASS zero_contact_verified=1\n" |
| 94 | |
| 95 | fn uCodeWrite w view ulong 4 to void |
| 96 | p = get uCodePos 0 |
| 97 | b = new uchar 16 0 |
| 98 | if gt get uCodeMap 0 0 |
| 99 | for i ulong 16 |
| 100 | put b i uchar and shr get w div i 4 mul rem i 4 8 255 |
| 101 | end |
| 102 | if ne mapwrite get uCodeMap 0 p b 0 16 16 |
| 103 | put uCodeFail 0 1 |
| 104 | end |
| 105 | end |
| 106 | put uCodePos 0 add p 16 |
| 107 | end |
| 108 | |
| 109 | fn uEmitAllKernels to void |
| 110 | put uCodePos 0 0 |
| 111 | for id ulong 3 |
| 112 | p = mul div add get uCodePos 0 255 256 256 |
| 113 | put uEntry id p |
| 114 | put uCodePos 0 p |
| 115 | put uPc 0 0 |
| 116 | put uGuard 0 0 |
| 117 | ok = false |
| 118 | if eq id 0 |
| 119 | ok = uEmitSu2Staple |
| 120 | end |
| 121 | if eq id 1 |
| 122 | ok = uEmitSu2Overrelax |
| 123 | end |
| 124 | if eq id 2 |
| 125 | ok = uEmitSu2Heatbath |
| 126 | end |
| 127 | if not ok |
| 128 | exit 4 |
| 129 | end |
| 130 | uDone |
| 131 | end |
| 132 | end |
| 133 | |
| 134 | fn uArg u uint to void |
| 135 | i = get uBindN 0 |
| 136 | put uBind i u |
| 137 | put uBindN 0 add i 1 |
| 138 | end |
| 139 | |
| 140 | fn uPtr va ulong to void |
| 141 | uArg gblo va |
| 142 | uArg gbhi va |
| 143 | end |
| 144 | |
| 145 | fn uRecord id ulong gx uint bx uint to bool |
| 146 | gbqmd 1 |
| 147 | a = add mapaddr get uCodeMap 0 get uEntry id |
| 148 | put gbq1 32 gblo shr a 4 |
| 149 | put gbq1 33 or uint and shr a 36 2097151 20971520 |
| 150 | put gbq1 59 gblo shr a 8 |
| 151 | put gbq1 34 or uint 65536 bx |
| 152 | put gbq1 35 or uint 131073 shl uint 64 8 |
| 153 | put gbq1 36 78923784 |
| 154 | put gbq1 37 0 |
| 155 | put gbq1 39 gx |
| 156 | put gbq1 40 1 |
| 157 | put gbq1 41 1 |
| 158 | put gbcb 216 bx |
| 159 | put gbcb 220 gx |
| 160 | put gbcb 221 1 |
| 161 | put gbcb 222 1 |
| 162 | cb = mapaddr get gbmem 1 |
| 163 | words = get uBindN 0 |
| 164 | endva = add cb add 896 mul words 4 |
| 165 | put gbcb 212 gbhi endva |
| 166 | put gbcb 213 gblo endva |
| 167 | put gbused 0 0 |
| 168 | gbsetup |
| 169 | if ne get uDirty 0 0 |
| 170 | gbmth 0 40 4 |
| 171 | gbemit 0 |
| 172 | gbemit 0 |
| 173 | gbemit 0 |
| 174 | gbemit 2281701376 |
| 175 | put uDirty 0 0 |
| 176 | end |
| 177 | gbdma cb 224 |
| 178 | for j ulong 224 |
| 179 | gbemit get gbcb j |
| 180 | end |
| 181 | gbdma add cb 896 uint words |
| 182 | for j ulong words bound 32 |
| 183 | gbemit get uBind j |
| 184 | end |
| 185 | q = mapaddr get gbmem 2 |
| 186 | gbinline q false |
| 187 | gbdma add q 8192 1 |
| 188 | gbemit 1 |
| 189 | gbinline add q 4096 true |
| 190 | gbrel add mapaddr get gbmem 3 32 6 |
| 191 | put uBindN 0 0 |
| 192 | ret gbappend id get gbst 1 |
| 193 | end |
| 194 | |
| 195 | fn uRunKernel id ulong gx uint bx uint to bool |
| 196 | put uDirty 0 1 |
| 197 | if not gbbegin 1 |
| 198 | ret false |
| 199 | end |
| 200 | if not uRecord id gx bx |
| 201 | ret false |
| 202 | end |
| 203 | ret gbbsubmit 2000000000 |
| 204 | end |
| 205 | |
| 206 | fn stageU32 k ulong v uint to void |
| 207 | b = mul k 4 |
| 208 | put hStage b uchar and v 255 |
| 209 | put hStage add b 1 uchar and shr v 8 255 |
| 210 | put hStage add b 2 uchar and shr v 16 255 |
| 211 | put hStage add b 3 uchar and shr v 24 255 |
| 212 | end |
| 213 | |
| 214 | fn stageF32 k ulong v f32 to void |
| 215 | stageU32 k bitcast uint v |
| 216 | end |
| 217 | |
| 218 | fn flushStage m long offBytes ulong nWords ulong to bool |
| 219 | nb = mul nWords 4 |
| 220 | ret eq mapwrite m offBytes hStage 0 nb long nb |
| 221 | end |
| 222 | |
| 223 | fn uploadLinks N ulong to bool |
| 224 | totalF = mul N 16 |
| 225 | off = ulong 0 |
| 226 | while lt off totalF bound 128 |
| 227 | cnt = sub totalF off |
| 228 | if gt cnt 16384 |
| 229 | cnt = ulong 16384 |
| 230 | end |
| 231 | for k ulong cnt bound 16384 |
| 232 | stageF32 k get hLinks add off k |
| 233 | end |
| 234 | if not flushStage get dLinks 0 mul off 4 cnt |
| 235 | ret false |
| 236 | end |
| 237 | off = add off cnt |
| 238 | end |
| 239 | ret true |
| 240 | end |
| 241 | |
| 242 | fn downloadLinks N ulong to void |
| 243 | totalF = mul N 16 |
| 244 | lm = get dLinks 0 |
| 245 | for i ulong totalF bound 1048576 |
| 246 | put hLinks i bitcast f32 uint mapget lm mul i 4 4 |
| 247 | end |
| 248 | end |
| 249 | |
| 250 | fn coordIdx c0 ulong c1 ulong c2 ulong c3 ulong L ulong to ulong |
| 251 | r = add mul c0 L c1 |
| 252 | r = add mul r L c2 |
| 253 | ret add mul r L c3 |
| 254 | end |
| 255 | |
| 256 | fn buildNbTable L ulong to bool |
| 257 | N = mul mul L L mul L L |
| 258 | for s ulong N bound 65536 |
| 259 | c3 = rem s L |
| 260 | t = div s L |
| 261 | c2 = rem t L |
| 262 | t = div t L |
| 263 | c1 = rem t L |
| 264 | c0 = div t L |
| 265 | b = mul s 8 |
| 266 | put hNb b uint coordIdx rem add c0 1 L c1 c2 c3 L |
| 267 | put hNb add b 1 uint coordIdx rem add c0 sub L 1 L c1 c2 c3 L |
| 268 | put hNb add b 2 uint coordIdx c0 rem add c1 1 L c2 c3 L |
| 269 | put hNb add b 3 uint coordIdx c0 rem add c1 sub L 1 L c2 c3 L |
| 270 | put hNb add b 4 uint coordIdx c0 c1 rem add c2 1 L c3 L |
| 271 | put hNb add b 5 uint coordIdx c0 c1 rem add c2 sub L 1 L c3 L |
| 272 | put hNb add b 6 uint coordIdx c0 c1 c2 rem add c3 1 L L |
| 273 | put hNb add b 7 uint coordIdx c0 c1 c2 rem add c3 sub L 1 L L |
| 274 | end |
| 275 | totalW = mul N 8 |
| 276 | off = ulong 0 |
| 277 | while lt off totalW bound 64 |
| 278 | cnt = sub totalW off |
| 279 | if gt cnt 16384 |
| 280 | cnt = ulong 16384 |
| 281 | end |
| 282 | for k ulong cnt bound 16384 |
| 283 | stageU32 k get hNb add off k |
| 284 | end |
| 285 | if not flushStage get dNbSite 0 mul off 4 cnt |
| 286 | ret false |
| 287 | end |
| 288 | off = add off cnt |
| 289 | end |
| 290 | ret true |
| 291 | end |
| 292 | |
| 293 | fn isBdryL s ulong L ulong to bool |
| 294 | c3 = rem s L |
| 295 | t = div s L |
| 296 | c2 = rem t L |
| 297 | t = div t L |
| 298 | c1 = rem t L |
| 299 | c0 = div t L |
| 300 | lm1 = sub L 1 |
| 301 | if or eq c0 0 eq c0 lm1 |
| 302 | ret true |
| 303 | end |
| 304 | if or eq c1 0 eq c1 lm1 |
| 305 | ret true |
| 306 | end |
| 307 | if or eq c2 0 eq c2 lm1 |
| 308 | ret true |
| 309 | end |
| 310 | if or eq c3 0 eq c3 lm1 |
| 311 | ret true |
| 312 | end |
| 313 | ret false |
| 314 | end |
| 315 | |
| 316 | fn isBox4 s ulong L ulong lo ulong hi ulong to bool |
| 317 | c3 = rem s L |
| 318 | t = div s L |
| 319 | c2 = rem t L |
| 320 | t = div t L |
| 321 | c1 = rem t L |
| 322 | c0 = div t L |
| 323 | if or lt c0 lo ge c0 hi |
| 324 | ret false |
| 325 | end |
| 326 | if or lt c1 lo ge c1 hi |
| 327 | ret false |
| 328 | end |
| 329 | if or lt c2 lo ge c2 hi |
| 330 | ret false |
| 331 | end |
| 332 | if or lt c3 lo ge c3 hi |
| 333 | ret false |
| 334 | end |
| 335 | ret true |
| 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 | fn setCollarLink s ulong mu ulong L ulong cid ulong to void |
| 415 | base = mul add mul s 4 mu 4 |
| 416 | put hLinks base 1.0f32 |
| 417 | put hLinks add base 1 0.0f32 |
| 418 | put hLinks add base 2 0.0f32 |
| 419 | put hLinks add base 3 0.0f32 |
| 420 | if eq cid 0 |
| 421 | ret |
| 422 | end |
| 423 | if eq cid 3 |
| 424 | put hLinks base f32 uRngNorm64 |
| 425 | put hLinks add base 1 f32 uRngNorm64 |
| 426 | put hLinks add base 2 f32 uRngNorm64 |
| 427 | put hLinks add base 3 f32 uRngNorm64 |
| 428 | qNormHost base |
| 429 | ret |
| 430 | end |
| 431 | c3 = rem s L |
| 432 | c2 = rem div s L L |
| 433 | c1 = rem div s mul L L L |
| 434 | c0 = div s mul mul L L L |
| 435 | if eq cid 5 |
| 436 | if eq mu 0 |
| 437 | put hLinks base 0.0f32 |
| 438 | put hLinks add base 1 1.0f32 |
| 439 | end |
| 440 | if eq mu 1 |
| 441 | put hLinks base 0.0f32 |
| 442 | put hLinks add base 2 1.0f32 |
| 443 | end |
| 444 | if eq mu 2 |
| 445 | put hLinks base 0.0f32 |
| 446 | put hLinks add base 3 1.0f32 |
| 447 | end |
| 448 | if eq mu 3 |
| 449 | put hLinks base 0.5f32 |
| 450 | put hLinks add base 1 0.5f32 |
| 451 | put hLinks add base 2 0.5f32 |
| 452 | put hLinks add base 3 0.5f32 |
| 453 | end |
| 454 | ret |
| 455 | end |
| 456 | if eq cid 6 |
| 457 | if eq and add c0 c1 1 1 |
| 458 | put hLinks base neg 0.5f32 |
| 459 | put hLinks add base 1 0.5f32 |
| 460 | put hLinks add base 2 neg 0.5f32 |
| 461 | put hLinks add base 3 0.5f32 |
| 462 | else |
| 463 | put hLinks base 0.0f32 |
| 464 | put hLinks add base 1 neg 0.70710678f32 |
| 465 | put hLinks add base 2 0.70710678f32 |
| 466 | put hLinks add base 3 0.0f32 |
| 467 | end |
| 468 | end |
| 469 | end |
| 470 | |
| 471 | fn initLatticeHost L ulong cid ulong freezeCollar bool seed ulong to void |
| 472 | N = mul mul L L mul L L |
| 473 | uRngSeed seed |
| 474 | for s ulong N bound 65536 |
| 475 | isB = and freezeCollar isBdryL s L |
| 476 | for mu ulong 4 |
| 477 | if isB |
| 478 | setCollarLink s mu L cid |
| 479 | else |
| 480 | base = mul add mul s 4 mu 4 |
| 481 | put hLinks base 0.85f32 |
| 482 | put hLinks add base 1 mul 0.25f32 f32 uRngNorm64 |
| 483 | put hLinks add base 2 mul 0.25f32 f32 uRngNorm64 |
| 484 | put hLinks add base 3 mul 0.25f32 f32 uRngNorm64 |
| 485 | qNormHost base |
| 486 | end |
| 487 | end |
| 488 | end |
| 489 | end |
| 490 | |
| 491 | fn initLattice L ulong cid ulong freezeCollar bool seed ulong to bool |
| 492 | N = mul mul L L mul L L |
| 493 | initLatticeHost L cid freezeCollar seed |
| 494 | ret uploadLinks N |
| 495 | end |
| 496 | |
| 497 | fn gpuRunStaple N ulong mu ulong par ulong to bool |
| 498 | gx = uint div add N 255 256 |
| 499 | nu0 = ulong 0 |
| 500 | nu1 = ulong 1 |
| 501 | nu2 = ulong 2 |
| 502 | if eq mu 0 |
| 503 | nu0 = ulong 1 |
| 504 | nu1 = ulong 2 |
| 505 | nu2 = ulong 3 |
| 506 | end |
| 507 | if eq mu 1 |
| 508 | nu0 = ulong 0 |
| 509 | nu1 = ulong 2 |
| 510 | nu2 = ulong 3 |
| 511 | end |
| 512 | if eq mu 2 |
| 513 | nu0 = ulong 0 |
| 514 | nu1 = ulong 1 |
| 515 | nu2 = ulong 3 |
| 516 | end |
| 517 | uPtr mapaddr get dLinks 0 |
| 518 | uPtr mapaddr get dStaples 0 |
| 519 | uPtr mapaddr get dFlags 0 |
| 520 | uPtr mapaddr get dNbSite 0 |
| 521 | uArg uint N |
| 522 | uArg uint mu |
| 523 | uArg uint par |
| 524 | uArg uint nu0 |
| 525 | uArg uint nu1 |
| 526 | uArg uint nu2 |
| 527 | ret uRunKernel 0 gx 256 |
| 528 | end |
| 529 | |
| 530 | fn gpuRunOverrelax N ulong mu ulong par ulong to bool |
| 531 | gx = uint div add N 255 256 |
| 532 | uPtr mapaddr get dLinks 0 |
| 533 | uPtr mapaddr get dStaples 0 |
| 534 | uPtr mapaddr get dFlags 0 |
| 535 | uArg uint N |
| 536 | uArg uint mu |
| 537 | uArg uint par |
| 538 | ret uRunKernel 1 gx 256 |
| 539 | end |
| 540 | |
| 541 | fn gpuRunHeatbath N ulong mu ulong par ulong beta f32 to bool |
| 542 | gx = uint div add N 255 256 |
| 543 | uPtr mapaddr get dLinks 0 |
| 544 | uPtr mapaddr get dStaples 0 |
| 545 | uPtr mapaddr get dFlags 0 |
| 546 | uPtr mapaddr get dRng 0 |
| 547 | uArg uint N |
| 548 | uArg uint mu |
| 549 | uArg uint par |
| 550 | uArg bitcast uint beta |
| 551 | ret uRunKernel 2 gx 256 |
| 552 | end |
| 553 | |
| 554 | fn gpuSweep N ulong beta f32 nOr ulong to bool |
| 555 | for mu ulong 4 |
| 556 | for par ulong 2 |
| 557 | if not gpuRunStaple N mu par |
| 558 | ret false |
| 559 | end |
| 560 | if not gpuRunHeatbath N mu par beta |
| 561 | ret false |
| 562 | end |
| 563 | for r ulong nOr bound 8 |
| 564 | if not gpuRunStaple N mu par |
| 565 | ret false |
| 566 | end |
| 567 | if not gpuRunOverrelax N mu par |
| 568 | ret false |
| 569 | end |
| 570 | end |
| 571 | end |
| 572 | end |
| 573 | ret true |
| 574 | end |
| 575 | |
| 576 | note ========================================================================= |
| 577 | note Host Quaternion Helpers + Arbitrary-Step Exact-Box APE Smearing |
| 578 | note ========================================================================= |
| 579 | fn hQMul a view f32 4 b view f32 4 o edit f32 4 to void |
| 580 | v = mul get a 0 get b 0 |
| 581 | v = sub v mul get a 1 get b 1 |
| 582 | v = sub v mul get a 2 get b 2 |
| 583 | v = sub v mul get a 3 get b 3 |
| 584 | put o 0 v |
| 585 | v = mul get a 0 get b 1 |
| 586 | v = add v mul get a 1 get b 0 |
| 587 | v = add v mul get a 2 get b 3 |
| 588 | v = sub v mul get a 3 get b 2 |
| 589 | put o 1 v |
| 590 | v = mul get a 0 get b 2 |
| 591 | v = sub v mul get a 1 get b 3 |
| 592 | v = add v mul get a 2 get b 0 |
| 593 | v = add v mul get a 3 get b 1 |
| 594 | put o 2 v |
| 595 | v = mul get a 0 get b 3 |
| 596 | v = add v mul get a 1 get b 2 |
| 597 | v = sub v mul get a 2 get b 1 |
| 598 | v = add v mul get a 3 get b 0 |
| 599 | put o 3 v |
| 600 | end |
| 601 | |
| 602 | fn hQConj q edit f32 4 to void |
| 603 | put q 1 neg get q 1 |
| 604 | put q 2 neg get q 2 |
| 605 | put q 3 neg get q 3 |
| 606 | end |
| 607 | |
| 608 | fn hQNorm q edit f32 4 to void |
| 609 | n2 = mul get q 0 get q 0 |
| 610 | n2 = add n2 mul get q 1 get q 1 |
| 611 | n2 = add n2 mul get q 2 get q 2 |
| 612 | n2 = add n2 mul get q 3 get q 3 |
| 613 | if le n2 0.0000000001f32 |
| 614 | put q 0 1.0f32 |
| 615 | put q 1 0.0f32 |
| 616 | put q 2 0.0f32 |
| 617 | put q 3 0.0f32 |
| 618 | ret |
| 619 | end |
| 620 | inv = f32 div 1.0f64 uSqrt64 f64 n2 |
| 621 | for c ulong 4 |
| 622 | put q c mul get q c inv |
| 623 | end |
| 624 | end |
| 625 | |
| 626 | fn hLoadS slot ulong s ulong mu ulong dst edit f32 4 to void |
| 627 | b = mul add mul s 4 mu 4 |
| 628 | if eq slot 0 |
| 629 | put dst 0 get hLinks b |
| 630 | put dst 1 get hLinks add b 1 |
| 631 | put dst 2 get hLinks add b 2 |
| 632 | put dst 3 get hLinks add b 3 |
| 633 | ret |
| 634 | end |
| 635 | if eq slot 1 |
| 636 | put dst 0 get hSm1 b |
| 637 | put dst 1 get hSm1 add b 1 |
| 638 | put dst 2 get hSm1 add b 2 |
| 639 | put dst 3 get hSm1 add b 3 |
| 640 | ret |
| 641 | end |
| 642 | put dst 0 get hSm2 b |
| 643 | put dst 1 get hSm2 add b 1 |
| 644 | put dst 2 get hSm2 add b 2 |
| 645 | put dst 3 get hSm2 add b 3 |
| 646 | end |
| 647 | |
| 648 | fn hStoreS slot ulong s ulong mu ulong src view f32 4 to void |
| 649 | b = mul add mul s 4 mu 4 |
| 650 | if eq slot 1 |
| 651 | put hSm1 b get src 0 |
| 652 | put hSm1 add b 1 get src 1 |
| 653 | put hSm1 add b 2 get src 2 |
| 654 | put hSm1 add b 3 get src 3 |
| 655 | ret |
| 656 | end |
| 657 | put hSm2 b get src 0 |
| 658 | put hSm2 add b 1 get src 1 |
| 659 | put hSm2 add b 2 get src 2 |
| 660 | put hSm2 add b 3 get src 3 |
| 661 | end |
| 662 | |
| 663 | fn getNb s ulong dir ulong isMinus ulong to ulong |
| 664 | ret ulong get hNb add mul s 8 add mul dir 2 isMinus |
| 665 | end |
| 666 | |
| 667 | fn hStapleAdd slot ulong s ulong mu ulong nu ulong isBack bool dst edit f32 4 to void |
| 668 | t1 = new f32 4 0.0f32 |
| 669 | t2 = new f32 4 0.0f32 |
| 670 | t3 = new f32 4 0.0f32 |
| 671 | p1 = new f32 4 0.0f32 |
| 672 | p2 = new f32 4 0.0f32 |
| 673 | xp = getNb s mu 0 |
| 674 | if not isBack |
| 675 | hLoadS slot s nu t1 |
| 676 | hLoadS slot getNb s nu 0 mu t2 |
| 677 | hLoadS slot xp nu t3 |
| 678 | hQConj t3 |
| 679 | else |
| 680 | xm = getNb s nu 1 |
| 681 | hLoadS slot xm nu t1 |
| 682 | hQConj t1 |
| 683 | hLoadS slot xm mu t2 |
| 684 | hLoadS slot getNb xp nu 1 nu t3 |
| 685 | end |
| 686 | hQMul t1 t2 p1 |
| 687 | hQMul p1 t3 p2 |
| 688 | for c ulong 4 |
| 689 | put dst c add get dst c get p2 c |
| 690 | end |
| 691 | end |
| 692 | |
| 693 | fn hApeLink srcSlot ulong dstSlot ulong s ulong mu ulong to void |
| 694 | st = new f32 4 0.0f32 |
| 695 | u = new f32 4 0.0f32 |
| 696 | w1 = div 0.5f32 6.0f32 |
| 697 | for nu ulong 4 |
| 698 | if ne nu mu |
| 699 | hStapleAdd srcSlot s mu nu false st |
| 700 | hStapleAdd srcSlot s mu nu true st |
| 701 | end |
| 702 | end |
| 703 | hLoadS srcSlot s mu u |
| 704 | for c ulong 4 |
| 705 | put u c add mul 0.5f32 get u c mul w1 get st c |
| 706 | end |
| 707 | hQNorm u |
| 708 | hStoreS dstSlot s mu u |
| 709 | end |
| 710 | |
| 711 | fn hApeBox L ulong srcSlot ulong dstSlot ulong lo ulong hi ulong to void |
| 712 | N = mul mul L L mul L L |
| 713 | for s ulong N bound 65536 |
| 714 | if isBox4 s L lo hi |
| 715 | for mu ulong 4 |
| 716 | hApeLink srcSlot dstSlot s mu |
| 717 | end |
| 718 | end |
| 719 | end |
| 720 | end |
| 721 | |
| 722 | note Multi-step ping-pong APE smearing on exact needed halo around [needLo, needHi): |
| 723 | note Returns final slot (0 if nSmear=0, 1 if odd, 2 if even). |
| 724 | fn runApeChain L ulong nSmear ulong needLo ulong needHi ulong to ulong |
| 725 | if eq nSmear 0 |
| 726 | ret ulong 0 |
| 727 | end |
| 728 | src = ulong 0 |
| 729 | dst = ulong 1 |
| 730 | for step ulong nSmear bound 8 |
| 731 | remSteps = sub sub nSmear 1 step |
| 732 | lo = sub needLo remSteps |
| 733 | hi = add needHi remSteps |
| 734 | hApeBox L src dst lo hi |
| 735 | src = dst |
| 736 | if eq dst 1 |
| 737 | dst = ulong 2 |
| 738 | else |
| 739 | dst = ulong 1 |
| 740 | end |
| 741 | end |
| 742 | ret src |
| 743 | end |
| 744 | |
| 745 | fn hPlaqS slot ulong s ulong mu ulong nu ulong to f64 |
| 746 | a = new f32 4 0.0f32 |
| 747 | b = new f32 4 0.0f32 |
| 748 | p = new f32 4 0.0f32 |
| 749 | q = new f32 4 0.0f32 |
| 750 | hLoadS slot s mu a |
| 751 | hLoadS slot getNb s mu 0 nu b |
| 752 | hQMul a b p |
| 753 | hLoadS slot getNb s nu 0 mu a |
| 754 | hQConj a |
| 755 | hQMul p a q |
| 756 | hLoadS slot s nu b |
| 757 | hQConj b |
| 758 | hQMul q b p |
| 759 | ret f64 get p 0 |
| 760 | end |
| 761 | |
| 762 | fn hRect1x2S slot ulong s ulong mu ulong nu ulong to f64 |
| 763 | a = new f32 4 0.0f32 |
| 764 | b = new f32 4 0.0f32 |
| 765 | p = new f32 4 0.0f32 |
| 766 | q = new f32 4 0.0f32 |
| 767 | s1 = getNb s mu 0 |
| 768 | s2 = getNb s1 mu 0 |
| 769 | hLoadS slot s mu a |
| 770 | hLoadS slot s1 mu b |
| 771 | hQMul a b p |
| 772 | hLoadS slot s2 nu a |
| 773 | hQMul p a q |
| 774 | hLoadS slot getNb s1 nu 0 mu a |
| 775 | hQConj a |
| 776 | hQMul q a p |
| 777 | hLoadS slot getNb s nu 0 mu a |
| 778 | hQConj a |
| 779 | hQMul p a q |
| 780 | hLoadS slot s nu b |
| 781 | hQConj b |
| 782 | hQMul q b p |
| 783 | ret f64 get p 0 |
| 784 | end |
| 785 | |
| 786 | fn hRect2x2S slot ulong s ulong mu ulong nu ulong to f64 |
| 787 | a = new f32 4 0.0f32 |
| 788 | p = new f32 4 0.0f32 |
| 789 | q = new f32 4 0.0f32 |
| 790 | cur = s |
| 791 | hLoadS slot cur mu p |
| 792 | cur = getNb cur mu 0 |
| 793 | hLoadS slot cur mu a |
| 794 | hQMul p a q |
| 795 | cur = getNb cur mu 0 |
| 796 | hLoadS slot cur nu a |
| 797 | hQMul q a p |
| 798 | cur = getNb cur nu 0 |
| 799 | hLoadS slot cur nu a |
| 800 | hQMul p a q |
| 801 | cur = getNb cur nu 0 |
| 802 | cur = getNb cur mu 1 |
| 803 | hLoadS slot cur mu a |
| 804 | hQConj a |
| 805 | hQMul q a p |
| 806 | cur = getNb cur mu 1 |
| 807 | hLoadS slot cur mu a |
| 808 | hQConj a |
| 809 | hQMul p a q |
| 810 | cur = getNb cur nu 1 |
| 811 | hLoadS slot cur nu a |
| 812 | hQConj a |
| 813 | hQMul q a p |
| 814 | cur = getNb cur nu 1 |
| 815 | hLoadS slot cur nu a |
| 816 | hQConj a |
| 817 | hQMul p a q |
| 818 | ret f64 get q 0 |
| 819 | end |
| 820 | |
| 821 | note ========================================================================= |
| 822 | note Measurement Engine for Check #5 (operates directly on host hLinks buffer) |
| 823 | note expId == 0 (5A decay_b230_clean, L in {8,10,12,14,16}, n_s=1): |
| 824 | note O0: P1x1_S0 (bare 1x1 on 2^4 core [L/2-1, L/2+1)) |
| 825 | note O1: P1x1_S1 (1-step APE 1x1 on 2^4 core [L/2-1, L/2+1)) |
| 826 | note O2: AdjP_S1 (1-step APE adjoint 4*P1^2 - 1 on 2^4 core) |
| 827 | note O3: W2x2_S1_ctr (1-step APE 2x2 on strictly centered single site L/2-1) |
| 828 | note O4: Cr22_S1_ctr (1-step APE Creutz (P1*W2x2)/W1x2^2 on single center site) |
| 829 | note expId >= 1 (5B phys_scaled_su2 & 5C gapless_ctrl_b6): |
| 830 | note L=8: r_loop=1 (1x1), n_s=1, core [3,5), links in [3,6) -> S0 support [2,6] |
| 831 | note L=16: r_loop=2 (2x2), n_s=4, core [6,8), links in [6,10) -> S0 support [2,13] |
| 832 | note O0: W_phys (smeared r x r loop) |
| 833 | note O1: Adj_phys (smeared adjoint 4*W_phys^2 - 1) |
| 834 | note O2: Sq_phys (smeared W_phys^2, strictly positive) |
| 835 | note O3: W_bare_phys (unsmeared r x r loop on same physical core) |
| 836 | note O4: OneMinusW (physical action density 1 - W_phys) |
| 837 | note ========================================================================= |
| 838 | fn accum5ASite s ulong sl ulong isCtr bool to void |
| 839 | for mu ulong 4 |
| 840 | for nu ulong 4 |
| 841 | if lt mu nu |
| 842 | vp0 = hPlaqS 0 s mu nu |
| 843 | vp1 = hPlaqS sl s mu nu |
| 844 | put mcAcc 0 add get mcAcc 0 vp0 |
| 845 | put mcAcc 1 add get mcAcc 1 vp1 |
| 846 | put mcAcc 2 add get mcAcc 2 sub mul 4.0f64 mul vp1 vp1 1.0f64 |
| 847 | put mcCnt 0 add get mcCnt 0 1 |
| 848 | if isCtr |
| 849 | put mcAcc 3 add get mcAcc 3 vp1 |
| 850 | put mcAcc 4 add get mcAcc 4 hRect1x2S sl s mu nu |
| 851 | put mcAcc 5 add get mcAcc 5 hRect2x2S sl s mu nu |
| 852 | put mcCnt 1 add get mcCnt 1 1 |
| 853 | end |
| 854 | end |
| 855 | end |
| 856 | end |
| 857 | end |
| 858 | |
| 859 | fn evalHost5A L ulong res edit f64 5 to void |
| 860 | lo = sub div L 2 1 |
| 861 | hi = add lo 2 |
| 862 | sl = runApeChain L 1 lo add lo 3 |
| 863 | for o ulong 8 |
| 864 | put mcAcc o 0.0f64 |
| 865 | end |
| 866 | put mcCnt 0 0 |
| 867 | put mcCnt 1 0 |
| 868 | N = mul mul L L mul L L |
| 869 | ctrSite = coordIdx lo lo lo lo L |
| 870 | for s ulong N bound 65536 |
| 871 | if isBox4 s L lo hi |
| 872 | accum5ASite s sl eq s ctrSite |
| 873 | end |
| 874 | end |
| 875 | c0 = f64 get mcCnt 0 |
| 876 | c1 = f64 get mcCnt 1 |
| 877 | put res 0 div get mcAcc 0 c0 |
| 878 | put res 1 div get mcAcc 1 c0 |
| 879 | put res 2 div get mcAcc 2 c0 |
| 880 | pCtr = div get mcAcc 3 c1 |
| 881 | w12Ctr = div get mcAcc 4 c1 |
| 882 | w22Ctr = div get mcAcc 5 c1 |
| 883 | put res 3 w22Ctr |
| 884 | den = mul w12Ctr w12Ctr |
| 885 | cr = f64 0.0f64 |
| 886 | if gt den 0.05f64 |
| 887 | cr = div mul pCtr w22Ctr den |
| 888 | end |
| 889 | put res 4 cr |
| 890 | end |
| 891 | |
| 892 | fn accumScaledSite s ulong sl ulong rLoop ulong to void |
| 893 | for mu ulong 4 |
| 894 | for nu ulong 4 |
| 895 | if lt mu nu |
| 896 | vs = f64 0.0f64 |
| 897 | vb = f64 0.0f64 |
| 898 | if eq rLoop 1 |
| 899 | vs = hPlaqS sl s mu nu |
| 900 | vb = hPlaqS 0 s mu nu |
| 901 | else |
| 902 | vs = hRect2x2S sl s mu nu |
| 903 | vb = hRect2x2S 0 s mu nu |
| 904 | end |
| 905 | put mcAcc 0 add get mcAcc 0 vs |
| 906 | put mcAcc 1 add get mcAcc 1 sub mul 4.0f64 mul vs vs 1.0f64 |
| 907 | put mcAcc 2 add get mcAcc 2 mul vs vs |
| 908 | put mcAcc 3 add get mcAcc 3 vb |
| 909 | put mcAcc 4 add get mcAcc 4 sub 1.0f64 vs |
| 910 | put mcCnt 0 add get mcCnt 0 1 |
| 911 | end |
| 912 | end |
| 913 | end |
| 914 | end |
| 915 | |
| 916 | fn evalHostScaled L ulong rLoop ulong nSmear ulong res edit f64 5 to void |
| 917 | lo = ulong 3 |
| 918 | hi = ulong 5 |
| 919 | needHi = ulong 6 |
| 920 | if eq L 16 |
| 921 | lo = ulong 6 |
| 922 | hi = ulong 8 |
| 923 | needHi = ulong 10 |
| 924 | end |
| 925 | sl = runApeChain L nSmear lo needHi |
| 926 | for o ulong 5 |
| 927 | put mcAcc o 0.0f64 |
| 928 | end |
| 929 | put mcCnt 0 0 |
| 930 | N = mul mul L L mul L L |
| 931 | for s ulong N bound 65536 |
| 932 | if isBox4 s L lo hi |
| 933 | accumScaledSite s sl rLoop |
| 934 | end |
| 935 | end |
| 936 | fc = f64 get mcCnt 0 |
| 937 | for o ulong 5 |
| 938 | put res o div get mcAcc o fc |
| 939 | end |
| 940 | end |
| 941 | |
| 942 | note Runtime ZERO_CONTACT_ASSERT: |
| 943 | note Fixes interior links from seed, sets frozen boundary to C0_cold -> measures ref, |
| 944 | note then overwrites ONLY frozen boundary (isBdryL) to C3_hot_haar -> measures again. |
| 945 | note Asserts max_o |O_hot - O_cold| <= 1e-12 (exact zero direct collar contact!). |
| 946 | fn assertZeroContact expId ulong L ulong rLoop ulong nSmear ulong to void |
| 947 | N = mul mul L L mul L L |
| 948 | initLatticeHost L 0 true 0x77771234 |
| 949 | v0 = new f64 5 0.0f64 |
| 950 | v1 = new f64 5 0.0f64 |
| 951 | if eq expId 0 |
| 952 | evalHost5A L v0 |
| 953 | else |
| 954 | evalHostScaled L rLoop nSmear v0 |
| 955 | end |
| 956 | uRngSeed 0x99995678 |
| 957 | for s ulong N bound 65536 |
| 958 | if isBdryL s L |
| 959 | for mu ulong 4 |
| 960 | setCollarLink s mu L 3 |
| 961 | end |
| 962 | end |
| 963 | end |
| 964 | if eq expId 0 |
| 965 | evalHost5A L v1 |
| 966 | else |
| 967 | evalHostScaled L rLoop nSmear v1 |
| 968 | end |
| 969 | maxE = f64 0.0f64 |
| 970 | for o ulong 5 |
| 971 | e = uAbs64 sub get v1 o get v0 o |
| 972 | if gt e maxE |
| 973 | maxE = e |
| 974 | end |
| 975 | end |
| 976 | if gt maxE 0.000000000001f64 |
| 977 | uPrint tC5ZcFail |
| 978 | uPrintF64 maxE |
| 979 | uPrint tNl |
| 980 | exit 99 |
| 981 | end |
| 982 | uPrint tC5ZcOk |
| 983 | uPrintU L |
| 984 | uPrint tC5ZcR |
| 985 | uPrintU rLoop |
| 986 | uPrint tC5ZcN |
| 987 | uPrintU nSmear |
| 988 | uPrint tC5ZcE |
| 989 | uPrintF64 maxE |
| 990 | uPrint tC5ZcP |
| 991 | end |
| 992 | |
| 993 | fn storeMeas5 expId ulong L ulong rLoop ulong nSmear ulong k ulong to void |
| 994 | N = mul mul L L mul L L |
| 995 | downloadLinks N |
| 996 | v = new f64 5 0.0f64 |
| 997 | if eq expId 0 |
| 998 | evalHost5A L v |
| 999 | else |
| 1000 | evalHostScaled L rLoop nSmear v |
| 1001 | end |
| 1002 | b = mul k 5 |
| 1003 | for o ulong 5 |
| 1004 | put tsData add b o get v o |
| 1005 | end |
| 1006 | end |
| 1007 | |
| 1008 | fn sumBlk5 o ulong st ulong blkSz ulong to f64 |
| 1009 | s = f64 0.0f64 |
| 1010 | for j ulong blkSz bound 32 |
| 1011 | s = add s get tsData add mul add st j 5 o |
| 1012 | end |
| 1013 | ret s |
| 1014 | end |
| 1015 | |
| 1016 | fn summarizeOne5 o ulong nMeas ulong to void |
| 1017 | blkSz = div nMeas 8 |
| 1018 | tot = f64 0.0f64 |
| 1019 | for k ulong nMeas bound 160 |
| 1020 | tot = add tot get tsData add mul k 5 o |
| 1021 | end |
| 1022 | mean = div tot f64 nMeas |
| 1023 | put curMean o mean |
| 1024 | vSum = f64 0.0f64 |
| 1025 | for k ulong nMeas bound 160 |
| 1026 | dv = sub get tsData add mul k 5 o mean |
| 1027 | vSum = add vSum mul dv dv |
| 1028 | end |
| 1029 | put curSig o uSqrt64 div vSum f64 sub nMeas 1 |
| 1030 | jkSum = f64 0.0f64 |
| 1031 | for b ulong 8 |
| 1032 | bs = sumBlk5 o mul b blkSz blkSz |
| 1033 | d = sub div sub tot bs f64 sub nMeas blkSz mean |
| 1034 | jkSum = add jkSum mul d d |
| 1035 | end |
| 1036 | put curErr o uSqrt64 mul 0.875f64 jkSum |
| 1037 | end |
| 1038 | |
| 1039 | fn summarizeTs5 nMeas ulong to void |
| 1040 | for o ulong 5 |
| 1041 | summarizeOne5 o nMeas |
| 1042 | end |
| 1043 | end |
| 1044 | |
| 1045 | fn computeDiffZR cid ulong to void |
| 1046 | if eq cid 0 |
| 1047 | for o ulong 5 |
| 1048 | put baseMean o get curMean o |
| 1049 | put baseErr o get curErr o |
| 1050 | put baseSig o get curSig o |
| 1051 | put curDelta o 0.0f64 |
| 1052 | put curZ o 0.0f64 |
| 1053 | put curRBulk o 0.0f64 |
| 1054 | end |
| 1055 | ret |
| 1056 | end |
| 1057 | for o ulong 5 |
| 1058 | diff = uAbs64 sub get curMean o get baseMean o |
| 1059 | se = uSqrt64 add mul get curErr o get curErr o mul get baseErr o get baseErr o |
| 1060 | z = f64 0.0f64 |
| 1061 | if gt se 0.0000001f64 |
| 1062 | z = div diff se |
| 1063 | end |
| 1064 | rBulk = f64 0.0f64 |
| 1065 | sb = get baseSig o |
| 1066 | if gt sb 0.0000001f64 |
| 1067 | rBulk = div diff sb |
| 1068 | end |
| 1069 | put curDelta o diff |
| 1070 | put curZ o z |
| 1071 | put curRBulk o rBulk |
| 1072 | end |
| 1073 | end |
| 1074 | |
| 1075 | fn printRow5 expId ulong L ulong cid ulong nMeas ulong us ulong to void |
| 1076 | if eq expId 0 |
| 1077 | uPrint tE5A |
| 1078 | end |
| 1079 | if eq expId 1 |
| 1080 | uPrint tE5B |
| 1081 | end |
| 1082 | if eq expId 2 |
| 1083 | uPrint tE5C |
| 1084 | end |
| 1085 | uPrint tTab |
| 1086 | uPrintU L |
| 1087 | uPrint tTab |
| 1088 | uPrintF64 f64 get armBeta 0 |
| 1089 | uPrint tTab |
| 1090 | uPrintU get armRLoop 0 |
| 1091 | uPrint tTab |
| 1092 | uPrintU get armNSmear 0 |
| 1093 | uPrint tTab |
| 1094 | if eq cid 0 |
| 1095 | uPrint tK0 |
| 1096 | end |
| 1097 | if eq cid 3 |
| 1098 | uPrint tK3 |
| 1099 | end |
| 1100 | if eq cid 5 |
| 1101 | uPrint tK5 |
| 1102 | end |
| 1103 | if eq cid 6 |
| 1104 | uPrint tK6 |
| 1105 | end |
| 1106 | uPrint tTab |
| 1107 | uPrintU nMeas |
| 1108 | for o ulong 5 |
| 1109 | uPrint tTab |
| 1110 | uPrintF64 get curDelta o |
| 1111 | uPrint tTab |
| 1112 | uPrintF64 get curZ o |
| 1113 | uPrint tTab |
| 1114 | uPrintF64 get curRBulk o |
| 1115 | end |
| 1116 | uPrint tTab |
| 1117 | uPrintF64 get curMean 0 |
| 1118 | uPrint tTab |
| 1119 | uPrintF64 get curSig 0 |
| 1120 | uPrint tTab |
| 1121 | uPrintU us |
| 1122 | uPrint tNl |
| 1123 | end |
| 1124 | |
| 1125 | fn runArm5 expId ulong L ulong beta f32 cid ulong nTherm ulong nMeas ulong to void |
| 1126 | t0 = monons |
| 1127 | put armBeta 0 beta |
| 1128 | seed = get armSeed 0 |
| 1129 | N = mul mul L L mul L L |
| 1130 | if not seedGpuRng N add seed mul cid 7919 |
| 1131 | exit 31 |
| 1132 | end |
| 1133 | if not initLattice L cid true add seed mul cid 104729 |
| 1134 | exit 32 |
| 1135 | end |
| 1136 | for sw ulong nTherm bound 128 |
| 1137 | if not gpuSweep N beta 3 |
| 1138 | exit 33 |
| 1139 | end |
| 1140 | end |
| 1141 | rl = get armRLoop 0 |
| 1142 | ns = get armNSmear 0 |
| 1143 | for k ulong nMeas bound 160 |
| 1144 | if not gpuSweep N beta 2 |
| 1145 | exit 34 |
| 1146 | end |
| 1147 | storeMeas5 expId L rl ns k |
| 1148 | end |
| 1149 | summarizeTs5 nMeas |
| 1150 | computeDiffZR cid |
| 1151 | us = div ulong sub monons t0 1000 |
| 1152 | printRow5 expId L cid nMeas us |
| 1153 | end |
| 1154 | |
| 1155 | fn runBox5 expId ulong L ulong beta f32 nTh ulong nMs ulong to bool |
| 1156 | if not buildNbTable L |
| 1157 | ret false |
| 1158 | end |
| 1159 | if not buildFlags L true |
| 1160 | ret false |
| 1161 | end |
| 1162 | assertZeroContact expId L get armRLoop 0 get armNSmear 0 |
| 1163 | runArm5 expId L beta 0 nTh nMs |
| 1164 | runArm5 expId L beta get armC1 0 nTh nMs |
| 1165 | runArm5 expId L beta get armC2 0 nTh nMs |
| 1166 | ret true |
| 1167 | end |
| 1168 | |
| 1169 | fn allocBuf bytes ulong cached bool to long |
| 1170 | m = nvalloc bytes cached |
| 1171 | if le m 0 |
| 1172 | uPrint tC5Err |
| 1173 | uPrintU ulong get nvstage 0 |
| 1174 | uPrint tNl |
| 1175 | exit 6 |
| 1176 | end |
| 1177 | ret m |
| 1178 | end |
| 1179 | |
| 1180 | fn main to int |
| 1181 | uPrint tC5Hdr |
| 1182 | if not gbopen 1 |
| 1183 | uPrint tC5Err |
| 1184 | uPrintU ulong get nvstage 0 |
| 1185 | uPrint tNl |
| 1186 | ret 2 |
| 1187 | end |
| 1188 | if not gbbopen |
| 1189 | ret 3 |
| 1190 | end |
| 1191 | put uCodeMap 0 0 |
| 1192 | uEmitAllKernels |
| 1193 | csize = mul div add get uCodePos 0 4095 4096 4096 |
| 1194 | cm = nvalloc csize false |
| 1195 | if le cm 0 |
| 1196 | ret 4 |
| 1197 | end |
| 1198 | put uCodeMap 0 cm |
| 1199 | put uCodeFail 0 0 |
| 1200 | uEmitAllKernels |
| 1201 | if ne get uCodeFail 0 0 |
| 1202 | ret 5 |
| 1203 | end |
| 1204 | |
| 1205 | put dLinks 0 allocBuf 4194304 true |
| 1206 | put dStaples 0 allocBuf 4194304 true |
| 1207 | put dFlags 0 allocBuf 1048576 true |
| 1208 | put dNbSite 0 allocBuf 2097152 true |
| 1209 | put dRng 0 allocBuf 262144 true |
| 1210 | |
| 1211 | uPrint tC5Cols |
| 1212 | |
| 1213 | note Experiment 5A: Contact-Free Exponential Decay at beta=2.30, L in {8, 10, 12, 14, 16} (160 sweeps!) |
| 1214 | put armSeed 0 0x5a5a0001 |
| 1215 | put armC1 0 3 |
| 1216 | put armC2 0 5 |
| 1217 | put armRLoop 0 1 |
| 1218 | put armNSmear 0 1 |
| 1219 | if not runBox5 0 8 2.30f32 64 160 |
| 1220 | rc = nvmclose |
| 1221 | ret 10 |
| 1222 | end |
| 1223 | if not runBox5 0 10 2.30f32 64 160 |
| 1224 | rc = nvmclose |
| 1225 | ret 11 |
| 1226 | end |
| 1227 | if not runBox5 0 12 2.30f32 64 160 |
| 1228 | rc = nvmclose |
| 1229 | ret 12 |
| 1230 | end |
| 1231 | if not runBox5 0 14 2.30f32 64 160 |
| 1232 | rc = nvmclose |
| 1233 | ret 13 |
| 1234 | end |
| 1235 | if not runBox5 0 16 2.30f32 64 160 |
| 1236 | rc = nvmclose |
| 1237 | ret 14 |
| 1238 | end |
| 1239 | |
| 1240 | note Experiment 5B: Referee-Proof Non-Perturbative Fixed-Physical-Box SU(2) Continuum Ladder |
| 1241 | note Coarse: (L=8, beta=2.300, r=1, n_s=1) -> a*sqrt(sigma)=0.369, l*sqrt(sigma)=2.95 |
| 1242 | note Fine: (L=16, beta=2.500, r=2, n_s=4) -> a*sqrt(sigma)=0.186, l*sqrt(sigma)=2.98 |
| 1243 | put armSeed 0 0x5b5b0001 |
| 1244 | put armC1 0 3 |
| 1245 | put armC2 0 6 |
| 1246 | put armRLoop 0 1 |
| 1247 | put armNSmear 0 1 |
| 1248 | if not runBox5 1 8 2.300f32 80 160 |
| 1249 | rc = nvmclose |
| 1250 | ret 15 |
| 1251 | end |
| 1252 | put armRLoop 0 2 |
| 1253 | put armNSmear 0 4 |
| 1254 | if not runBox5 1 16 2.500f32 80 160 |
| 1255 | rc = nvmclose |
| 1256 | ret 16 |
| 1257 | end |
| 1258 | |
| 1259 | note Experiment 5C: Gapless/Weak-Coupling Negative Control (beta=6.00, xi >> L) |
| 1260 | note Exact same physically scaled observables (L=8,r=1,n_s=1) -> (L=16,r=2,n_s=4)! |
| 1261 | put armSeed 0 0x5c5c0001 |
| 1262 | put armC1 0 3 |
| 1263 | put armC2 0 6 |
| 1264 | put armRLoop 0 1 |
| 1265 | put armNSmear 0 1 |
| 1266 | if not runBox5 2 8 6.000f32 80 160 |
| 1267 | rc = nvmclose |
| 1268 | ret 17 |
| 1269 | end |
| 1270 | put armRLoop 0 2 |
| 1271 | put armNSmear 0 4 |
| 1272 | if not runBox5 2 16 6.000f32 80 160 |
| 1273 | rc = nvmclose |
| 1274 | ret 18 |
| 1275 | end |
| 1276 | |
| 1277 | uPrint tC5Done |
| 1278 | rc = nvmclose |
| 1279 | ret 0 |
| 1280 | end |