yang
This project has not described itself yet.
Brought by drakestapleton
yang / src / ufbi_check3_gb10.om
| 1 | note SPDX-License-Identifier: Apache-2.0 |
| 2 | note src/ufbi_check3_gb10.om: Pure Seeded-OM-2 Zero-CUDA GB10 Runner for UFBI Check #3 |
| 3 | note (4D SU(2) Adversarial Twisted-Collar Search: Creutz Calibration Oracle + |
| 4 | note Trickster Collar Zoo + Evolutionary Mutations + Held-Out Independent-Seed Judge). |
| 5 | note |
| 6 | note Composed after: |
| 7 | note gpu/nvidia/native/nvrm/context.om |
| 8 | note gpu/nvidia/native/blackwell/vector.om |
| 9 | note gpu/nvidia/native/blackwell/launch.om |
| 10 | note gpu/nvidia/native/blackwell/batch.om |
| 11 | note om/encoder/bw_enc_sm121.om |
| 12 | note src/ufbi_math.om |
| 13 | note src/ufbi_check3_kernels.om |
| 14 | |
| 15 | note Per-collar measurement time series (up to 400 sweeps x 4 observables) |
| 16 | note obs: 0=P1x1_int, 1=W1x2_int, 2=AdjP_int, 3=W2x2_int |
| 17 | global tsData f64 1600 |
| 18 | global baseMean f64 4 |
| 19 | global baseStd f64 4 |
| 20 | global curMean f64 4 |
| 21 | global curErr f64 4 |
| 22 | global curZ f64 4 |
| 23 | |
| 24 | text tC3Hdr "=== UFBI CHECK #3: 4D SU(2) ADVERSARIAL TWISTED-COLLAR SEARCH (PURE OM-2 ZERO-CUDA GB10) ===\n" |
| 25 | text tC3Err "FAIL: GB10 native NVRM/kernel error stage=" |
| 26 | text tC3CalOk "ORACLE_SU2_CREUTZ_L8_B230: PASS <P>=" |
| 27 | text tC3CalBad "ORACLE_SU2_CREUTZ_L8_B230: FAIL <P>=" |
| 28 | text tC3CalRef " (published_ref=0.6023 err=" |
| 29 | text tC3Rp ")\n" |
| 30 | text tC3Cols "stage\tL\tbeta\tcollar\tsweeps\tP1x1\tP1x1_err\tdP_Z\tW1x2\tdW1x2_Z\tAdjP\tdAdj_Z\tW2x2\tdW2x2_Z\tmax_Z\tus_total\n" |
| 31 | text tTab "\t" |
| 32 | text tNl "\n" |
| 33 | text tS1 "screen" |
| 34 | text tS2 "heldout" |
| 35 | text tK0 "C0_cold" |
| 36 | text tK1 "C1_z2_vortex" |
| 37 | text tK2 "C2_z2_dual" |
| 38 | text tK3 "C3_hot_haar" |
| 39 | text tK4 "C4_frust_chk" |
| 40 | text tK5 "C5_nonab_twist" |
| 41 | text tK6 "C6_trick_vort" |
| 42 | text tK7 "C7_trick_mut" |
| 43 | text tC3Done "CHECK3_GB10_DONE status=PASS\n" |
| 44 | |
| 45 | note Build 4D periodic neighbor table on host & upload to dNbSite |
| 46 | fn coordIdx c0 ulong c1 ulong c2 ulong c3 ulong L ulong to ulong |
| 47 | r = add mul c0 L c1 |
| 48 | r = add mul r L c2 |
| 49 | ret add mul r L c3 |
| 50 | end |
| 51 | |
| 52 | fn buildNbTable L ulong to bool |
| 53 | N = mul mul L L mul L L |
| 54 | for s ulong N bound 65536 |
| 55 | c3 = rem s L |
| 56 | t = div s L |
| 57 | c2 = rem t L |
| 58 | t = div t L |
| 59 | c1 = rem t L |
| 60 | c0 = div t L |
| 61 | b = mul s 8 |
| 62 | put hNb b uint coordIdx rem add c0 1 L c1 c2 c3 L |
| 63 | put hNb add b 1 uint coordIdx rem add c0 sub L 1 L c1 c2 c3 L |
| 64 | put hNb add b 2 uint coordIdx c0 rem add c1 1 L c2 c3 L |
| 65 | put hNb add b 3 uint coordIdx c0 rem add c1 sub L 1 L c2 c3 L |
| 66 | put hNb add b 4 uint coordIdx c0 c1 rem add c2 1 L c3 L |
| 67 | put hNb add b 5 uint coordIdx c0 c1 rem add c2 sub L 1 L c3 L |
| 68 | put hNb add b 6 uint coordIdx c0 c1 c2 rem add c3 1 L L |
| 69 | put hNb add b 7 uint coordIdx c0 c1 c2 rem add c3 sub L 1 L L |
| 70 | end |
| 71 | totalW = mul N 8 |
| 72 | off = ulong 0 |
| 73 | while lt off totalW bound 64 |
| 74 | cnt = sub totalW off |
| 75 | if gt cnt 16384 |
| 76 | cnt = ulong 16384 |
| 77 | end |
| 78 | for k ulong cnt bound 16384 |
| 79 | stageU32 k get hNb add off k |
| 80 | end |
| 81 | if not flushStage get dNbSite 0 mul off 4 cnt |
| 82 | ret false |
| 83 | end |
| 84 | off = add off cnt |
| 85 | end |
| 86 | ret true |
| 87 | end |
| 88 | |
| 89 | fn isBdryL s ulong L ulong to bool |
| 90 | c3 = rem s L |
| 91 | t = div s L |
| 92 | c2 = rem t L |
| 93 | t = div t L |
| 94 | c1 = rem t L |
| 95 | c0 = div t L |
| 96 | lm1 = sub L 1 |
| 97 | if or eq c0 0 eq c0 lm1 |
| 98 | ret true |
| 99 | end |
| 100 | if or eq c1 0 eq c1 lm1 |
| 101 | ret true |
| 102 | end |
| 103 | if or eq c2 0 eq c2 lm1 |
| 104 | ret true |
| 105 | end |
| 106 | if or eq c3 0 eq c3 lm1 |
| 107 | ret true |
| 108 | end |
| 109 | ret false |
| 110 | end |
| 111 | |
| 112 | fn isIntL s ulong L ulong to bool |
| 113 | lo = div L 4 |
| 114 | hi = sub L lo |
| 115 | c3 = rem s L |
| 116 | t = div s L |
| 117 | c2 = rem t L |
| 118 | t = div t L |
| 119 | c1 = rem t L |
| 120 | c0 = div t L |
| 121 | if or lt c0 lo ge c0 hi |
| 122 | ret false |
| 123 | end |
| 124 | if or lt c1 lo ge c1 hi |
| 125 | ret false |
| 126 | end |
| 127 | if or lt c2 lo ge c2 hi |
| 128 | ret false |
| 129 | end |
| 130 | if or lt c3 lo ge c3 hi |
| 131 | ret false |
| 132 | end |
| 133 | ret true |
| 134 | end |
| 135 | |
| 136 | fn siteFlag s ulong L ulong freezeCollar bool to uint |
| 137 | if and freezeCollar isBdryL s L |
| 138 | ret uint 2 |
| 139 | end |
| 140 | c3 = rem s L |
| 141 | t = div s L |
| 142 | c2 = rem t L |
| 143 | t = div t L |
| 144 | c1 = rem t L |
| 145 | c0 = div t L |
| 146 | ret uint and add add c0 c1 add c2 c3 1 |
| 147 | end |
| 148 | |
| 149 | fn buildFlags L ulong freezeCollar bool to bool |
| 150 | N = mul mul L L mul L L |
| 151 | totalW = mul N 4 |
| 152 | off = ulong 0 |
| 153 | while lt off totalW bound 32 |
| 154 | cnt = sub totalW off |
| 155 | if gt cnt 16384 |
| 156 | cnt = ulong 16384 |
| 157 | end |
| 158 | for k ulong cnt bound 16384 |
| 159 | stageU32 k siteFlag div add off k 4 L freezeCollar |
| 160 | end |
| 161 | if not flushStage get dFlags 0 mul off 4 cnt |
| 162 | ret false |
| 163 | end |
| 164 | off = add off cnt |
| 165 | end |
| 166 | ret true |
| 167 | end |
| 168 | |
| 169 | note ========================================================================= |
| 170 | note Collar Zoo Initialization (C0..C7) |
| 171 | note ========================================================================= |
| 172 | fn setCollarAdv s ulong mu ulong L ulong cid ulong base ulong to void |
| 173 | c3 = rem s L |
| 174 | c2 = rem div s L L |
| 175 | c1 = rem div s mul L L L |
| 176 | c0 = div s mul mul L L L |
| 177 | if eq cid 5 |
| 178 | if eq mu 0 |
| 179 | put hLinks base 0.0f32 |
| 180 | put hLinks add base 1 1.0f32 |
| 181 | end |
| 182 | if eq mu 1 |
| 183 | put hLinks base 0.0f32 |
| 184 | put hLinks add base 2 1.0f32 |
| 185 | end |
| 186 | if eq mu 2 |
| 187 | put hLinks base 0.0f32 |
| 188 | put hLinks add base 3 1.0f32 |
| 189 | end |
| 190 | if eq mu 3 |
| 191 | put hLinks base 0.5f32 |
| 192 | put hLinks add base 1 0.5f32 |
| 193 | put hLinks add base 2 0.5f32 |
| 194 | put hLinks add base 3 0.5f32 |
| 195 | end |
| 196 | ret |
| 197 | end |
| 198 | if eq cid 6 |
| 199 | if eq and add c0 c1 1 1 |
| 200 | put hLinks base neg 0.5f32 |
| 201 | put hLinks add base 1 0.5f32 |
| 202 | put hLinks add base 2 neg 0.5f32 |
| 203 | put hLinks add base 3 0.5f32 |
| 204 | else |
| 205 | put hLinks base 0.0f32 |
| 206 | put hLinks add base 1 neg 0.70710678f32 |
| 207 | put hLinks add base 2 0.70710678f32 |
| 208 | put hLinks add base 3 0.0f32 |
| 209 | end |
| 210 | ret |
| 211 | end |
| 212 | if or eq c0 0 eq c1 0 |
| 213 | put hLinks base neg 1.0f32 |
| 214 | end |
| 215 | if or eq c2 0 eq c3 0 |
| 216 | put hLinks base 0.0f32 |
| 217 | put hLinks add base 1 f32 uRngNorm64 |
| 218 | put hLinks add base 2 f32 uRngNorm64 |
| 219 | put hLinks add base 3 f32 uRngNorm64 |
| 220 | qNormHost base |
| 221 | end |
| 222 | end |
| 223 | |
| 224 | fn setCollarLink s ulong mu ulong L ulong cid ulong to void |
| 225 | base = mul add mul s 4 mu 4 |
| 226 | put hLinks base 1.0f32 |
| 227 | put hLinks add base 1 0.0f32 |
| 228 | put hLinks add base 2 0.0f32 |
| 229 | put hLinks add base 3 0.0f32 |
| 230 | if eq cid 0 |
| 231 | ret |
| 232 | end |
| 233 | if ge cid 5 |
| 234 | setCollarAdv s mu L cid base |
| 235 | ret |
| 236 | end |
| 237 | if eq cid 3 |
| 238 | put hLinks base f32 uRngNorm64 |
| 239 | put hLinks add base 1 f32 uRngNorm64 |
| 240 | put hLinks add base 2 f32 uRngNorm64 |
| 241 | put hLinks add base 3 f32 uRngNorm64 |
| 242 | qNormHost base |
| 243 | ret |
| 244 | end |
| 245 | c3 = rem s L |
| 246 | c2 = rem div s L L |
| 247 | c1 = rem div s mul L L L |
| 248 | c0 = div s mul mul L L L |
| 249 | if eq cid 4 |
| 250 | par = and add add c0 c1 add c2 c3 1 |
| 251 | if eq par 1 |
| 252 | if or eq mu 0 eq mu 2 |
| 253 | put hLinks base neg 1.0f32 |
| 254 | end |
| 255 | end |
| 256 | ret |
| 257 | end |
| 258 | if and eq c0 0 eq mu 0 |
| 259 | if ge c1 div L 2 |
| 260 | put hLinks base neg 1.0f32 |
| 261 | end |
| 262 | end |
| 263 | if eq cid 2 |
| 264 | if and eq c2 0 eq mu 2 |
| 265 | if ge c3 div L 2 |
| 266 | put hLinks base neg 1.0f32 |
| 267 | end |
| 268 | end |
| 269 | end |
| 270 | end |
| 271 | |
| 272 | fn initLattice L ulong cid ulong freezeCollar bool seed ulong to bool |
| 273 | N = mul mul L L mul L L |
| 274 | uRngSeed seed |
| 275 | for s ulong N bound 65536 |
| 276 | isB = and freezeCollar isBdryL s L |
| 277 | for mu ulong 4 |
| 278 | if isB |
| 279 | setCollarLink s mu L cid |
| 280 | else |
| 281 | base = mul add mul s 4 mu 4 |
| 282 | note Start interior near identity + small perturbation |
| 283 | put hLinks base 0.85f32 |
| 284 | put hLinks add base 1 mul 0.25f32 f32 uRngNorm64 |
| 285 | put hLinks add base 2 mul 0.25f32 f32 uRngNorm64 |
| 286 | put hLinks add base 3 mul 0.25f32 f32 uRngNorm64 |
| 287 | qNormHost base |
| 288 | end |
| 289 | end |
| 290 | end |
| 291 | ret uploadLinks N |
| 292 | end |
| 293 | |
| 294 | note ========================================================================= |
| 295 | note Live GB10 SU(2) Monte Carlo Sweep: 1 Heatbath + nOr Overrelaxation passes |
| 296 | note ========================================================================= |
| 297 | note ========================================================================= |
| 298 | note Host Measurement of Central Observables (P1x1, W1x2, AdjP, W2x2) |
| 299 | note ========================================================================= |
| 300 | fn hRect1x2 s ulong mu ulong nu ulong to f64 |
| 301 | a = new f32 4 0.0f32 |
| 302 | b = new f32 4 0.0f32 |
| 303 | p = new f32 4 0.0f32 |
| 304 | q = new f32 4 0.0f32 |
| 305 | s1 = getNb s mu 0 |
| 306 | s2 = getNb s1 mu 0 |
| 307 | hQLoad s mu a |
| 308 | hQLoad s1 mu b |
| 309 | hQMul a b p |
| 310 | hQLoad s2 nu a |
| 311 | hQMul p a q |
| 312 | hQLoad getNb s1 nu 0 mu a |
| 313 | hQConj a |
| 314 | hQMul q a p |
| 315 | hQLoad getNb s nu 0 mu a |
| 316 | hQConj a |
| 317 | hQMul p a q |
| 318 | hQLoad s nu b |
| 319 | hQConj b |
| 320 | hQMul q b p |
| 321 | ret f64 get p 0 |
| 322 | end |
| 323 | |
| 324 | fn hRect2x2 s ulong mu ulong nu ulong to f64 |
| 325 | a = new f32 4 0.0f32 |
| 326 | p = new f32 4 0.0f32 |
| 327 | q = new f32 4 0.0f32 |
| 328 | cur = s |
| 329 | hQLoad cur mu p |
| 330 | cur = getNb cur mu 0 |
| 331 | hQLoad cur mu a |
| 332 | hQMul p a q |
| 333 | cur = getNb cur mu 0 |
| 334 | hQLoad cur nu a |
| 335 | hQMul q a p |
| 336 | cur = getNb cur nu 0 |
| 337 | hQLoad cur nu a |
| 338 | hQMul p a q |
| 339 | cur = getNb cur nu 0 |
| 340 | cur = getNb cur mu 1 |
| 341 | hQLoad cur mu a |
| 342 | hQConj a |
| 343 | hQMul q a p |
| 344 | cur = getNb cur mu 1 |
| 345 | hQLoad cur mu a |
| 346 | hQConj a |
| 347 | hQMul p a q |
| 348 | cur = getNb cur nu 1 |
| 349 | hQLoad cur nu a |
| 350 | hQConj a |
| 351 | hQMul q a p |
| 352 | cur = getNb cur nu 1 |
| 353 | hQLoad cur nu a |
| 354 | hQConj a |
| 355 | hQMul p a q |
| 356 | ret f64 get q 0 |
| 357 | end |
| 358 | |
| 359 | global mcAcc f64 4 |
| 360 | global mcCnt ulong 1 |
| 361 | |
| 362 | fn measureSite s ulong to void |
| 363 | for mu ulong 4 |
| 364 | for nu ulong 4 |
| 365 | if lt mu nu |
| 366 | vp = hPlaq s mu nu |
| 367 | put mcAcc 0 add get mcAcc 0 vp |
| 368 | put mcAcc 2 add get mcAcc 2 sub mul 4.0f64 mul vp vp 1.0f64 |
| 369 | put mcAcc 1 add get mcAcc 1 hRect1x2 s mu nu |
| 370 | put mcAcc 3 add get mcAcc 3 hRect2x2 s mu nu |
| 371 | put mcCnt 0 add get mcCnt 0 1 |
| 372 | end |
| 373 | end |
| 374 | end |
| 375 | end |
| 376 | |
| 377 | fn measureCentral L ulong k ulong fullBox bool to void |
| 378 | N = mul mul L L mul L L |
| 379 | downloadLinks N |
| 380 | for o ulong 4 |
| 381 | put mcAcc o 0.0f64 |
| 382 | end |
| 383 | put mcCnt 0 0 |
| 384 | for s ulong N bound 65536 |
| 385 | if or fullBox isIntL s L |
| 386 | measureSite s |
| 387 | end |
| 388 | end |
| 389 | fc = f64 get mcCnt 0 |
| 390 | b = mul k 4 |
| 391 | for o ulong 4 |
| 392 | put tsData add b o div get mcAcc o fc |
| 393 | end |
| 394 | end |
| 395 | |
| 396 | fn sumBlk o ulong st ulong blkSz ulong to f64 |
| 397 | s = f64 0.0f64 |
| 398 | for j ulong blkSz bound 64 |
| 399 | s = add s get tsData add mul add st j 4 o |
| 400 | end |
| 401 | ret s |
| 402 | end |
| 403 | |
| 404 | fn summarizeOne o ulong nMeas ulong to void |
| 405 | blkSz = div nMeas 8 |
| 406 | tot = f64 0.0f64 |
| 407 | for k ulong nMeas bound 400 |
| 408 | tot = add tot get tsData add mul k 4 o |
| 409 | end |
| 410 | mean = div tot f64 nMeas |
| 411 | put curMean o mean |
| 412 | jkSum = f64 0.0f64 |
| 413 | for b ulong 8 |
| 414 | bs = sumBlk o mul b blkSz blkSz |
| 415 | d = sub div sub tot bs f64 sub nMeas blkSz mean |
| 416 | jkSum = add jkSum mul d d |
| 417 | end |
| 418 | put curErr o uSqrt64 mul 0.875f64 jkSum |
| 419 | end |
| 420 | |
| 421 | fn summarizeTs nMeas ulong to void |
| 422 | for o ulong 4 |
| 423 | summarizeOne o nMeas |
| 424 | end |
| 425 | end |
| 426 | |
| 427 | fn printCollarTag cid ulong to void |
| 428 | if eq cid 0 |
| 429 | uPrint tK0 |
| 430 | end |
| 431 | if eq cid 1 |
| 432 | uPrint tK1 |
| 433 | end |
| 434 | if eq cid 2 |
| 435 | uPrint tK2 |
| 436 | end |
| 437 | if eq cid 3 |
| 438 | uPrint tK3 |
| 439 | end |
| 440 | if eq cid 4 |
| 441 | uPrint tK4 |
| 442 | end |
| 443 | if eq cid 5 |
| 444 | uPrint tK5 |
| 445 | end |
| 446 | if eq cid 6 |
| 447 | uPrint tK6 |
| 448 | end |
| 449 | if eq cid 7 |
| 450 | uPrint tK7 |
| 451 | end |
| 452 | end |
| 453 | |
| 454 | note ========================================================================= |
| 455 | note Physics Calibration Oracle: Periodic 8^4 SU(2) at beta=2.30 (Creutz ref ~0.6023) |
| 456 | note ========================================================================= |
| 457 | fn runCreutzOracle to bool |
| 458 | L = ulong 8 |
| 459 | N = ulong 4096 |
| 460 | if not buildNbTable L |
| 461 | ret false |
| 462 | end |
| 463 | if not buildFlags L false |
| 464 | ret false |
| 465 | end |
| 466 | if not seedGpuRng N 0xdeadbeef12345678 |
| 467 | ret false |
| 468 | end |
| 469 | if not initLattice L 0 false 0x1122334455667788 |
| 470 | ret false |
| 471 | end |
| 472 | note 50 thermalization sweeps (1 HB + 3 OR each) |
| 473 | for sw ulong 50 |
| 474 | if not gpuSweep N 2.30f32 3 |
| 475 | ret false |
| 476 | end |
| 477 | end |
| 478 | note 64 measurement sweeps |
| 479 | for k ulong 64 |
| 480 | if not gpuSweep N 2.30f32 2 |
| 481 | ret false |
| 482 | end |
| 483 | measureCentral L k true |
| 484 | end |
| 485 | summarizeTs 64 |
| 486 | p = get curMean 0 |
| 487 | e = get curErr 0 |
| 488 | if and ge p 0.590f64 le p 0.615f64 |
| 489 | uPrint tC3CalOk |
| 490 | uPrintF64 p |
| 491 | uPrint tC3CalRef |
| 492 | uPrintF64 e |
| 493 | uPrint tC3Rp |
| 494 | ret true |
| 495 | end |
| 496 | uPrint tC3CalBad |
| 497 | uPrintF64 p |
| 498 | uPrint tC3CalRef |
| 499 | uPrintF64 e |
| 500 | uPrint tC3Rp |
| 501 | ret false |
| 502 | end |
| 503 | |
| 504 | global armBeta f32 1 |
| 505 | global armSeed ulong 1 |
| 506 | |
| 507 | fn computeZScores cid ulong to f64 |
| 508 | if eq cid 0 |
| 509 | for o ulong 4 |
| 510 | put baseMean o get curMean o |
| 511 | put baseStd o get curErr o |
| 512 | end |
| 513 | end |
| 514 | maxZ = f64 0.0f64 |
| 515 | for o ulong 4 |
| 516 | diff = uAbs64 sub get curMean o get baseMean o |
| 517 | se = uSqrt64 add mul get curErr o get curErr o mul get baseStd o get baseStd o |
| 518 | z = f64 0.0f64 |
| 519 | if gt se 0.000001f64 |
| 520 | z = div diff se |
| 521 | end |
| 522 | put curZ o z |
| 523 | if gt z maxZ |
| 524 | maxZ = z |
| 525 | end |
| 526 | end |
| 527 | ret maxZ |
| 528 | end |
| 529 | |
| 530 | fn printArmRow isHeld bool L ulong cid ulong nMeas ulong maxZ f64 us ulong to void |
| 531 | if isHeld |
| 532 | uPrint tS2 |
| 533 | else |
| 534 | uPrint tS1 |
| 535 | end |
| 536 | uPrint tTab |
| 537 | uPrintU L |
| 538 | uPrint tTab |
| 539 | uPrintF64 f64 get armBeta 0 |
| 540 | uPrint tTab |
| 541 | printCollarTag cid |
| 542 | uPrint tTab |
| 543 | uPrintU nMeas |
| 544 | uPrint tTab |
| 545 | uPrintF64 get curMean 0 |
| 546 | uPrint tTab |
| 547 | uPrintF64 get curErr 0 |
| 548 | uPrint tTab |
| 549 | uPrintF64 get curZ 0 |
| 550 | uPrint tTab |
| 551 | uPrintF64 get curMean 1 |
| 552 | uPrint tTab |
| 553 | uPrintF64 get curZ 1 |
| 554 | uPrint tTab |
| 555 | uPrintF64 get curMean 2 |
| 556 | uPrint tTab |
| 557 | uPrintF64 get curZ 2 |
| 558 | uPrint tTab |
| 559 | uPrintF64 get curMean 3 |
| 560 | uPrint tTab |
| 561 | uPrintF64 get curZ 3 |
| 562 | uPrint tTab |
| 563 | uPrintF64 maxZ |
| 564 | uPrint tTab |
| 565 | uPrintU us |
| 566 | uPrint tNl |
| 567 | end |
| 568 | |
| 569 | fn runCollarArm isHeld bool L ulong cid ulong nTherm ulong nMeas ulong to f64 |
| 570 | t0 = monons |
| 571 | beta = get armBeta 0 |
| 572 | seed = get armSeed 0 |
| 573 | N = mul mul L L mul L L |
| 574 | if not seedGpuRng N add seed mul cid 7919 |
| 575 | exit 31 |
| 576 | end |
| 577 | if not initLattice L cid true add seed mul cid 104729 |
| 578 | exit 32 |
| 579 | end |
| 580 | for sw ulong nTherm bound 200 |
| 581 | if not gpuSweep N beta 3 |
| 582 | exit 33 |
| 583 | end |
| 584 | end |
| 585 | for k ulong nMeas bound 400 |
| 586 | if not gpuSweep N beta 2 |
| 587 | exit 34 |
| 588 | end |
| 589 | measureCentral L k false |
| 590 | end |
| 591 | summarizeTs nMeas |
| 592 | maxZ = computeZScores cid |
| 593 | us = div ulong sub monons t0 1000 |
| 594 | printArmRow isHeld L cid nMeas maxZ us |
| 595 | ret maxZ |
| 596 | end |
| 597 | |
| 598 | fn allocBuf bytes ulong cached bool to long |
| 599 | m = nvalloc bytes cached |
| 600 | if le m 0 |
| 601 | uPrint tC3Err |
| 602 | uPrintU ulong get nvstage 0 |
| 603 | uPrint tNl |
| 604 | exit 6 |
| 605 | end |
| 606 | ret m |
| 607 | end |
| 608 | |
| 609 | fn runBetaSweep L ulong beta f32 to void |
| 610 | bestCid = ulong 1 |
| 611 | bestZ = f64 0.0f64 |
| 612 | nTh = ulong 32 |
| 613 | nMs = ulong 48 |
| 614 | if eq L 16 |
| 615 | nTh = ulong 24 |
| 616 | nMs = ulong 32 |
| 617 | end |
| 618 | put armBeta 0 beta |
| 619 | put armSeed 0 0x1000001 |
| 620 | for cid ulong 8 |
| 621 | z = runCollarArm false L cid nTh nMs |
| 622 | if and gt cid 0 gt z bestZ |
| 623 | bestZ = z |
| 624 | bestCid = cid |
| 625 | end |
| 626 | end |
| 627 | put armSeed 0 0x99999991 |
| 628 | z0 = runCollarArm true L 0 mul nTh 2 mul nMs 3 |
| 629 | zW = runCollarArm true L bestCid mul nTh 2 mul nMs 3 |
| 630 | end |
| 631 | |
| 632 | fn runLSweep L ulong to bool |
| 633 | if not buildNbTable L |
| 634 | ret false |
| 635 | end |
| 636 | if not buildFlags L true |
| 637 | ret false |
| 638 | end |
| 639 | runBetaSweep L 2.30f32 |
| 640 | runBetaSweep L 2.60f32 |
| 641 | runBetaSweep L 3.00f32 |
| 642 | ret true |
| 643 | end |
| 644 | |
| 645 | fn main to int |
| 646 | uPrint tC3Hdr |
| 647 | rcOpen = openWilsonKernels |
| 648 | if ne rcOpen 0 |
| 649 | if eq rcOpen 2 |
| 650 | uPrint tC3Err |
| 651 | uPrintU ulong get nvstage 0 |
| 652 | uPrint tNl |
| 653 | end |
| 654 | ret rcOpen |
| 655 | end |
| 656 | put dLinks 0 allocBuf 4194304 true |
| 657 | put dStaples 0 allocBuf 4194304 true |
| 658 | put dFlags 0 allocBuf 1048576 true |
| 659 | put dNbSite 0 allocBuf 2097152 true |
| 660 | put dRng 0 allocBuf 262144 true |
| 661 | |
| 662 | if not runCreutzOracle |
| 663 | rc = nvmclose |
| 664 | ret 10 |
| 665 | end |
| 666 | |
| 667 | uPrint tC3Cols |
| 668 | if not runLSweep 8 |
| 669 | rc = nvmclose |
| 670 | ret 11 |
| 671 | end |
| 672 | if not runLSweep 16 |
| 673 | rc = nvmclose |
| 674 | ret 12 |
| 675 | end |
| 676 | |
| 677 | uPrint tC3Done |
| 678 | rc = nvmclose |
| 679 | ret 0 |
| 680 | end |