diff --git a/build.rs b/build.rs index 01edd8fbb..e3870c27e 100644 --- a/build.rs +++ b/build.rs @@ -46,9 +46,14 @@ fn main() { println!("cargo:rerun-if-changed=target/perf-libs/libcpu-crypt.a"); } if cuda { + let cuda_home = match env::var("CUDA_HOME") { + Ok(cuda_home) => cuda_home, + Err(_) => String::from("/usr/local/cuda"), + }; + println!("cargo:rerun-if-changed=target/perf-libs/libcuda-crypt.a"); println!("cargo:rustc-link-lib=static=cuda-crypt"); - println!("cargo:rustc-link-search=native=/usr/local/cuda/lib64"); + println!("cargo:rustc-link-search=native={}/lib64", cuda_home); println!("cargo:rustc-link-lib=dylib=cudart"); println!("cargo:rustc-link-lib=dylib=cuda"); println!("cargo:rustc-link-lib=dylib=cudadevrt"); diff --git a/ci/test-stable-perf.sh b/ci/test-stable-perf.sh index b487cb3f4..feea98bc5 100755 --- a/ci/test-stable-perf.sh +++ b/ci/test-stable-perf.sh @@ -13,10 +13,11 @@ if ! ci/version-check.sh stable; then fi export RUST_BACKTRACE=1 export RUSTFLAGS="-D warnings" +export CUDA_HOME=/usr/local/cuda ./fetch-perf-libs.sh -export LD_LIBRARY_PATH=$PWD/target/perf-libs:/usr/local/cuda/lib64:$LD_LIBRARY_PATH -export PATH=$PATH:/usr/local/cuda/bin +export LD_LIBRARY_PATH=$PWD/target/perf-libs:$CUDA_HOME/lib64:$LD_LIBRARY_PATH +export PATH=$PATH:$CUDA_HOME/bin _() { echo "--- $*" diff --git a/fetch-perf-libs.sh b/fetch-perf-libs.sh index 53ef54a35..038c7aa68 100755 --- a/fetch-perf-libs.sh +++ b/fetch-perf-libs.sh @@ -18,13 +18,15 @@ mkdir -p target/perf-libs curl https://solana-perf.s3.amazonaws.com/v0.10.5/x86_64-unknown-linux-gnu/solana-perf.tgz | tar zxvf - ) - if [[ -r /usr/local/cuda/version.txt && -r cuda-version.txt ]]; then - if ! diff /usr/local/cuda/version.txt cuda-version.txt > /dev/null; then + : "${CUDA_HOME:=/usr/local/cuda}" + + if [[ -r "$CUDA_HOME"/version.txt && -r cuda-version.txt ]]; then + if ! diff "$CUDA_HOME"/version.txt cuda-version.txt > /dev/null; then echo ============================================== - echo Warning: possible CUDA version mismatch + echo "Warning: possible CUDA version mismatch with $CUDA_HOME" echo echo "Expected version: $(cat cuda-version.txt)" - echo "Detected version: $(cat /usr/local/cuda/version.txt)" + echo "Detected version: $(cat "$CUDA_HOME"/version.txt)" echo ============================================== fi else diff --git a/net/remote/remote-node.sh b/net/remote/remote-node.sh index 83509d563..641e575ac 100755 --- a/net/remote/remote-node.sh +++ b/net/remote/remote-node.sh @@ -83,8 +83,10 @@ local|tar) export RUST_LOG export SOLANA_DEFAULT_METRICS_RATE=1 + : "${CUDA_HOME:=/usr/local/cuda}" + ./fetch-perf-libs.sh - export LD_LIBRARY_PATH="$PWD/target/perf-libs:/usr/local/cuda/lib64:$LD_LIBRARY_PATH" + export LD_LIBRARY_PATH="$PWD/target/perf-libs:$CUDA_HOME/lib64:$LD_LIBRARY_PATH" echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" scripts/oom-monitor.sh > oom-monitor.log 2>&1 &