Add CUDA_HOME env var to permit overriding the CUDA install location

This commit is contained in:
Michael Vines 2018-11-10 18:03:38 -08:00
parent b670b9bcde
commit cf6f344ccc
4 changed files with 18 additions and 8 deletions

View File

@ -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");

View File

@ -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 "--- $*"

View File

@ -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

View File

@ -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 &