nvidia/udf-benchmark
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.
npx skills add https://github.com/NVIDIA/cudf-spark --skill udf-benchmark
Before making any edits, create a visible TODO checklist for every workflow step in this skill and keep it updated. Do not produce a final answer until every required checklist item is marked complete.
Derive <CamelName> and <snake_name> from the UDF class name.
> Note: Commands require access to /tmp (Spark temp storage) and /dev (GPU device). If commands fail due to sandbox restrictions, re-run them unsandboxed.
Read src/main/scala/com/udf/bench/BenchUtils.scala. Replace placeholders with the actual camel/snake UDF name.
Fill in the TODO methods following the docstrings. For variable-length inputs, generate sizable rows representative of enterprise-scale data. Refer to the unit test for schema and example data.
Make scripts executable:
chmod +x *.sh
Run validation mode to test with a small dataset:
./run_gen_data.sh --rows 1000 --validate
This runs both the CPU and GPU implementations on the dataset.
If validation fails, analyze the error and fix the BenchUtils implementation.
The scripts set the default heap size to 16g in .mvn/jvm.config; adjust depending on data size.
./run_gen_data.sh --rows 10000000
# CPU benchmark
./run_spark_benchmark.sh --mode cpu --data-path data/bench_data_10000000_rows.parquet
# GPU benchmark
./run_spark_benchmark.sh --mode gpu --data-path data/bench_data_10000000_rows.parquet
Results are saved to the results/ directory as JSON files.
> Skip this step for SQL targets. This only applies to cuDF RapidsUDF conversions.
Follow CUDF_MICROBENCHMARKS.md to implement and run in-memory microbenchmarks.
Upon successful completion:
src/main/scala/com/udf/bench/BenchUtils.scalasrc/main/scala/com/udf/bench/MicroBenchRunner.scaladata/results/Take nvidia/udf-benchmark from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.