Files
project_6/cccl_upstream/ci/util/version_compare.sh
muh-bot 2a7ca101d7 feat(cccl): integrate missing CCCL directories — python/, ci/, .agent/, docs/, test/
Sparse-checkout from NVIDIA/cccl main branch to complete cccl_upstream:

Added:
- python/cuda_cccl/ (226 files) — Python bindings for device-level algorithms
  Critical for muh toolchain: cuda.compute.reduce_into, scan, radix_sort, etc.
  Includes 204 .py files with full test coverage for all 27 algorithms
- ci/ (163 files) — Build/test infrastructure
  build_cub.sh, test_cub.sh, build_and_test_targets.sh, matrix.yaml
  Directly maps to our [INFRA-CI] and [INFRA-BUILD] items
- .agent/skills/ (7 files) — NVIDIA's own agent skills for CCCL
  cccl-style/SKILL.md, cccl-test/SKILL.md, sass-diff/SKILL.md
- docs/ (491 files) — Official CCCL documentation
  CI references, CMake guides, Python compute docs, libcudacxx PTX docs
- test/ (12 files) — Top-level integration tests (cuda_smoke, stdpar)
- Root configs: .clang-format, .clang-tidy, CONTRIBUTING.md, pyproject.toml
- CLAUDE.md symlink → AGENTS.md (NVIDIA's standard)

cccl_upstream now mirrors full NVIDIA/cccl structure:
  Before: 42M (cub + thrust + libcudacxx + cudax + c + examples + benchmarks)
  After:  53M (+python +ci +docs +.agent +test +configs)

This completes the CCCL base needed for:
- [muh-bench] items: ci/util/build_and_test_targets.sh for targeted builds
- [CCCL-verify] items: python/cuda_cccl/tests/ as reference implementations
- [CCCL-test] items: ci/test_cub.sh, ci/test_thrust.sh
- Agent workflow: .agent/skills/ for consistent style and test patterns
2026-08-07 02:34:33 +00:00

86 lines
1.9 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
usage=$(cat <<EOF
Usage: $0 X.Y[.Z[.W[...]]] <compare_op> A.B[.C[.D[...]]]
Compares two version strings with the specified operator.
compare_ops:
lt - less than
le - less than or equal to
eq - equal to
ne - not equal to
ge - greater than or equal to
gt - greater than
EOF
)
readonly usage
if [[ "$#" -ne 3 ]]; then
echo "Error: Invalid arguments: $*" >&2
echo "$usage" >&2
exit 1
fi
version_a="$1"
operator="$2"
version_b="$3"
# Validate operator
if [[ ! "$operator" =~ ^(lt|le|eq|ne|ge|gt)$ ]]; then
echo "Error: Invalid operator '$operator'. Must be one of: lt, le, eq, ne, ge, gt." >&2
echo "$usage" >&2
exit 1
fi
# Validate versions:
version_regex='^[0-9]+(\.[0-9]+)*$'
if [[ ! "$version_a" =~ $version_regex ]]; then
echo "Error: Invalid version string '$version_a'." >&2
echo "$usage" >&2
exit 1
fi
if [[ ! "$version_b" =~ $version_regex ]]; then
echo "Error: Invalid version string '$version_b'." >&2
echo "$usage" >&2
exit 1
fi
# Split versions into arrays
IFS='.' read -r -a ver_a_parts <<< "$version_a"
IFS='.' read -r -a ver_b_parts <<< "$version_b"
max_length=${#ver_a_parts[@]}
if [[ "${#ver_b_parts[@]}" -gt "$max_length" ]]; then
max_length=${#ver_b_parts[@]}
fi
# Compare each part
for ((i=0; i<max_length; i++)); do
part_a=${ver_a_parts[i]:-0}
part_b=${ver_b_parts[i]:-0}
if ((part_a < part_b)); then
result="lt"
break
elif ((part_a > part_b)); then
result="gt"
break
else
result="eq"
fi
done
# Evaluate the comparison based on the operator
case "$operator" in
lt) [[ "$result" == "lt" ]] ;;
le) [[ "$result" == "lt" || "$result" == "eq" ]] ;;
eq) [[ "$result" == "eq" ]] ;;
ne) [[ "$result" != "eq" ]] ;;
ge) [[ "$result" == "gt" || "$result" == "eq" ]] ;;
gt) [[ "$result" == "gt" ]] ;;
*) echo "Error: Unhandled operator '${operator}'." >&2; exit 1 ;;
esac
exit $?