Feature/yuxuan cl matching integration - #90
Open
MadivB wants to merge 4 commits into
Open
Conversation
New step that runs charge-light matching after run-ndlar-flow. Drives the
external CLMatching_AlphaRelease repo via three wrappers following the
ND_Production convention (sources util/init.inc.sh, reads ND_PRODUCTION_*
env vars, writes outputs under <stepname>/<OUT_NAME>/{FLOW,PT}/<subDir>/):
run_cl_matching_ND_sim.sh in-place HDF5 writeback (Mode A: flow file
reserves t_0/t_cluster_id on calib_prompt_hits
and calib_final_hits). Output is a modified
.FLOW.hdf5, not a .pt. Falls back to .pt for
older flow files without those fields.
run_cl_matching_2x2_sim.sh 2x2 simulation -> .qlmatch2x2.pt
run_cl_matching_2x2_data.sh 2x2 real DAQ data -> .qlmatch2x2.pt
(input via ND_PRODUCTION_CLMATCH_DATA_FILE,
no upstream chain)
install_cl_matching.sh clones https://github.com/MadivB/CLMatching_AlphaRelease.git
into this directory (CLMatching_AlphaRelease/) and runs check_install.py
to surface any missing assets. Uses the shared NERSC nersc-python (torch
already installed there) -- no dedicated venv built here.
admin/install_everything.sh: chain run-cl-matching install in alongside
the other steps.
The cloned CLMatching_AlphaRelease/ is .gitignored (mirrors what
run-larnd-sim/ and run-ndlar-flow/ do for their cloned sources).
CLMatching requires a 4-GPU node per task and 8 workers. Standard
fw_gpu.slurm.sh in fireworks4dune uses --ntasks-per-node=4 --gpus-per-task=1
which would give each fw task only 1 GPU; when a cl_matching spec yaml is
added later it should pair with a new slurm wrapper (--ntasks-per-node=1
--gpus-per-node=4) so each fw task owns the whole node.
…k tmpdir
Two bugs surfaced when running the wrappers fresh on a real GPU node:
1. 2x2 wrappers stripped '.hdf5' when computing the expected .pt name, but
the underlying aggregate_2x2_to_pt.py keeps '.hdf5' in the output name
('<basename incl. .hdf5>.qlmatch2x2.pt'). The wrappers therefore failed
the post-run existence check even though the .pt was produced correctly.
Fix: use 'basename "\$inFile"' instead of 'basename "\$inFile" .hdf5'.
2. run_cl_matching_ND_sim.sh invoked scripts/process_one_flow_file.sh
without an explicit out_dir, so worker NPZ shards landed at
<CLMatching_repo>/output/QLmatchingvAlpha/<basename>/. Over 10k+ files
this would explode the cloned repo's output/ dir.
Fix: pass per-task \$workDir under tmpOutDir as the 2nd positional arg
to process_one_flow_file.sh; preserve the worker logs under the
canonical LOGS dir, then rm -rf \$workDir after the .FLOW.hdf5 is moved.
Verified Bug 1 fix against the .pt produced by the previous failing run
(file exists at fixed path, not at the buggy path).
…ching-integration # Conflicts: # admin/install_everything.sh
The ND sim wrapper's `run env ... process_one_flow_file.sh` was tripping `set -o errexit` because the underlying CLMatching launcher's trailing `ls .../*.v_alpha_test.pt | head` fails rc=2 in Mode A (no .pt produced), which `set -o pipefail` propagates. Even though the HDF5 writeback fully succeeded, the wrapper aborted before running its Python sanity-check or mv'ing the file to outDir/FLOW/<subDir>/. Bracket the `run` call with `set +/-o errexit` so the exit code cannot prematurely kill us; the Python sanity check below is the authoritative Mode A success criterion. A companion fix in CLMatching_AlphaRelease (commit 056026d) removes the underlying spurious exit for future runs, but this belt-and-suspenders is cheap and lets the wrapper stay correct even against pre-fix CLMatching checkouts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
I have added the
run-cl-matching/production step that will be auto-installed through the install_everything under adimn. This will run the alpha release version charge-light matching (QL matching) after the existingrun-ndlar-flow/step. It is the same as the one discribed in the technote that can be seen in the technote. I included here three similar workflows with the same architecture, but different geometry, mirroring the existing sim/data × ND/2x2 grid:run_cl_matching_ND_sim.shrun_cl_matching_2x2_sim.shrun_cl_matching_2x2_data.shAll three wrappers drive the external
MadivB/CLMatching_AlphaReleaserepo, whichinstall_cl_matching.shclones intorun-cl-matching/CLMatching_AlphaRelease/.Files
run-cl-matching/install_cl_matching.sh— clones the CLMatching repo, runs itscheck_install.pywhich surfaces the one non-bundled asset (the ~490 MB ND-LAr perceiver, hosted on the CLMatching GitHub Release) with the exactcurlcommand to fetch it.run-cl-matching/run_cl_matching_ND_sim.sh— ND simulation.run-cl-matching/run_cl_matching_2x2_sim.sh— 2x2 simulation.run-cl-matching/run_cl_matching_2x2_data.sh— 2x2 real data (input file taken fromND_PRODUCTION_CLMATCH_DATA_FILE; no upstream chain wiring since real DAQ data isn't produced by the ND_Production pipeline).run-cl-matching/.gitignore— excludes the clonedCLMatching_AlphaRelease/from this repo (mirrors whatrun-larnd-sim/andrun-ndlar-flow/do).admin/install_everything.sh— chains the new install step inside the detector-specific block.Conventions followed
run_*.shsources../util/reload_in_container.inc.sh+../util/init.inc.sh, consumesND_PRODUCTION_*env vars, wraps heavy commands with therunhelper for logging/timing, and writes outputs to<OUTDIR_BASE>/run-cl-matching/<OUT_NAME>/{FLOW,PT}/<subDir>/.install_cl_matching.shfollows the same error-out-if-installed pattern asinstall_ndlar_flow.sh/install_larnd_sim.sh.Override knobs
ND_PRODUCTION_CLMATCH_REPO— override the CLMatching install location (defaults to$ND_PRODUCTION_INSTALL_DIR/CLMatching_AlphaRelease).ND_PRODUCTION_CLMATCH_BRANCH— override the CLMatching git branch (defaultmain).ND_PRODUCTION_CLMATCH_VERSION— 2x2 algorithm version,v1.0(default, error-matrix) orv2.0(region-grow + tiebreaker).ND_PRODUCTION_CLMATCH_DATA_FILE— 2x2 data input file path (default is the standard dune cfs beam-data reflow file).Mode A (in-place HDF5) vs Mode B (.pt) for ND
run_cl_matching_ND_sim.shinspects the FLOW file'scalib_prompt_hitsandcalib_final_hitsdtypes. If both reservet_0andt_cluster_id(the new dtype format), it copies the file intotmpOutDir, has CLMatching write the two fields directly into the compound HDF5 datasets, thenmvs the modified.FLOW.hdf5tooutDir/FLOW/<subDir>/. For older FLOW files without those fields, CLMatching's aggregator falls back to producing a.ptunder<CLMatching repo>/output/QLmatchingvAlpha/.Testing
I did a test run before uploading this to you guys and verified twice end-to-end from an empty folder simulating a fresh NERSC user
Serious things that might worth mentioning and discussion (if this makes you a lot of trouble, I am fine with changing the dafaults)
fireworks4dune's stock
slurm/fw_gpu.slurm.shuses--ntasks-per-node=4 --gpus-per-task=1, giving each fireworks task only 1 GPU. Our wrappers default to 8 workers on 4 GPUs. When accl_matching.yamlspec is authored, the accompanying submission line should use--ntasks-per-node=1 --gpus-per-node=4(or setN_GPUS=1 N_WORKERS_PER_GPU=1in the base_env if 1-GPU-per-task is preferred — both are supported via env-var overrides).