igneum/infra/cross/build-workers-linux.sh
igneum-labs 1028c2579f Miner dev fee: app switch and UI line, HiveOS package, Linux worker cross-build, docs and public text
Decision of 4 October 2026 (evening): the Igneum Miner software takes a visible, switchable 1% dev fee, the norm
for GPU miners; the protocol stays fee-free. The miner side (--dev-fee, the 1-in-100 template counter, the audit
command) is on branch dev-fee of the node fork.

- app: settings.dev_fee (default on) passes --dev-fee 0 to igneum-miner when off; Settings shows the miner's own
  "dev fee 1% (1 block in 100) to 0x..." line next to the rewards address with a switch; the engine parses the
  miner's start line and its dev-fee block lines (fee_session, lifetime fee_total, an event per fee block)
- packaging/hive: h-manifest.conf, h-config.sh, h-run.sh, h-stats.sh, make-hive-package.sh (igneum-hive-<v>.tar.gz
  with the Linux igneumd, igneum-miner and both GPU workers), README with the Flight Sheet, selftest.sh (bash -n,
  stub binaries, the three hooks the way Hive runs them, the stats JSON parsed). Hive itself is untested
- infra/cross/build-workers-linux.sh: the NVRTC and OpenCL workers cross-compiled for Linux with zig;
  proto-opencl/cl_dynamic.h gains the Linux dlopen branch (libOpenCL.so.1)
- tools/dev-fee/run.mjs: the fee-block test network (two nodes on 29900+, three CPU miners, payouts audit)
- docs/design/miner-dev-fee.md (mechanism, flag, lines, the DEV_FEE_ADDRESS placeholder and the devnet address),
  docs/fud-ledger.md E18 and the E5/L9 status line, litepaper "What a miner's hour looks like" paragraph, homepage
  miner section note

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-10-04 21:46:41 +00:00

39 lines
2.8 KiB
Bash
Executable file

#!/usr/bin/env bash
# Cross-compile the two GPU workers for x86_64 Linux on the Mac with zig as the C and C++ toolchain (the same zig that
# cargo-zigbuild uses for igneumd and igneum-miner in build-linux.sh). Both workers open their GPU library at run time
# (dlopen, no import library): libcuda.so.1 and libnvrtc.so.12 for the NVRTC worker, libOpenCL.so.1 for the OpenCL
# worker (proto-opencl/cl_dynamic.h, Linux branch of 4 October 2026). For the HiveOS package (packaging/hive).
#
# infra/cross/build-workers-linux.sh -> infra/cross/out-workers/{igneum-worker-cuda,igneum-worker-opencl}
# OUT_DIR=... GLIBC=2.36 infra/cross/build-workers-linux.sh
#
# Untested on a Linux GPU host as of 4 October 2026: the binaries link and load (checked with file and the ELF
# interpreter); a HiveOS rig is the first real run.
set -euo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO="$(cd "$HERE/../.." && pwd)"
OUT_DIR="${OUT_DIR:-$HERE/out-workers}"
GLIBC="${GLIBC:-2.36}"
TARGET="x86_64-linux-gnu"
RED="${RED:-$REPO/proto-cuda/nvrtc/redist}" # the fetched headers (fetch-redist.sh; untracked, so a worktree may point RED at the main checkout's copy)
PLACEHOLDER="$REPO/proto-cuda/packs/igneum-devnet-v4-epoch0"
log() { printf '%s %s\n' "$(date -u +%H:%M:%S)" "$*"; }
die() { log "ERROR: $*" >&2; exit 1; }
command -v zig >/dev/null 2>&1 || die "zig is not installed (brew install zig)"
[ -f "$RED/include/cuda.h" ] && [ -f "$RED/include/nvrtc.h" ] && [ -f "$RED/include/CL/cl.h" ] || die "run proto-cuda/nvrtc/fetch-redist.sh first (cuda.h, nvrtc.h, CL/cl.h)"
[ -d "$PLACEHOLDER" ] || die "no placeholder pack at $PLACEHOLDER"
mkdir -p "$OUT_DIR"
start=$(date +%s)
log "igneum-worker-cuda for $TARGET.$GLIBC (zig $(zig version))"
nice -n 19 zig c++ -target "$TARGET.$GLIBC" -std=c++17 -O2 -Wall -Wextra -I "$REPO/proto-cuda/nvrtc" -I "$RED/include" \
-o "$OUT_DIR/igneum-worker-cuda" "$REPO/proto-cuda/nvrtc/worker.cpp" -ldl -lpthread
log "igneum-worker-opencl for $TARGET.$GLIBC"
nice -n 19 zig cc -target "$TARGET.$GLIBC" -std=gnu99 -D_GNU_SOURCE -O2 -Wall -Wextra -Wno-stringop-truncation -Wno-format-truncation \
-DIGNEUM_CL_DYNAMIC -DCL_TARGET_OPENCL_VERSION=120 -I "$RED/include" -I "$PLACEHOLDER" -DIGNEUM_KERNEL_PATH='"kernel_bound.cl"' \
-o "$OUT_DIR/igneum-worker-opencl" "$REPO/proto-opencl/host.c" -ldl -lm -lpthread
chmod +x "$OUT_DIR/igneum-worker-cuda" "$OUT_DIR/igneum-worker-opencl"
{
printf 'igneum workers, linux x86_64, glibc %s, cross-compiled with zig %s on %s from %s\n' "$GLIBC" "$(zig version)" "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$(git -C "$REPO" rev-parse --short HEAD 2>/dev/null || echo unknown)"
} > "$OUT_DIR/version.txt"
file "$OUT_DIR/igneum-worker-cuda" "$OUT_DIR/igneum-worker-opencl" | sed 's/^/ /'
log "done in $(( $(date +%s) - start )) s; binaries in $OUT_DIR"