Add optional NVBLAS GPU acceleration; fix stale CLAUDE.md sections
The RTX 4070 Ti + CUDA 12 toolkit + libnvblas.so are already installed on this machine (from pyRBM's cupy setup); Bandicoot (the alternative, much bigger Armadillo-to-GPU rewrite) is not. NVBLAS is a drop-in BLAS shim -- zero source changes -- that intercepts Armadillo's large matrix-multiply calls (v_to_h, h_to_v, CD gradients) and offloads them to the GPU via cuBLAS, falling back to the system's OpenBLAS otherwise. Add nvblas.conf (CPU fallback pointed at openblas-pthread, GPU_LIST ALL) and run_gpu.sh, an opt-in LD_PRELOAD wrapper: ./run_gpu.sh <binary> [args...]. Verified for real: poet.elf f produced byte-identical output through the wrapper, and a real training run against moby_ch1.txt showed GPU utilization rise from ~0-1% idle to 7-28% and memory usage grow from 893MiB to 1.4GB, while training progressed correctly (error decreasing, coherent generated text). Added nvblas.log to .gitignore. Also fixed two stale CLAUDE.md sections found along the way: the TEST target description still described the old broken manual smoke-test main.cpp instead of the minimal test suite that replaced it, and the "Project files on disk" section still described the flat repo-root layout from before the prj/<name>/ restructure. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016K8Gu7Qejd11JbdiHZqYAs
This commit is contained in:
Executable
+12
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
# Run a built binary (poet.elf, test.elf, rbm.elf) with NVBLAS: large
|
||||
# Armadillo matrix multiplies (v_to_h, h_to_v, CD gradients, ...) get
|
||||
# transparently offloaded to the GPU via cuBLAS, falling back to the
|
||||
# system's CPU BLAS (nvblas.conf) for anything NVBLAS doesn't handle.
|
||||
# No source changes -- this only intercepts BLAS symbol calls at runtime.
|
||||
#
|
||||
# Usage: ./run_gpu.sh build/release/poet.elf f "the "
|
||||
set -euo pipefail
|
||||
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
export NVBLAS_CONFIG_FILE="$here/nvblas.conf"
|
||||
exec env LD_PRELOAD=libnvblas.so "$@"
|
||||
Reference in New Issue
Block a user