[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-nvidia-udf-optimize-cudf":3,"mdc-tzg0ht-key":38,"related-repo-nvidia-udf-optimize-cudf":1569,"related-org-nvidia-udf-optimize-cudf":1653},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":23,"repoUrl":24,"updatedAt":25,"license":26,"forks":27,"topics":28,"repo":33,"sourceUrl":36,"mdContent":37},"udf-optimize-cudf","optimize cuDF RapidsUDF performance","Iteratively optimizes a cuDF RapidsUDF implementation for GPU performance. Use after testing and benchmarking with udf-benchmark. Runs a loop of profiling, optimizing, testing, and benchmarking until performance converges or the iteration budget is exhausted.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},"nvidia","NVIDIA","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fnvidia.png",[12,16,19,20],{"name":13,"slug":14,"type":15},"Performance","performance","tag",{"name":17,"slug":18,"type":15},"Benchmarking","benchmarking",{"name":9,"slug":8,"type":15},{"name":21,"slug":22,"type":15},"Engineering","engineering",987,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fcudf-spark","2026-07-14T05:30:52.785634","CC-BY-4.0 AND Apache-2.0",289,[29,30,31,32],"big-data","gpu","rapids","spark",{"repoUrl":24,"stars":23,"forks":27,"topics":34,"description":35},[29,30,31,32],"Spark RAPIDS plugin - accelerate Apache Spark with GPUs","https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fcudf-spark\u002Ftree\u002FHEAD\u002Fskills\u002Fudf-optimize-cudf","---\nname: udf-optimize-cudf\ndescription: Iteratively optimizes a cuDF RapidsUDF implementation for GPU performance. Use after testing and benchmarking with udf-benchmark. Runs a loop of profiling, optimizing, testing, and benchmarking until performance converges or the iteration budget is exhausted.\nlicense: CC-BY-4.0 AND Apache-2.0\nmetadata:\n  spdx-file-copyright-text: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.\nmodel: inherit\n---\n\n# Optimize cuDF RapidsUDF\n\n## Workflow\n\n- [ ] Step 0: Create backup and establish baseline\n- [ ] Steps 1-4: Iterative optimization loop (repeat up to N iterations)\n  - [ ] Step 1: Profile with nsys\n  - [ ] Step 2: Implement one targeted change\n  - [ ] Step 3: Run unit tests (fail &rarr; discard, retry)\n  - [ ] Step 4: Run microbenchmarks (no improvement &rarr; discard, retry)\n- [ ] Final Step 1: Run judge subagent if requested\n- [ ] Final Step 2: Review optimized implementation and report results\n\n## Prerequisites\n\n- Project directory with passing unit tests and cuDF comparison test\n- MicroBenchRunner implemented and working (from the **udf-benchmark** skill)\n- Benchmark data generated (reuse from the benchmark step)\n\nDerive `\u003CCamelName>` and `\u003Csnake_name>` from the UDF class name.\n\n> **Note:** Commands require access to `\u002Ftmp` (Spark temp storage) and `\u002Fdev` (GPU device). If commands fail due to sandbox restrictions, re-run them unsandboxed.\n\n## Step 0: Create Backup and Establish Baseline\n\n1. Create a backup of the current RapidsUDF implementation:\n```bash\ncp src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala> \\\n   src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>.bak\n```\n\n2. If no `.orig.bak` exists yet, save the original unoptimized implementation:\n```bash\ncp src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala> \\\n   src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>.orig.bak\n```\nThis file is never overwritten; it preserves the pre-optimization baseline.\n\n3. If no baseline microbenchmark results exist, run the baseline now:\n```bash\n.\u002Frun_micro_benchmark.sh --mode all --data-path data\u002Fbench_data_\u003Crows>_rows.parquet --rows \u003Crows>\n```\n\nRecord the baseline GPU time and speedup. This is the number to beat.\n\n## Iterative Optimization Loop\n\nRepeat the following steps up to **N iterations** (default: 10). Also stop early if no improvement is found after **3 consecutive failed attempts**.\n\nMaintain an **optimization log** throughout the loop: for each iteration, record what change was attempted and whether it improved, regressed, or had no effect. This prevents repeating failed approaches and feeds the final report.\n\n### Step 1: Profile with nsys\n\nProfile the current implementation to identify bottlenecks:\n```bash\n.\u002Frun_micro_benchmark.sh --mode gpu --data-path data\u002Fbench_data_\u003Crows>_rows.parquet --rows \u003Crows> --profile\n```\n\nSummarize libcudf kernel stats:\n```bash\nnsys stats --report nvtx_sum --format csv -o rapidsudf results\u002F\u003Creport>.nsys-rep\n```\n\nConsult **references\u002FOPTIMIZATION_PATTERNS.md** for interpreting profiler output and identifying optimization opportunities.\n\n> **Tip:** Profiling frequently is strongly recommended. Without profiler data, optimization changes are guesses. Try using other `nsys stats` commands as needed.\n\n### Step 2: Implement One Targeted Change\n\nBased on profiling insights (or optimization patterns from the reference), make **one targeted change** to the RapidsUDF implementation. Isolating changes one at a time makes it possible to attribute performance impact.\n\n### Step 3: Run Unit Tests\n\n```bash\nmvn test -Dsuites=com.udf.CudfComparisonTest\n```\n\n- **Tests pass** &rarr; proceed to Step 4\n- **Tests fail** &rarr; analyze the failure. If it is an ordinary implementation bug, fix it and rerun the test. If the targeted optimization introduces a CPU\u002FGPU semantic mismatch that cannot be resolved, discard changes by restoring from backup:\n  ```bash\n  cp src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>.bak \\\n     src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>\n  ```\n  Log the failure reason, then return to Step 1.\n\nSometimes, matching a certain edge case is impossible without a major performance tradeoff. If so, document the attempted fix, the benchmark evidence, and the exact behavior difference, then ask the user whether the performance-vs-correctness tradeoff is acceptable.\nDo not comment out tests or accept a correctness difference during optimization unless the user explicitly approves that tradeoff.\n\n### Step 4: Run Microbenchmarks\n\n```bash\n.\u002Frun_micro_benchmark.sh --mode all --data-path data\u002Fbench_data_\u003Crows>_rows.parquet --rows \u003Crows>\n```\n\nCompare the GPU time against the current best (from the last checkpoint).\n\n- **Performance improved** &rarr; create a new checkpoint:\n  ```bash\n  cp src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala> \\\n     src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>.bak\n  ```\n  Record the new best GPU time. Reset the consecutive-failure counter. Return to Step 1.\n\n- **Performance did NOT improve** &rarr; discard changes:\n  ```bash\n  cp src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>.bak \\\n     src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>\n  ```\n  Increment the consecutive-failure counter. Return to Step 1.\n\n## Final Step 1: Run Judge Subagent If Requested\n\nIf the user explicitly asked for the judge, a judge subagent, or a review agent, treat that as an explicit request for delegation: you **MUST** launch a separate subagent with `model: inherit` and instruct it to use the **udf-judge-conversion** skill. Ask it to review the `UnitTest`, `CudfComparisonTest`, optimized RapidsUDF implementation, and optimization log as a cuDF conversion.\n\nIf the user did not request a judge\u002Freview agent, mark this step as skipped and continue to Final Step 2. If a required judge subagent is blocked by tool policy, stop and tell the user that explicit permission\u002Finstruction is needed.\n\nIf you run the judge, include the judge verdict in the final report. If there are any blocking issues, fix them or report the last known-good checkpoint.\n\n## Final Step 2: Review Optimized Implementation and Report Results\n\nAfter completing all iterations (or early-stopping), review your own work to ensure the optimization did not weaken correctness, introduce hardcoded test behavior, hide CPU fallback logic, or comment out core test coverage.\n\nAfter completing all iterations (or early-stopping), report:\n1. **Baseline**: starting GPU time and speedup\n2. **Final**: best GPU time and speedup (from the last checkpoint)\n3. **Successful optimizations**: what changes improved performance and by how much\n4. **Failed optimizations**: what was attempted but did not help\n5. **Review result**: self-review summary, or judge PASS\u002Ffailures if the judge was requested\n\n## Output\n\nUpon successful completion:\n- Optimized RapidsUDF: `src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>`\n- Backup of best version: `src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>.bak`\n- Original unoptimized version: `src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>.orig.bak`\n- Benchmark results: `results\u002F`\n",{"data":39,"body":43},{"name":4,"description":6,"license":26,"metadata":40,"model":42},{"spdx-file-copyright-text":41},"Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.","inherit",{"type":44,"children":45},"root",[46,55,62,149,155,181,204,234,240,249,382,398,508,513,522,603,608,614,633,645,652,657,733,738,816,828,849,855,867,873,898,1038,1043,1049,1118,1123,1377,1383,1426,1431,1436,1442,1447,1452,1505,1511,1516,1563],{"type":47,"tag":48,"props":49,"children":51},"element","h1",{"id":50},"optimize-cudf-rapidsudf",[52],{"type":53,"value":54},"text","Optimize cuDF RapidsUDF",{"type":47,"tag":56,"props":57,"children":59},"h2",{"id":58},"workflow",[60],{"type":53,"value":61},"Workflow",{"type":47,"tag":63,"props":64,"children":67},"ul",{"className":65},[66],"contains-task-list",[68,82,131,140],{"type":47,"tag":69,"props":70,"children":73},"li",{"className":71},[72],"task-list-item",[74,80],{"type":47,"tag":75,"props":76,"children":79},"input",{"disabled":77,"type":78},true,"checkbox",[],{"type":53,"value":81}," Step 0: Create backup and establish baseline",{"type":47,"tag":69,"props":83,"children":85},{"className":84},[72],[86,89,91],{"type":47,"tag":75,"props":87,"children":88},{"disabled":77,"type":78},[],{"type":53,"value":90}," Steps 1-4: Iterative optimization loop (repeat up to N iterations)\n",{"type":47,"tag":63,"props":92,"children":94},{"className":93},[66],[95,104,113,122],{"type":47,"tag":69,"props":96,"children":98},{"className":97},[72],[99,102],{"type":47,"tag":75,"props":100,"children":101},{"disabled":77,"type":78},[],{"type":53,"value":103}," Step 1: Profile with nsys",{"type":47,"tag":69,"props":105,"children":107},{"className":106},[72],[108,111],{"type":47,"tag":75,"props":109,"children":110},{"disabled":77,"type":78},[],{"type":53,"value":112}," Step 2: Implement one targeted change",{"type":47,"tag":69,"props":114,"children":116},{"className":115},[72],[117,120],{"type":47,"tag":75,"props":118,"children":119},{"disabled":77,"type":78},[],{"type":53,"value":121}," Step 3: Run unit tests (fail → discard, retry)",{"type":47,"tag":69,"props":123,"children":125},{"className":124},[72],[126,129],{"type":47,"tag":75,"props":127,"children":128},{"disabled":77,"type":78},[],{"type":53,"value":130}," Step 4: Run microbenchmarks (no improvement → discard, retry)",{"type":47,"tag":69,"props":132,"children":134},{"className":133},[72],[135,138],{"type":47,"tag":75,"props":136,"children":137},{"disabled":77,"type":78},[],{"type":53,"value":139}," Final Step 1: Run judge subagent if requested",{"type":47,"tag":69,"props":141,"children":143},{"className":142},[72],[144,147],{"type":47,"tag":75,"props":145,"children":146},{"disabled":77,"type":78},[],{"type":53,"value":148}," Final Step 2: Review optimized implementation and report results",{"type":47,"tag":56,"props":150,"children":152},{"id":151},"prerequisites",[153],{"type":53,"value":154},"Prerequisites",{"type":47,"tag":63,"props":156,"children":157},{},[158,163,176],{"type":47,"tag":69,"props":159,"children":160},{},[161],{"type":53,"value":162},"Project directory with passing unit tests and cuDF comparison test",{"type":47,"tag":69,"props":164,"children":165},{},[166,168,174],{"type":53,"value":167},"MicroBenchRunner implemented and working (from the ",{"type":47,"tag":169,"props":170,"children":171},"strong",{},[172],{"type":53,"value":173},"udf-benchmark",{"type":53,"value":175}," skill)",{"type":47,"tag":69,"props":177,"children":178},{},[179],{"type":53,"value":180},"Benchmark data generated (reuse from the benchmark step)",{"type":47,"tag":182,"props":183,"children":184},"p",{},[185,187,194,196,202],{"type":53,"value":186},"Derive ",{"type":47,"tag":188,"props":189,"children":191},"code",{"className":190},[],[192],{"type":53,"value":193},"\u003CCamelName>",{"type":53,"value":195}," and ",{"type":47,"tag":188,"props":197,"children":199},{"className":198},[],[200],{"type":53,"value":201},"\u003Csnake_name>",{"type":53,"value":203}," from the UDF class name.",{"type":47,"tag":205,"props":206,"children":207},"blockquote",{},[208],{"type":47,"tag":182,"props":209,"children":210},{},[211,216,218,224,226,232],{"type":47,"tag":169,"props":212,"children":213},{},[214],{"type":53,"value":215},"Note:",{"type":53,"value":217}," Commands require access to ",{"type":47,"tag":188,"props":219,"children":221},{"className":220},[],[222],{"type":53,"value":223},"\u002Ftmp",{"type":53,"value":225}," (Spark temp storage) and ",{"type":47,"tag":188,"props":227,"children":229},{"className":228},[],[230],{"type":53,"value":231},"\u002Fdev",{"type":53,"value":233}," (GPU device). If commands fail due to sandbox restrictions, re-run them unsandboxed.",{"type":47,"tag":56,"props":235,"children":237},{"id":236},"step-0-create-backup-and-establish-baseline",[238],{"type":53,"value":239},"Step 0: Create Backup and Establish Baseline",{"type":47,"tag":241,"props":242,"children":243},"ol",{},[244],{"type":47,"tag":69,"props":245,"children":246},{},[247],{"type":53,"value":248},"Create a backup of the current RapidsUDF implementation:",{"type":47,"tag":250,"props":251,"children":256},"pre",{"className":252,"code":253,"language":254,"meta":255,"style":255},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","cp src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala> \\\n   src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>.bak\n","bash","",[257],{"type":47,"tag":188,"props":258,"children":259},{"__ignoreMap":255},[260,328],{"type":47,"tag":261,"props":262,"children":265},"span",{"class":263,"line":264},"line",1,[266,272,278,284,289,294,299,305,310,315,319,323],{"type":47,"tag":261,"props":267,"children":269},{"style":268},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[270],{"type":53,"value":271},"cp",{"type":47,"tag":261,"props":273,"children":275},{"style":274},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[276],{"type":53,"value":277}," src\u002Fmain\u002F",{"type":47,"tag":261,"props":279,"children":281},{"style":280},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[282],{"type":53,"value":283},"\u003C",{"type":47,"tag":261,"props":285,"children":286},{"style":274},[287],{"type":53,"value":288},"java",{"type":47,"tag":261,"props":290,"children":291},{"style":280},[292],{"type":53,"value":293},"|",{"type":47,"tag":261,"props":295,"children":296},{"style":268},[297],{"type":53,"value":298},"scala",{"type":47,"tag":261,"props":300,"children":302},{"style":301},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[303],{"type":53,"value":304},">",{"type":47,"tag":261,"props":306,"children":307},{"style":274},[308],{"type":53,"value":309},"\u002Fcom\u002Fudf\u002F",{"type":47,"tag":261,"props":311,"children":312},{"style":301},[313],{"type":53,"value":314},"\u003CCamelName>RapidsUDF.\u003Cjava",{"type":47,"tag":261,"props":316,"children":317},{"style":280},[318],{"type":53,"value":293},{"type":47,"tag":261,"props":320,"children":321},{"style":268},[322],{"type":53,"value":298},{"type":47,"tag":261,"props":324,"children":325},{"style":301},[326],{"type":53,"value":327},"> \\\n",{"type":47,"tag":261,"props":329,"children":331},{"class":263,"line":330},2,[332,337,341,345,349,353,357,361,365,369,373,377],{"type":47,"tag":261,"props":333,"children":334},{"style":274},[335],{"type":53,"value":336},"   src\u002Fmain\u002F",{"type":47,"tag":261,"props":338,"children":339},{"style":280},[340],{"type":53,"value":283},{"type":47,"tag":261,"props":342,"children":343},{"style":274},[344],{"type":53,"value":288},{"type":47,"tag":261,"props":346,"children":347},{"style":280},[348],{"type":53,"value":293},{"type":47,"tag":261,"props":350,"children":351},{"style":268},[352],{"type":53,"value":298},{"type":47,"tag":261,"props":354,"children":355},{"style":301},[356],{"type":53,"value":304},{"type":47,"tag":261,"props":358,"children":359},{"style":274},[360],{"type":53,"value":309},{"type":47,"tag":261,"props":362,"children":363},{"style":301},[364],{"type":53,"value":314},{"type":47,"tag":261,"props":366,"children":367},{"style":280},[368],{"type":53,"value":293},{"type":47,"tag":261,"props":370,"children":371},{"style":268},[372],{"type":53,"value":298},{"type":47,"tag":261,"props":374,"children":375},{"style":301},[376],{"type":53,"value":304},{"type":47,"tag":261,"props":378,"children":379},{"style":274},[380],{"type":53,"value":381},".bak\n",{"type":47,"tag":241,"props":383,"children":384},{"start":330},[385],{"type":47,"tag":69,"props":386,"children":387},{},[388,390,396],{"type":53,"value":389},"If no ",{"type":47,"tag":188,"props":391,"children":393},{"className":392},[],[394],{"type":53,"value":395},".orig.bak",{"type":53,"value":397}," exists yet, save the original unoptimized implementation:",{"type":47,"tag":250,"props":399,"children":401},{"className":252,"code":400,"language":254,"meta":255,"style":255},"cp src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala> \\\n   src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>.orig.bak\n",[402],{"type":47,"tag":188,"props":403,"children":404},{"__ignoreMap":255},[405,456],{"type":47,"tag":261,"props":406,"children":407},{"class":263,"line":264},[408,412,416,420,424,428,432,436,440,444,448,452],{"type":47,"tag":261,"props":409,"children":410},{"style":268},[411],{"type":53,"value":271},{"type":47,"tag":261,"props":413,"children":414},{"style":274},[415],{"type":53,"value":277},{"type":47,"tag":261,"props":417,"children":418},{"style":280},[419],{"type":53,"value":283},{"type":47,"tag":261,"props":421,"children":422},{"style":274},[423],{"type":53,"value":288},{"type":47,"tag":261,"props":425,"children":426},{"style":280},[427],{"type":53,"value":293},{"type":47,"tag":261,"props":429,"children":430},{"style":268},[431],{"type":53,"value":298},{"type":47,"tag":261,"props":433,"children":434},{"style":301},[435],{"type":53,"value":304},{"type":47,"tag":261,"props":437,"children":438},{"style":274},[439],{"type":53,"value":309},{"type":47,"tag":261,"props":441,"children":442},{"style":301},[443],{"type":53,"value":314},{"type":47,"tag":261,"props":445,"children":446},{"style":280},[447],{"type":53,"value":293},{"type":47,"tag":261,"props":449,"children":450},{"style":268},[451],{"type":53,"value":298},{"type":47,"tag":261,"props":453,"children":454},{"style":301},[455],{"type":53,"value":327},{"type":47,"tag":261,"props":457,"children":458},{"class":263,"line":330},[459,463,467,471,475,479,483,487,491,495,499,503],{"type":47,"tag":261,"props":460,"children":461},{"style":274},[462],{"type":53,"value":336},{"type":47,"tag":261,"props":464,"children":465},{"style":280},[466],{"type":53,"value":283},{"type":47,"tag":261,"props":468,"children":469},{"style":274},[470],{"type":53,"value":288},{"type":47,"tag":261,"props":472,"children":473},{"style":280},[474],{"type":53,"value":293},{"type":47,"tag":261,"props":476,"children":477},{"style":268},[478],{"type":53,"value":298},{"type":47,"tag":261,"props":480,"children":481},{"style":301},[482],{"type":53,"value":304},{"type":47,"tag":261,"props":484,"children":485},{"style":274},[486],{"type":53,"value":309},{"type":47,"tag":261,"props":488,"children":489},{"style":301},[490],{"type":53,"value":314},{"type":47,"tag":261,"props":492,"children":493},{"style":280},[494],{"type":53,"value":293},{"type":47,"tag":261,"props":496,"children":497},{"style":268},[498],{"type":53,"value":298},{"type":47,"tag":261,"props":500,"children":501},{"style":301},[502],{"type":53,"value":304},{"type":47,"tag":261,"props":504,"children":505},{"style":274},[506],{"type":53,"value":507},".orig.bak\n",{"type":47,"tag":182,"props":509,"children":510},{},[511],{"type":53,"value":512},"This file is never overwritten; it preserves the pre-optimization baseline.",{"type":47,"tag":241,"props":514,"children":516},{"start":515},3,[517],{"type":47,"tag":69,"props":518,"children":519},{},[520],{"type":53,"value":521},"If no baseline microbenchmark results exist, run the baseline now:",{"type":47,"tag":250,"props":523,"children":525},{"className":252,"code":524,"language":254,"meta":255,"style":255},".\u002Frun_micro_benchmark.sh --mode all --data-path data\u002Fbench_data_\u003Crows>_rows.parquet --rows \u003Crows>\n",[526],{"type":47,"tag":188,"props":527,"children":528},{"__ignoreMap":255},[529],{"type":47,"tag":261,"props":530,"children":531},{"class":263,"line":264},[532,537,542,547,552,557,561,566,571,575,580,585,590,594,598],{"type":47,"tag":261,"props":533,"children":534},{"style":268},[535],{"type":53,"value":536},".\u002Frun_micro_benchmark.sh",{"type":47,"tag":261,"props":538,"children":539},{"style":274},[540],{"type":53,"value":541}," --mode",{"type":47,"tag":261,"props":543,"children":544},{"style":274},[545],{"type":53,"value":546}," all",{"type":47,"tag":261,"props":548,"children":549},{"style":274},[550],{"type":53,"value":551}," --data-path",{"type":47,"tag":261,"props":553,"children":554},{"style":274},[555],{"type":53,"value":556}," data\u002Fbench_data_",{"type":47,"tag":261,"props":558,"children":559},{"style":280},[560],{"type":53,"value":283},{"type":47,"tag":261,"props":562,"children":563},{"style":274},[564],{"type":53,"value":565},"row",{"type":47,"tag":261,"props":567,"children":568},{"style":301},[569],{"type":53,"value":570},"s",{"type":47,"tag":261,"props":572,"children":573},{"style":280},[574],{"type":53,"value":304},{"type":47,"tag":261,"props":576,"children":577},{"style":274},[578],{"type":53,"value":579},"_rows.parquet",{"type":47,"tag":261,"props":581,"children":582},{"style":274},[583],{"type":53,"value":584}," --rows",{"type":47,"tag":261,"props":586,"children":587},{"style":280},[588],{"type":53,"value":589}," \u003C",{"type":47,"tag":261,"props":591,"children":592},{"style":274},[593],{"type":53,"value":565},{"type":47,"tag":261,"props":595,"children":596},{"style":301},[597],{"type":53,"value":570},{"type":47,"tag":261,"props":599,"children":600},{"style":280},[601],{"type":53,"value":602},">\n",{"type":47,"tag":182,"props":604,"children":605},{},[606],{"type":53,"value":607},"Record the baseline GPU time and speedup. This is the number to beat.",{"type":47,"tag":56,"props":609,"children":611},{"id":610},"iterative-optimization-loop",[612],{"type":53,"value":613},"Iterative Optimization Loop",{"type":47,"tag":182,"props":615,"children":616},{},[617,619,624,626,631],{"type":53,"value":618},"Repeat the following steps up to ",{"type":47,"tag":169,"props":620,"children":621},{},[622],{"type":53,"value":623},"N iterations",{"type":53,"value":625}," (default: 10). Also stop early if no improvement is found after ",{"type":47,"tag":169,"props":627,"children":628},{},[629],{"type":53,"value":630},"3 consecutive failed attempts",{"type":53,"value":632},".",{"type":47,"tag":182,"props":634,"children":635},{},[636,638,643],{"type":53,"value":637},"Maintain an ",{"type":47,"tag":169,"props":639,"children":640},{},[641],{"type":53,"value":642},"optimization log",{"type":53,"value":644}," throughout the loop: for each iteration, record what change was attempted and whether it improved, regressed, or had no effect. This prevents repeating failed approaches and feeds the final report.",{"type":47,"tag":646,"props":647,"children":649},"h3",{"id":648},"step-1-profile-with-nsys",[650],{"type":53,"value":651},"Step 1: Profile with nsys",{"type":47,"tag":182,"props":653,"children":654},{},[655],{"type":53,"value":656},"Profile the current implementation to identify bottlenecks:",{"type":47,"tag":250,"props":658,"children":660},{"className":252,"code":659,"language":254,"meta":255,"style":255},".\u002Frun_micro_benchmark.sh --mode gpu --data-path data\u002Fbench_data_\u003Crows>_rows.parquet --rows \u003Crows> --profile\n",[661],{"type":47,"tag":188,"props":662,"children":663},{"__ignoreMap":255},[664],{"type":47,"tag":261,"props":665,"children":666},{"class":263,"line":264},[667,671,675,680,684,688,692,696,700,704,708,712,716,720,724,728],{"type":47,"tag":261,"props":668,"children":669},{"style":268},[670],{"type":53,"value":536},{"type":47,"tag":261,"props":672,"children":673},{"style":274},[674],{"type":53,"value":541},{"type":47,"tag":261,"props":676,"children":677},{"style":274},[678],{"type":53,"value":679}," gpu",{"type":47,"tag":261,"props":681,"children":682},{"style":274},[683],{"type":53,"value":551},{"type":47,"tag":261,"props":685,"children":686},{"style":274},[687],{"type":53,"value":556},{"type":47,"tag":261,"props":689,"children":690},{"style":280},[691],{"type":53,"value":283},{"type":47,"tag":261,"props":693,"children":694},{"style":274},[695],{"type":53,"value":565},{"type":47,"tag":261,"props":697,"children":698},{"style":301},[699],{"type":53,"value":570},{"type":47,"tag":261,"props":701,"children":702},{"style":280},[703],{"type":53,"value":304},{"type":47,"tag":261,"props":705,"children":706},{"style":274},[707],{"type":53,"value":579},{"type":47,"tag":261,"props":709,"children":710},{"style":274},[711],{"type":53,"value":584},{"type":47,"tag":261,"props":713,"children":714},{"style":280},[715],{"type":53,"value":589},{"type":47,"tag":261,"props":717,"children":718},{"style":274},[719],{"type":53,"value":565},{"type":47,"tag":261,"props":721,"children":722},{"style":301},[723],{"type":53,"value":570},{"type":47,"tag":261,"props":725,"children":726},{"style":280},[727],{"type":53,"value":304},{"type":47,"tag":261,"props":729,"children":730},{"style":274},[731],{"type":53,"value":732}," --profile\n",{"type":47,"tag":182,"props":734,"children":735},{},[736],{"type":53,"value":737},"Summarize libcudf kernel stats:",{"type":47,"tag":250,"props":739,"children":741},{"className":252,"code":740,"language":254,"meta":255,"style":255},"nsys stats --report nvtx_sum --format csv -o rapidsudf results\u002F\u003Creport>.nsys-rep\n",[742],{"type":47,"tag":188,"props":743,"children":744},{"__ignoreMap":255},[745],{"type":47,"tag":261,"props":746,"children":747},{"class":263,"line":264},[748,753,758,763,768,773,778,783,788,793,797,802,807,811],{"type":47,"tag":261,"props":749,"children":750},{"style":268},[751],{"type":53,"value":752},"nsys",{"type":47,"tag":261,"props":754,"children":755},{"style":274},[756],{"type":53,"value":757}," stats",{"type":47,"tag":261,"props":759,"children":760},{"style":274},[761],{"type":53,"value":762}," --report",{"type":47,"tag":261,"props":764,"children":765},{"style":274},[766],{"type":53,"value":767}," nvtx_sum",{"type":47,"tag":261,"props":769,"children":770},{"style":274},[771],{"type":53,"value":772}," --format",{"type":47,"tag":261,"props":774,"children":775},{"style":274},[776],{"type":53,"value":777}," csv",{"type":47,"tag":261,"props":779,"children":780},{"style":274},[781],{"type":53,"value":782}," -o",{"type":47,"tag":261,"props":784,"children":785},{"style":274},[786],{"type":53,"value":787}," rapidsudf",{"type":47,"tag":261,"props":789,"children":790},{"style":274},[791],{"type":53,"value":792}," results\u002F",{"type":47,"tag":261,"props":794,"children":795},{"style":280},[796],{"type":53,"value":283},{"type":47,"tag":261,"props":798,"children":799},{"style":274},[800],{"type":53,"value":801},"repor",{"type":47,"tag":261,"props":803,"children":804},{"style":301},[805],{"type":53,"value":806},"t",{"type":47,"tag":261,"props":808,"children":809},{"style":280},[810],{"type":53,"value":304},{"type":47,"tag":261,"props":812,"children":813},{"style":274},[814],{"type":53,"value":815},".nsys-rep\n",{"type":47,"tag":182,"props":817,"children":818},{},[819,821,826],{"type":53,"value":820},"Consult ",{"type":47,"tag":169,"props":822,"children":823},{},[824],{"type":53,"value":825},"references\u002FOPTIMIZATION_PATTERNS.md",{"type":53,"value":827}," for interpreting profiler output and identifying optimization opportunities.",{"type":47,"tag":205,"props":829,"children":830},{},[831],{"type":47,"tag":182,"props":832,"children":833},{},[834,839,841,847],{"type":47,"tag":169,"props":835,"children":836},{},[837],{"type":53,"value":838},"Tip:",{"type":53,"value":840}," Profiling frequently is strongly recommended. Without profiler data, optimization changes are guesses. Try using other ",{"type":47,"tag":188,"props":842,"children":844},{"className":843},[],[845],{"type":53,"value":846},"nsys stats",{"type":53,"value":848}," commands as needed.",{"type":47,"tag":646,"props":850,"children":852},{"id":851},"step-2-implement-one-targeted-change",[853],{"type":53,"value":854},"Step 2: Implement One Targeted Change",{"type":47,"tag":182,"props":856,"children":857},{},[858,860,865],{"type":53,"value":859},"Based on profiling insights (or optimization patterns from the reference), make ",{"type":47,"tag":169,"props":861,"children":862},{},[863],{"type":53,"value":864},"one targeted change",{"type":53,"value":866}," to the RapidsUDF implementation. Isolating changes one at a time makes it possible to attribute performance impact.",{"type":47,"tag":646,"props":868,"children":870},{"id":869},"step-3-run-unit-tests",[871],{"type":53,"value":872},"Step 3: Run Unit Tests",{"type":47,"tag":250,"props":874,"children":876},{"className":252,"code":875,"language":254,"meta":255,"style":255},"mvn test -Dsuites=com.udf.CudfComparisonTest\n",[877],{"type":47,"tag":188,"props":878,"children":879},{"__ignoreMap":255},[880],{"type":47,"tag":261,"props":881,"children":882},{"class":263,"line":264},[883,888,893],{"type":47,"tag":261,"props":884,"children":885},{"style":268},[886],{"type":53,"value":887},"mvn",{"type":47,"tag":261,"props":889,"children":890},{"style":274},[891],{"type":53,"value":892}," test",{"type":47,"tag":261,"props":894,"children":895},{"style":274},[896],{"type":53,"value":897}," -Dsuites=com.udf.CudfComparisonTest\n",{"type":47,"tag":63,"props":899,"children":900},{},[901,911],{"type":47,"tag":69,"props":902,"children":903},{},[904,909],{"type":47,"tag":169,"props":905,"children":906},{},[907],{"type":53,"value":908},"Tests pass",{"type":53,"value":910}," → proceed to Step 4",{"type":47,"tag":69,"props":912,"children":913},{},[914,919,921,1036],{"type":47,"tag":169,"props":915,"children":916},{},[917],{"type":53,"value":918},"Tests fail",{"type":53,"value":920}," → analyze the failure. If it is an ordinary implementation bug, fix it and rerun the test. If the targeted optimization introduces a CPU\u002FGPU semantic mismatch that cannot be resolved, discard changes by restoring from backup:\n",{"type":47,"tag":250,"props":922,"children":924},{"className":252,"code":923,"language":254,"meta":255,"style":255},"cp src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>.bak \\\n   src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>\n",[925],{"type":47,"tag":188,"props":926,"children":927},{"__ignoreMap":255},[928,989],{"type":47,"tag":261,"props":929,"children":930},{"class":263,"line":264},[931,935,939,943,947,951,955,959,963,967,971,975,979,984],{"type":47,"tag":261,"props":932,"children":933},{"style":268},[934],{"type":53,"value":271},{"type":47,"tag":261,"props":936,"children":937},{"style":274},[938],{"type":53,"value":277},{"type":47,"tag":261,"props":940,"children":941},{"style":280},[942],{"type":53,"value":283},{"type":47,"tag":261,"props":944,"children":945},{"style":274},[946],{"type":53,"value":288},{"type":47,"tag":261,"props":948,"children":949},{"style":280},[950],{"type":53,"value":293},{"type":47,"tag":261,"props":952,"children":953},{"style":268},[954],{"type":53,"value":298},{"type":47,"tag":261,"props":956,"children":957},{"style":301},[958],{"type":53,"value":304},{"type":47,"tag":261,"props":960,"children":961},{"style":274},[962],{"type":53,"value":309},{"type":47,"tag":261,"props":964,"children":965},{"style":301},[966],{"type":53,"value":314},{"type":47,"tag":261,"props":968,"children":969},{"style":280},[970],{"type":53,"value":293},{"type":47,"tag":261,"props":972,"children":973},{"style":268},[974],{"type":53,"value":298},{"type":47,"tag":261,"props":976,"children":977},{"style":301},[978],{"type":53,"value":304},{"type":47,"tag":261,"props":980,"children":981},{"style":274},[982],{"type":53,"value":983},".bak",{"type":47,"tag":261,"props":985,"children":986},{"style":301},[987],{"type":53,"value":988}," \\\n",{"type":47,"tag":261,"props":990,"children":991},{"class":263,"line":330},[992,996,1000,1004,1008,1012,1016,1020,1024,1028,1032],{"type":47,"tag":261,"props":993,"children":994},{"style":274},[995],{"type":53,"value":336},{"type":47,"tag":261,"props":997,"children":998},{"style":280},[999],{"type":53,"value":283},{"type":47,"tag":261,"props":1001,"children":1002},{"style":274},[1003],{"type":53,"value":288},{"type":47,"tag":261,"props":1005,"children":1006},{"style":280},[1007],{"type":53,"value":293},{"type":47,"tag":261,"props":1009,"children":1010},{"style":268},[1011],{"type":53,"value":298},{"type":47,"tag":261,"props":1013,"children":1014},{"style":301},[1015],{"type":53,"value":304},{"type":47,"tag":261,"props":1017,"children":1018},{"style":274},[1019],{"type":53,"value":309},{"type":47,"tag":261,"props":1021,"children":1022},{"style":301},[1023],{"type":53,"value":314},{"type":47,"tag":261,"props":1025,"children":1026},{"style":280},[1027],{"type":53,"value":293},{"type":47,"tag":261,"props":1029,"children":1030},{"style":268},[1031],{"type":53,"value":298},{"type":47,"tag":261,"props":1033,"children":1034},{"style":301},[1035],{"type":53,"value":602},{"type":53,"value":1037},"\nLog the failure reason, then return to Step 1.",{"type":47,"tag":182,"props":1039,"children":1040},{},[1041],{"type":53,"value":1042},"Sometimes, matching a certain edge case is impossible without a major performance tradeoff. If so, document the attempted fix, the benchmark evidence, and the exact behavior difference, then ask the user whether the performance-vs-correctness tradeoff is acceptable.\nDo not comment out tests or accept a correctness difference during optimization unless the user explicitly approves that tradeoff.",{"type":47,"tag":646,"props":1044,"children":1046},{"id":1045},"step-4-run-microbenchmarks",[1047],{"type":53,"value":1048},"Step 4: Run Microbenchmarks",{"type":47,"tag":250,"props":1050,"children":1051},{"className":252,"code":524,"language":254,"meta":255,"style":255},[1052],{"type":47,"tag":188,"props":1053,"children":1054},{"__ignoreMap":255},[1055],{"type":47,"tag":261,"props":1056,"children":1057},{"class":263,"line":264},[1058,1062,1066,1070,1074,1078,1082,1086,1090,1094,1098,1102,1106,1110,1114],{"type":47,"tag":261,"props":1059,"children":1060},{"style":268},[1061],{"type":53,"value":536},{"type":47,"tag":261,"props":1063,"children":1064},{"style":274},[1065],{"type":53,"value":541},{"type":47,"tag":261,"props":1067,"children":1068},{"style":274},[1069],{"type":53,"value":546},{"type":47,"tag":261,"props":1071,"children":1072},{"style":274},[1073],{"type":53,"value":551},{"type":47,"tag":261,"props":1075,"children":1076},{"style":274},[1077],{"type":53,"value":556},{"type":47,"tag":261,"props":1079,"children":1080},{"style":280},[1081],{"type":53,"value":283},{"type":47,"tag":261,"props":1083,"children":1084},{"style":274},[1085],{"type":53,"value":565},{"type":47,"tag":261,"props":1087,"children":1088},{"style":301},[1089],{"type":53,"value":570},{"type":47,"tag":261,"props":1091,"children":1092},{"style":280},[1093],{"type":53,"value":304},{"type":47,"tag":261,"props":1095,"children":1096},{"style":274},[1097],{"type":53,"value":579},{"type":47,"tag":261,"props":1099,"children":1100},{"style":274},[1101],{"type":53,"value":584},{"type":47,"tag":261,"props":1103,"children":1104},{"style":280},[1105],{"type":53,"value":589},{"type":47,"tag":261,"props":1107,"children":1108},{"style":274},[1109],{"type":53,"value":565},{"type":47,"tag":261,"props":1111,"children":1112},{"style":301},[1113],{"type":53,"value":570},{"type":47,"tag":261,"props":1115,"children":1116},{"style":280},[1117],{"type":53,"value":602},{"type":47,"tag":182,"props":1119,"children":1120},{},[1121],{"type":53,"value":1122},"Compare the GPU time against the current best (from the last checkpoint).",{"type":47,"tag":63,"props":1124,"children":1125},{},[1126,1250],{"type":47,"tag":69,"props":1127,"children":1128},{},[1129,1134,1136,1244,1248],{"type":47,"tag":169,"props":1130,"children":1131},{},[1132],{"type":53,"value":1133},"Performance improved",{"type":53,"value":1135}," → create a new checkpoint:",{"type":47,"tag":250,"props":1137,"children":1138},{"className":252,"code":253,"language":254,"meta":255,"style":255},[1139],{"type":47,"tag":188,"props":1140,"children":1141},{"__ignoreMap":255},[1142,1193],{"type":47,"tag":261,"props":1143,"children":1144},{"class":263,"line":264},[1145,1149,1153,1157,1161,1165,1169,1173,1177,1181,1185,1189],{"type":47,"tag":261,"props":1146,"children":1147},{"style":268},[1148],{"type":53,"value":271},{"type":47,"tag":261,"props":1150,"children":1151},{"style":274},[1152],{"type":53,"value":277},{"type":47,"tag":261,"props":1154,"children":1155},{"style":280},[1156],{"type":53,"value":283},{"type":47,"tag":261,"props":1158,"children":1159},{"style":274},[1160],{"type":53,"value":288},{"type":47,"tag":261,"props":1162,"children":1163},{"style":280},[1164],{"type":53,"value":293},{"type":47,"tag":261,"props":1166,"children":1167},{"style":268},[1168],{"type":53,"value":298},{"type":47,"tag":261,"props":1170,"children":1171},{"style":301},[1172],{"type":53,"value":304},{"type":47,"tag":261,"props":1174,"children":1175},{"style":274},[1176],{"type":53,"value":309},{"type":47,"tag":261,"props":1178,"children":1179},{"style":301},[1180],{"type":53,"value":314},{"type":47,"tag":261,"props":1182,"children":1183},{"style":280},[1184],{"type":53,"value":293},{"type":47,"tag":261,"props":1186,"children":1187},{"style":268},[1188],{"type":53,"value":298},{"type":47,"tag":261,"props":1190,"children":1191},{"style":301},[1192],{"type":53,"value":327},{"type":47,"tag":261,"props":1194,"children":1195},{"class":263,"line":330},[1196,1200,1204,1208,1212,1216,1220,1224,1228,1232,1236,1240],{"type":47,"tag":261,"props":1197,"children":1198},{"style":274},[1199],{"type":53,"value":336},{"type":47,"tag":261,"props":1201,"children":1202},{"style":280},[1203],{"type":53,"value":283},{"type":47,"tag":261,"props":1205,"children":1206},{"style":274},[1207],{"type":53,"value":288},{"type":47,"tag":261,"props":1209,"children":1210},{"style":280},[1211],{"type":53,"value":293},{"type":47,"tag":261,"props":1213,"children":1214},{"style":268},[1215],{"type":53,"value":298},{"type":47,"tag":261,"props":1217,"children":1218},{"style":301},[1219],{"type":53,"value":304},{"type":47,"tag":261,"props":1221,"children":1222},{"style":274},[1223],{"type":53,"value":309},{"type":47,"tag":261,"props":1225,"children":1226},{"style":301},[1227],{"type":53,"value":314},{"type":47,"tag":261,"props":1229,"children":1230},{"style":280},[1231],{"type":53,"value":293},{"type":47,"tag":261,"props":1233,"children":1234},{"style":268},[1235],{"type":53,"value":298},{"type":47,"tag":261,"props":1237,"children":1238},{"style":301},[1239],{"type":53,"value":304},{"type":47,"tag":261,"props":1241,"children":1242},{"style":274},[1243],{"type":53,"value":381},{"type":47,"tag":1245,"props":1246,"children":1247},"br",{},[],{"type":53,"value":1249},"Record the new best GPU time. Reset the consecutive-failure counter. Return to Step 1.",{"type":47,"tag":69,"props":1251,"children":1252},{},[1253,1258,1260,1372,1375],{"type":47,"tag":169,"props":1254,"children":1255},{},[1256],{"type":53,"value":1257},"Performance did NOT improve",{"type":53,"value":1259}," → discard changes:",{"type":47,"tag":250,"props":1261,"children":1262},{"className":252,"code":923,"language":254,"meta":255,"style":255},[1263],{"type":47,"tag":188,"props":1264,"children":1265},{"__ignoreMap":255},[1266,1325],{"type":47,"tag":261,"props":1267,"children":1268},{"class":263,"line":264},[1269,1273,1277,1281,1285,1289,1293,1297,1301,1305,1309,1313,1317,1321],{"type":47,"tag":261,"props":1270,"children":1271},{"style":268},[1272],{"type":53,"value":271},{"type":47,"tag":261,"props":1274,"children":1275},{"style":274},[1276],{"type":53,"value":277},{"type":47,"tag":261,"props":1278,"children":1279},{"style":280},[1280],{"type":53,"value":283},{"type":47,"tag":261,"props":1282,"children":1283},{"style":274},[1284],{"type":53,"value":288},{"type":47,"tag":261,"props":1286,"children":1287},{"style":280},[1288],{"type":53,"value":293},{"type":47,"tag":261,"props":1290,"children":1291},{"style":268},[1292],{"type":53,"value":298},{"type":47,"tag":261,"props":1294,"children":1295},{"style":301},[1296],{"type":53,"value":304},{"type":47,"tag":261,"props":1298,"children":1299},{"style":274},[1300],{"type":53,"value":309},{"type":47,"tag":261,"props":1302,"children":1303},{"style":301},[1304],{"type":53,"value":314},{"type":47,"tag":261,"props":1306,"children":1307},{"style":280},[1308],{"type":53,"value":293},{"type":47,"tag":261,"props":1310,"children":1311},{"style":268},[1312],{"type":53,"value":298},{"type":47,"tag":261,"props":1314,"children":1315},{"style":301},[1316],{"type":53,"value":304},{"type":47,"tag":261,"props":1318,"children":1319},{"style":274},[1320],{"type":53,"value":983},{"type":47,"tag":261,"props":1322,"children":1323},{"style":301},[1324],{"type":53,"value":988},{"type":47,"tag":261,"props":1326,"children":1327},{"class":263,"line":330},[1328,1332,1336,1340,1344,1348,1352,1356,1360,1364,1368],{"type":47,"tag":261,"props":1329,"children":1330},{"style":274},[1331],{"type":53,"value":336},{"type":47,"tag":261,"props":1333,"children":1334},{"style":280},[1335],{"type":53,"value":283},{"type":47,"tag":261,"props":1337,"children":1338},{"style":274},[1339],{"type":53,"value":288},{"type":47,"tag":261,"props":1341,"children":1342},{"style":280},[1343],{"type":53,"value":293},{"type":47,"tag":261,"props":1345,"children":1346},{"style":268},[1347],{"type":53,"value":298},{"type":47,"tag":261,"props":1349,"children":1350},{"style":301},[1351],{"type":53,"value":304},{"type":47,"tag":261,"props":1353,"children":1354},{"style":274},[1355],{"type":53,"value":309},{"type":47,"tag":261,"props":1357,"children":1358},{"style":301},[1359],{"type":53,"value":314},{"type":47,"tag":261,"props":1361,"children":1362},{"style":280},[1363],{"type":53,"value":293},{"type":47,"tag":261,"props":1365,"children":1366},{"style":268},[1367],{"type":53,"value":298},{"type":47,"tag":261,"props":1369,"children":1370},{"style":301},[1371],{"type":53,"value":602},{"type":47,"tag":1245,"props":1373,"children":1374},{},[],{"type":53,"value":1376},"Increment the consecutive-failure counter. Return to Step 1.",{"type":47,"tag":56,"props":1378,"children":1380},{"id":1379},"final-step-1-run-judge-subagent-if-requested",[1381],{"type":53,"value":1382},"Final Step 1: Run Judge Subagent If Requested",{"type":47,"tag":182,"props":1384,"children":1385},{},[1386,1388,1393,1395,1401,1403,1408,1410,1416,1418,1424],{"type":53,"value":1387},"If the user explicitly asked for the judge, a judge subagent, or a review agent, treat that as an explicit request for delegation: you ",{"type":47,"tag":169,"props":1389,"children":1390},{},[1391],{"type":53,"value":1392},"MUST",{"type":53,"value":1394}," launch a separate subagent with ",{"type":47,"tag":188,"props":1396,"children":1398},{"className":1397},[],[1399],{"type":53,"value":1400},"model: inherit",{"type":53,"value":1402}," and instruct it to use the ",{"type":47,"tag":169,"props":1404,"children":1405},{},[1406],{"type":53,"value":1407},"udf-judge-conversion",{"type":53,"value":1409}," skill. Ask it to review the ",{"type":47,"tag":188,"props":1411,"children":1413},{"className":1412},[],[1414],{"type":53,"value":1415},"UnitTest",{"type":53,"value":1417},", ",{"type":47,"tag":188,"props":1419,"children":1421},{"className":1420},[],[1422],{"type":53,"value":1423},"CudfComparisonTest",{"type":53,"value":1425},", optimized RapidsUDF implementation, and optimization log as a cuDF conversion.",{"type":47,"tag":182,"props":1427,"children":1428},{},[1429],{"type":53,"value":1430},"If the user did not request a judge\u002Freview agent, mark this step as skipped and continue to Final Step 2. If a required judge subagent is blocked by tool policy, stop and tell the user that explicit permission\u002Finstruction is needed.",{"type":47,"tag":182,"props":1432,"children":1433},{},[1434],{"type":53,"value":1435},"If you run the judge, include the judge verdict in the final report. If there are any blocking issues, fix them or report the last known-good checkpoint.",{"type":47,"tag":56,"props":1437,"children":1439},{"id":1438},"final-step-2-review-optimized-implementation-and-report-results",[1440],{"type":53,"value":1441},"Final Step 2: Review Optimized Implementation and Report Results",{"type":47,"tag":182,"props":1443,"children":1444},{},[1445],{"type":53,"value":1446},"After completing all iterations (or early-stopping), review your own work to ensure the optimization did not weaken correctness, introduce hardcoded test behavior, hide CPU fallback logic, or comment out core test coverage.",{"type":47,"tag":182,"props":1448,"children":1449},{},[1450],{"type":53,"value":1451},"After completing all iterations (or early-stopping), report:",{"type":47,"tag":241,"props":1453,"children":1454},{},[1455,1465,1475,1485,1495],{"type":47,"tag":69,"props":1456,"children":1457},{},[1458,1463],{"type":47,"tag":169,"props":1459,"children":1460},{},[1461],{"type":53,"value":1462},"Baseline",{"type":53,"value":1464},": starting GPU time and speedup",{"type":47,"tag":69,"props":1466,"children":1467},{},[1468,1473],{"type":47,"tag":169,"props":1469,"children":1470},{},[1471],{"type":53,"value":1472},"Final",{"type":53,"value":1474},": best GPU time and speedup (from the last checkpoint)",{"type":47,"tag":69,"props":1476,"children":1477},{},[1478,1483],{"type":47,"tag":169,"props":1479,"children":1480},{},[1481],{"type":53,"value":1482},"Successful optimizations",{"type":53,"value":1484},": what changes improved performance and by how much",{"type":47,"tag":69,"props":1486,"children":1487},{},[1488,1493],{"type":47,"tag":169,"props":1489,"children":1490},{},[1491],{"type":53,"value":1492},"Failed optimizations",{"type":53,"value":1494},": what was attempted but did not help",{"type":47,"tag":69,"props":1496,"children":1497},{},[1498,1503],{"type":47,"tag":169,"props":1499,"children":1500},{},[1501],{"type":53,"value":1502},"Review result",{"type":53,"value":1504},": self-review summary, or judge PASS\u002Ffailures if the judge was requested",{"type":47,"tag":56,"props":1506,"children":1508},{"id":1507},"output",[1509],{"type":53,"value":1510},"Output",{"type":47,"tag":182,"props":1512,"children":1513},{},[1514],{"type":53,"value":1515},"Upon successful completion:",{"type":47,"tag":63,"props":1517,"children":1518},{},[1519,1530,1541,1552],{"type":47,"tag":69,"props":1520,"children":1521},{},[1522,1524],{"type":53,"value":1523},"Optimized RapidsUDF: ",{"type":47,"tag":188,"props":1525,"children":1527},{"className":1526},[],[1528],{"type":53,"value":1529},"src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>",{"type":47,"tag":69,"props":1531,"children":1532},{},[1533,1535],{"type":53,"value":1534},"Backup of best version: ",{"type":47,"tag":188,"props":1536,"children":1538},{"className":1537},[],[1539],{"type":53,"value":1540},"src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>.bak",{"type":47,"tag":69,"props":1542,"children":1543},{},[1544,1546],{"type":53,"value":1545},"Original unoptimized version: ",{"type":47,"tag":188,"props":1547,"children":1549},{"className":1548},[],[1550],{"type":53,"value":1551},"src\u002Fmain\u002F\u003Cjava|scala>\u002Fcom\u002Fudf\u002F\u003CCamelName>RapidsUDF.\u003Cjava|scala>.orig.bak",{"type":47,"tag":69,"props":1553,"children":1554},{},[1555,1557],{"type":53,"value":1556},"Benchmark results: ",{"type":47,"tag":188,"props":1558,"children":1560},{"className":1559},[],[1561],{"type":53,"value":1562},"results\u002F",{"type":47,"tag":1564,"props":1565,"children":1566},"style",{},[1567],{"type":53,"value":1568},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":1570,"total":1652},[1571,1582,1594,1605,1618,1631,1645],{"slug":173,"name":173,"fn":1572,"description":1573,"org":1574,"tags":1575,"stars":23,"repoUrl":24,"updatedAt":1581},"benchmark Spark UDF performance on GPU","Assists with benchmarking and profiling the performance of an Apache Spark UDF on the GPU. This is step 3 of 3 in the UDF conversion workflow (udf-gen-test -> udf-convert-to-* -> udf-benchmark). Use this skill when you have a CPU UDF and a RapidsUDF or SQL implementation, and need to benchmark the performance of the CPU UDF against the GPU implementation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1576,1577,1578,1579],{"name":17,"slug":18,"type":15},{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},{"name":1580,"slug":32,"type":15},"Spark","2026-07-14T05:30:56.546112",{"slug":1583,"name":1583,"fn":1584,"description":1585,"org":1586,"tags":1587,"stars":23,"repoUrl":24,"updatedAt":1593},"udf-convert-to-cuda","convert Spark UDFs to CUDA RapidsUDFs","Assists with converting a non-aggregating Apache Spark UDF to a native CUDA RapidsUDF using JNI and libcudf. This is step 2 of 3 in the UDF conversion workflow (udf-gen-test -> udf-convert-to-cuda -> udf-benchmark). Use this skill when you have a CPU UDF with a unit test and need to convert it to a native CUDA implementation. Prefer udf-convert-to-cudf unless a CUDA implementation is necessary for performance or correctness, or if requested by the user.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1588,1589,1591,1592],{"name":21,"slug":22,"type":15},{"name":1590,"slug":288,"type":15},"Java",{"name":9,"slug":8,"type":15},{"name":1580,"slug":32,"type":15},"2026-07-14T05:30:51.534401",{"slug":1595,"name":1595,"fn":1596,"description":1597,"org":1598,"tags":1599,"stars":23,"repoUrl":24,"updatedAt":1604},"udf-convert-to-cudf","convert Spark UDFs to GPU-accelerated RapidsUDFs","Assists with converting an Apache Spark UDF to a GPU-accelerated RapidsUDF using cuDF Java APIs. This is step 2 of 3 in the UDF conversion workflow (udf-gen-test -> udf-convert-to-cudf -> udf-benchmark). Use this skill when you have a CPU UDF with a unit test and need to convert it to a RapidsUDF.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1600,1601,1602,1603],{"name":21,"slug":22,"type":15},{"name":1590,"slug":288,"type":15},{"name":9,"slug":8,"type":15},{"name":1580,"slug":32,"type":15},"2026-07-14T05:30:54.048693",{"slug":1606,"name":1606,"fn":1607,"description":1608,"org":1609,"tags":1610,"stars":23,"repoUrl":24,"updatedAt":1617},"udf-convert-to-sql","convert Spark UDFs to SQL expressions","Assists with converting an Apache Spark UDF to a functionally equivalent Spark SQL expression. This is step 2 of 3 in the UDF conversion workflow (udf-gen-test -> udf-convert-to-sql -> udf-benchmark). Use this skill when you have a CPU UDF with a unit test and need to convert it to SQL for GPU acceleration.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1611,1612,1613,1614],{"name":21,"slug":22,"type":15},{"name":9,"slug":8,"type":15},{"name":1580,"slug":32,"type":15},{"name":1615,"slug":1616,"type":15},"SQL","sql","2026-07-14T05:30:57.785224",{"slug":1619,"name":1619,"fn":1620,"description":1621,"org":1622,"tags":1623,"stars":23,"repoUrl":24,"updatedAt":1630},"udf-gen-test","generate unit tests for Spark UDFs","Assists with generating a unit test for an Apache Spark UDF. This is step 1 of 3 in the UDF conversion workflow (udf-gen-test -> udf-convert-to-* -> udf-benchmark). Use this skill when you have a CPU UDF and need to create a unit test for the UDF before converting it into a GPU-compatible implementation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1624,1625,1626,1627],{"name":1590,"slug":288,"type":15},{"name":9,"slug":8,"type":15},{"name":1580,"slug":32,"type":15},{"name":1628,"slug":1629,"type":15},"Testing","testing","2026-07-14T05:30:55.30163",{"slug":1407,"name":1407,"fn":1632,"description":1633,"org":1634,"tags":1635,"stars":23,"repoUrl":24,"updatedAt":1644},"review UDF tests and GPU implementations","Reviews generated UDF tests and GPU\u002FSQL implementations for robustness, anti-cheating, and GPU execution integrity. Use when the user requests a judge\u002Freview-agent pass, or when manually reviewing a completed conversion.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1636,1639,1640,1641],{"name":1637,"slug":1638,"type":15},"Code Review","code-review",{"name":21,"slug":22,"type":15},{"name":9,"slug":8,"type":15},{"name":1642,"slug":1643,"type":15},"QA","qa","2026-07-14T05:30:59.022808",{"slug":4,"name":4,"fn":5,"description":6,"org":1646,"tags":1647,"stars":23,"repoUrl":24,"updatedAt":25},{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1648,1649,1650,1651],{"name":17,"slug":18,"type":15},{"name":21,"slug":22,"type":15},{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},7,{"items":1654,"total":1807},[1655,1673,1691,1702,1714,1728,1741,1755,1764,1775,1787,1796],{"slug":1656,"name":1656,"fn":1657,"description":1658,"org":1659,"tags":1660,"stars":1670,"repoUrl":1671,"updatedAt":1672},"nemoclaw-user-guide","retrieve NemoClaw documentation and configuration","Guides human users' AI agents to the NemoClaw docs MCP server and canonical Fern documentation in Markdown form. Use when users ask how to install, configure, operate, troubleshoot, secure, or learn NemoClaw with an AI coding assistant. Trigger keywords - nemoclaw docs, use nemoclaw with ai agent, nemoclaw mcp docs, nemoclaw install help, nemoclaw quickstart, nemoclaw markdown docs, llms.txt, agent skills.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1661,1664,1667],{"name":1662,"slug":1663,"type":15},"Documentation","documentation",{"name":1665,"slug":1666,"type":15},"MCP","mcp",{"name":1668,"slug":1669,"type":15},"Search","search",21777,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002FNemoClaw","2026-07-20T06:00:01.461044",{"slug":1674,"name":1674,"fn":1675,"description":1676,"org":1677,"tags":1678,"stars":1688,"repoUrl":1689,"updatedAt":1690},"mcore-build-and-dependency","manage Megatron-LM development environments","Container-based dev environment setup and dependency management for Megatron-LM. Covers acquiring and launching the CI container, uv package management, and updating uv.lock.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1679,1682,1685],{"name":1680,"slug":1681,"type":15},"Containers","containers",{"name":1683,"slug":1684,"type":15},"Deployment","deployment",{"name":1686,"slug":1687,"type":15},"Python","python",17049,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002FMegatron-LM","2026-07-27T06:06:11.249662",{"slug":1692,"name":1692,"fn":1693,"description":1694,"org":1695,"tags":1696,"stars":1688,"repoUrl":1689,"updatedAt":1701},"mcore-bump-base-image","update NVIDIA PyTorch base images","Bump the NVIDIA PyTorch base image (`nvcr.io\u002Fnvidia\u002Fpytorch:YY.MM-py3`) used by Megatron-LM CI. Covers the two pin sites (GitHub CI in `docker\u002F.ngc_version.dev` and GitLab CI in `.gitlab\u002Fstages\u002F01.build.yml`), the post-bump CI loop (re-run functional tests, refresh golden values, mark broken tests), and the gotchas that bit PRs",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1697,1700],{"name":1698,"slug":1699,"type":15},"CI\u002FCD","ci-cd",{"name":1683,"slug":1684,"type":15},"2026-07-14T05:25:59.97109",{"slug":1703,"name":1703,"fn":1704,"description":1705,"org":1706,"tags":1707,"stars":1688,"repoUrl":1689,"updatedAt":1713},"mcore-cicd","manage CI\u002FCD pipelines for Megatron-LM","CI\u002FCD reference for Megatron-LM. Covers CI pipeline structure, PR scope labels, triggering internal GitLab CI (which force-pushes the current branch to a pull-request\u002FBRANCH ref — always dry-run and verify the destination first; never run against shared or protected branches), and CI failure investigation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1708,1709,1710],{"name":1698,"slug":1699,"type":15},{"name":1683,"slug":1684,"type":15},{"name":1711,"slug":1712,"type":15},"GitHub","github","2026-07-27T06:06:12.278222",{"slug":1715,"name":1715,"fn":1716,"description":1717,"org":1718,"tags":1719,"stars":1688,"repoUrl":1689,"updatedAt":1727},"mcore-create-issue","investigate CI failures and create issues","Investigate a failing GitHub Actions run or job and create a GitHub issue for the failure.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1720,1723,1724],{"name":1721,"slug":1722,"type":15},"Debugging","debugging",{"name":1711,"slug":1712,"type":15},{"name":1725,"slug":1726,"type":15},"Triage","triage","2026-07-14T05:25:57.442089",{"slug":1729,"name":1729,"fn":1730,"description":1731,"org":1732,"tags":1733,"stars":1688,"repoUrl":1689,"updatedAt":1740},"mcore-linting-and-formatting","lint and format Megatron-LM code","Linting and formatting for Megatron-LM. Covers running autoformat.sh, tools (ruff, black, isort, pylint, mypy), and code style rules.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1734,1737],{"name":1735,"slug":1736,"type":15},"Best Practices","best-practices",{"name":1738,"slug":1739,"type":15},"Code Analysis","code-analysis","2026-07-14T05:25:56.18433",{"slug":1742,"name":1742,"fn":1743,"description":1744,"org":1745,"tags":1746,"stars":1688,"repoUrl":1689,"updatedAt":1754},"mcore-migrate-gpt-to-hybrid","migrate Megatron-LM models to HybridModel","Migration guide for moving Megatron Core GPTModel checkpoints, model providers, training commands, and layer mappings to HybridModel.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1747,1750,1753],{"name":1748,"slug":1749,"type":15},"Machine Learning","machine-learning",{"name":1751,"slug":1752,"type":15},"Migration","migration",{"name":9,"slug":8,"type":15},"2026-07-17T06:07:11.777011",{"slug":1756,"name":1756,"fn":1757,"description":1758,"org":1759,"tags":1760,"stars":1688,"repoUrl":1689,"updatedAt":1763},"mcore-onboard-gb200-1node-tests","onboard functional tests for GB200","Onboard 1-node GitHub MR functional tests for GB200 from existing mr-scoped 2-node tests.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1761,1762],{"name":1642,"slug":1643,"type":15},{"name":1628,"slug":1629,"type":15},"2026-07-14T05:25:53.673039",{"slug":1765,"name":1765,"fn":1766,"description":1767,"org":1768,"tags":1769,"stars":1688,"repoUrl":1689,"updatedAt":1774},"mcore-run-on-slurm","launch distributed training jobs on SLURM","How to launch distributed Megatron-LM training jobs on a SLURM cluster. Covers a minimal sbatch skeleton, environment-variable setup for torch.distributed.run, CUDA_DEVICE_MAX_CONNECTIONS rules across hardware and parallelism modes, container conventions, monitoring, and per-rank failure diagnosis.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1770,1771],{"name":1683,"slug":1684,"type":15},{"name":1772,"slug":1773,"type":15},"Infrastructure","infrastructure","2026-07-14T05:25:49.362534",{"slug":1776,"name":1776,"fn":1777,"description":1778,"org":1779,"tags":1780,"stars":1688,"repoUrl":1689,"updatedAt":1786},"mcore-split-pr","split pull requests to reduce review load","Split a PR into multiple PRs to reduce the number of required CODEOWNERS reviewer groups.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1781,1782,1783],{"name":1637,"slug":1638,"type":15},{"name":1711,"slug":1712,"type":15},{"name":1784,"slug":1785,"type":15},"Pull Requests","pull-requests","2026-07-14T05:26:01.226578",{"slug":1788,"name":1788,"fn":1789,"description":1790,"org":1791,"tags":1792,"stars":1688,"repoUrl":1689,"updatedAt":1795},"mcore-testing","run and manage Megatron-LM tests","Test system for Megatron-LM. Covers test layout, recipe YAML structure, adding and running unit and functional tests, golden values, marker filters, and CI parity.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1793,1794],{"name":1642,"slug":1643,"type":15},{"name":1628,"slug":1629,"type":15},"2026-07-14T05:25:54.928983",{"slug":1797,"name":1797,"fn":1798,"description":1799,"org":1800,"tags":1801,"stars":1688,"repoUrl":1689,"updatedAt":1806},"nightly-sync","manage nightly main-to-dev sync workflows","Domain knowledge for the nightly main-to-dev sync workflow. Covers merge strategy, CI architecture, failure investigation, and known issues.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1802,1805],{"name":1803,"slug":1804,"type":15},"Automation","automation",{"name":1698,"slug":1699,"type":15},"2026-07-30T05:29:03.275638",496]