Files
jackpot-miner/build-portable.sh
jackpotincorporated 4b5f84959c Add AMD OpenCL kernel, runtime-loaded CUDA, mixed backend, portability
AMD GPU backend:
- Add the GCN-tuned equihash192_7.cl kernel (clearCounter/blake/round1..7/
  combine pipeline) and its host driver src/gpu_amd.rs. GpuSolver now dispatches
  AMD-vendor OpenCL devices to it and other devices to the existing kernel
  (force with ZCL_OPENCL_KERNEL=amd|legacy). Validated on an RX 9060 XT: GPU
  solutions match the CPU reference 1/1.
- Expose BatchHasher::midstate() for the kernel's ulong8 hashState arg.

Runtime-loaded GPU drivers (minimum host deps):
- dlopen libcuda / libnvidia-ml via libloading instead of linking them
  (src/dylib.rs macro; cuda.rs, nvml.rs, gpu_probe.rs). The binary now builds
  and starts on hosts without an NVIDIA driver and reports no CUDA devices
  gracefully; remove build.rs (its only job was linking those libs).
- Add Dockerfile.portable + build-portable.sh: build against Debian bullseye's
  glibc 2.31 for a binary that runs on older distros and drives both AMD
  (OpenCL) and NVIDIA (CUDA) cards. Document the build matrix in the README.

Mixed backend (default):
- Add --backend mixed (now the default): each card on its native backend
  (NVIDIA->CUDA, AMD/Intel->OpenCL), deduped so no card is mined twice.
  --devices indexes the unified list shown by --list-devices.

Misc:
- Stale-work timeout (--job-timeout) default 300s -> 600s (10 minutes).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-06 01:15:41 -04:00

37 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# Build a portable jackpotminer binary inside an old-glibc (Debian bullseye,
# glibc 2.31) container, so it runs on essentially any recent Linux regardless of
# the build host's glibc. CUDA is dlopen'd at runtime, so no NVIDIA toolkit is
# needed to build; the binary drives both AMD (OpenCL) and NVIDIA (CUDA) cards.
#
# Output: dist/jackpotminer
#
# Works with Docker (BuildKit) or Podman. Override the engine with ENGINE=podman.
set -eu
ENGINE="${ENGINE:-docker}"
OUT="${OUT:-dist}"
mkdir -p "$OUT"
case "$ENGINE" in
podman)
# Podman builds the final `scratch` stage; extract the binary from it.
podman build -f Dockerfile.portable -t jackpotminer-portable .
cid=$(podman create jackpotminer-portable)
podman cp "$cid:/jackpotminer" "$OUT/jackpotminer"
podman rm "$cid" >/dev/null
;;
*)
DOCKER_BUILDKIT=1 "$ENGINE" build -f Dockerfile.portable \
--output "type=local,dest=$OUT" .
;;
esac
chmod +x "$OUT/jackpotminer"
echo
echo "Built $OUT/jackpotminer"
command -v file >/dev/null 2>&1 && file "$OUT/jackpotminer" || true
echo "Minimum glibc / dynamic deps:"
{ objdump -T "$OUT/jackpotminer" 2>/dev/null | grep -oE 'GLIBC_[0-9.]+' | sort -V | tail -1; } || true