From cdc93da48be07abc83bdb2a1e471614f191bed96 Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Thu, 10 Jan 2019 00:19:35 +0900 Subject: [PATCH 01/11] Add /usr/local/cuda, and /opt/cuda for default search path --- build.rs | 133 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 74 insertions(+), 59 deletions(-) diff --git a/build.rs b/build.rs index ad6d66f..469b4b6 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,6 @@ -use std::env; +use std::{env, path::PathBuf}; -fn find_library_paths() -> Vec { +fn read_env() -> Vec { if let Ok(path) = env::var("CUDA_LIBRARY_PATH") { // The location of the libcuda, libcudart, and libcublas can be hardcoded with the // CUDA_LIBRARY_PATH environment variable. @@ -9,81 +9,96 @@ fn find_library_paths() -> Vec { } else { ":" }; + path.split(split_char).map(|s| PathBuf::from(s)).collect() + } else { + vec![] + } +} - return path.split(split_char).map(|s| s.to_owned()).collect(); +fn find_cuda() -> PathBuf { + let mut candidates = read_env(); + candidates.push(PathBuf::from("/usr/local/cuda")); + candidates.push(PathBuf::from("/opt/cuda")); + + // CUDA directory must have include/cuda.h header file + for base in &candidates { + let base = PathBuf::from(base); + let path = base.join("include/cuda.h"); + if path.is_file() { + return base.join("lib64"); + } } + panic!("CUDA cannot find"); +} - if cfg!(target_os = "windows") { - if let Ok(path) = env::var("CUDA_PATH") { - // If CUDA_LIBRARY_PATH is not found, then CUDA_PATH will be used when building for - // Windows to locate the Cuda installation. Cuda installs the full Cuda SDK for 64-bit, - // but only a limited set of libraries for 32-bit. Namely, it does not include cublas in - // 32-bit, which cuda-sys requires. +fn find_cuda_windows() -> PathBuf { + let paths = read_env(); + if !paths.is_empty() { + return paths[0].clone(); + } - // 'path' points to the base of the CUDA Installation. The lib directory is a - // sub-directory. - let path = std::path::Path::new(&path); + if let Ok(path) = env::var("CUDA_PATH") { + // If CUDA_LIBRARY_PATH is not found, then CUDA_PATH will be used when building for + // Windows to locate the Cuda installation. Cuda installs the full Cuda SDK for 64-bit, + // but only a limited set of libraries for 32-bit. Namely, it does not include cublas in + // 32-bit, which cuda-sys requires. - // To do this the right way, we check to see which target we're building for. - let target = env::var("TARGET") - .expect("cargo did not set the TARGET environment variable as required."); + // 'path' points to the base of the CUDA Installation. The lib directory is a + // sub-directory. + let path = PathBuf::from(path); - // Targets use '-' separators. e.g. x86_64-pc-windows-msvc - let target_components: Vec<_> = target.as_str().split("-").collect(); + // To do this the right way, we check to see which target we're building for. + let target = env::var("TARGET") + .expect("cargo did not set the TARGET environment variable as required."); - // We check that we're building for Windows. This code assumes that the layout in - // CUDA_PATH matches Windows. - if target_components[2] != "windows" { - println!( - "INFO: The CUDA_PATH variable is only used by cuda-sys on Windows. Your target \ - is {}.", - target - ); - return vec![]; - } + // Targets use '-' separators. e.g. x86_64-pc-windows-msvc + let target_components: Vec<_> = target.as_str().split("-").collect(); - // Sanity check that the second component of 'target' is "pc" - debug_assert_eq!( - "pc", target_components[1], - "Expected a Windows target to have the second component be 'pc'. Target: {}", + // We check that we're building for Windows. This code assumes that the layout in + // CUDA_PATH matches Windows. + if target_components[2] != "windows" { + panic!( + "The CUDA_PATH variable is only used by cuda-sys on Windows. Your target is {}.", target ); + } - // x86_64 should use the libs in the "lib/x64" directory. If we ever support i686 (which - // does not ship with cublas support), its libraries are in "lib/Win32". - let lib_path = match target_components[0] { - "x86_64" => "x64", - "i686" => { - // lib path would be "Win32" if we support i686. "cublas" is not present in the - // 32-bit install. - println!("INFO: Rust cuda-sys does not currently support 32-bit Windows."); - return vec![]; - } - _ => { - println!("INFO: Rust cuda-sys only supports the x86_64 Windows architecture."); - return vec![]; - } - }; + // Sanity check that the second component of 'target' is "pc" + debug_assert_eq!( + "pc", target_components[1], + "Expected a Windows target to have the second component be 'pc'. Target: {}", + target + ); - return vec![ - // i.e. $CUDA_PATH/lib/x64 - path.join("lib") - .join(lib_path) - .to_str() - .unwrap() - .to_string(), - ]; - } + // x86_64 should use the libs in the "lib/x64" directory. If we ever support i686 (which + // does not ship with cublas support), its libraries are in "lib/Win32". + let lib_path = match target_components[0] { + "x86_64" => "x64", + "i686" => { + // lib path would be "Win32" if we support i686. "cublas" is not present in the + // 32-bit install. + panic!("Rust cuda-sys does not currently support 32-bit Windows."); + } + _ => { + panic!("Rust cuda-sys only supports the x86_64 Windows architecture."); + } + }; + + // i.e. $CUDA_PATH/lib/x64 + return path.join("lib").join(lib_path); } // No idea where to look for CUDA - vec![] + panic!("CUDA cannot find"); } fn main() { - for p in find_library_paths() { - println!("cargo:rustc-link-search=native={}", p); - } + let path = if cfg!(target_os = "windows") { + find_cuda_windows() + } else { + find_cuda() + }; + println!("cargo:rustc-link-search=native={}", path.display()); println!("cargo:rustc-link-lib=dylib=cuda"); println!("cargo:rustc-link-lib=dylib=cudart"); println!("cargo:rustc-link-lib=dylib=cublas"); From 617f524c41d56156ca86e16f1ab73e8ad47f7728 Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Sun, 13 Jan 2019 18:56:46 +0900 Subject: [PATCH 02/11] Run cargo test on CI --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 12138da..bb6052d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,7 +4,7 @@ version: 2 name: Cargo build command: | export PATH=/root/.cargo/bin:$PATH - cargo build -vv + cargo test -v .job_apt_template: &job_apt steps: From d6436bf156daf19db979777489ab92bb194ee4b9 Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Mon, 14 Jan 2019 04:46:30 +0900 Subject: [PATCH 03/11] Add lib64/stubs directory (#7) --- build.rs | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/build.rs b/build.rs index 469b4b6..5e24503 100644 --- a/build.rs +++ b/build.rs @@ -15,20 +15,22 @@ fn read_env() -> Vec { } } -fn find_cuda() -> PathBuf { +fn find_cuda() -> Vec { let mut candidates = read_env(); candidates.push(PathBuf::from("/usr/local/cuda")); candidates.push(PathBuf::from("/opt/cuda")); // CUDA directory must have include/cuda.h header file + let mut valid_paths = vec![]; for base in &candidates { let base = PathBuf::from(base); let path = base.join("include/cuda.h"); if path.is_file() { - return base.join("lib64"); + valid_paths.push(base.join("lib64")); + valid_paths.push(base.join("lib64/stubs")); } } - panic!("CUDA cannot find"); + valid_paths } fn find_cuda_windows() -> PathBuf { @@ -93,12 +95,16 @@ fn find_cuda_windows() -> PathBuf { } fn main() { - let path = if cfg!(target_os = "windows") { - find_cuda_windows() + if cfg!(target_os = "windows") { + println!( + "cargo:rustc-link-search=native={}", + find_cuda_windows().display() + ); } else { - find_cuda() + for path in find_cuda() { + println!("cargo:rustc-link-search=native={}", path.display()); + } }; - println!("cargo:rustc-link-search=native={}", path.display()); println!("cargo:rustc-link-lib=dylib=cuda"); println!("cargo:rustc-link-lib=dylib=cudart"); println!("cargo:rustc-link-lib=dylib=cublas"); From 9b5c752729036c9d7b283710b2fbed26c8204ff6 Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Mon, 14 Jan 2019 04:57:46 +0900 Subject: [PATCH 04/11] Add cuda/compat lib direcotry --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 5e24503..0668a9c 100644 --- a/build.rs +++ b/build.rs @@ -27,7 +27,7 @@ fn find_cuda() -> Vec { let path = base.join("include/cuda.h"); if path.is_file() { valid_paths.push(base.join("lib64")); - valid_paths.push(base.join("lib64/stubs")); + valid_paths.push(base.join("compat")); } } valid_paths From fc4dd7f21ce5de83409302be9d207c349220cb3d Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Mon, 14 Jan 2019 05:12:47 +0900 Subject: [PATCH 05/11] Add debug output --- build.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/build.rs b/build.rs index 0668a9c..ea632f3 100644 --- a/build.rs +++ b/build.rs @@ -24,12 +24,21 @@ fn find_cuda() -> Vec { let mut valid_paths = vec![]; for base in &candidates { let base = PathBuf::from(base); - let path = base.join("include/cuda.h"); - if path.is_file() { + let header = base.join("include/cuda.h"); + if header.is_file() { valid_paths.push(base.join("lib64")); - valid_paths.push(base.join("compat")); + valid_paths.push(base.join("lib64/stubs")); + continue; + } + let base = base.join("targets/x86_64-linux"); + let header = base.join("include/cuda.h"); + if header.is_file() { + valid_paths.push(base.join("lib")); + valid_paths.push(base.join("lib/stubs")); + continue; } } + eprintln!("Found CUDA paths: {:?}", valid_paths); valid_paths } From 9667c83deb9b214a97d729cfaf728ce13b0cea4e Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Mon, 14 Jan 2019 12:11:30 +0000 Subject: [PATCH 06/11] Add LD_LIBRARY_PATH --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index bb6052d..1472c76 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,6 +4,7 @@ version: 2 name: Cargo build command: | export PATH=/root/.cargo/bin:$PATH + export LD_LIBRARY_PATH="/usr/local/cuda/compat" cargo test -v .job_apt_template: &job_apt From d3346350a4969a32441db9f1e27c71ca065f8db0 Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Mon, 14 Jan 2019 06:59:20 +0900 Subject: [PATCH 07/11] Fix --- .circleci/config.yml | 149 ++----------------------------------------- build.rs | 9 +-- 2 files changed, 7 insertions(+), 151 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1472c76..b385fd1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,158 +1,21 @@ version: 2 .cargo: &cargo - name: Cargo build - command: | - export PATH=/root/.cargo/bin:$PATH - export LD_LIBRARY_PATH="/usr/local/cuda/compat" - cargo test -v - -.job_apt_template: &job_apt - steps: - - checkout - - run: - name: Install Rust - command: | - apt update - apt install -y curl - curl https://sh.rustup.rs -sSf | sh -s -- -y - - run: - <<: *cargo - -.job_yum_template: &job_yum steps: - checkout - run: - name: Install Rust + name: Cargo test command: | - yum install -y curl - curl https://sh.rustup.rs -sSf | sh -s -- -y - - run: - <<: *cargo + cargo test -vv jobs: - latest: - <<: *job_apt - docker: - - image: nvidia/cuda:latest - 9.2-devel-ubuntu18.04: - <<: *job_apt - docker: - - image: nvidia/cuda:9.2-devel-ubuntu18.04 - 10.0-devel-ubuntu16.04: - <<: *job_apt - docker: - - image: nvidia/cuda:10.0-devel-ubuntu16.04 - 9.2-devel-ubuntu16.04: - <<: *job_apt - docker: - - image: nvidia/cuda:9.2-devel-ubuntu16.04 - 9.1-devel-ubuntu16.04: - <<: *job_apt - docker: - - image: nvidia/cuda:9.1-devel-ubuntu16.04 - 9.0-devel-ubuntu16.04: - <<: *job_apt - docker: - - image: nvidia/cuda:9.0-devel-ubuntu16.04 - 8.0-devel-ubuntu16.04: - <<: *job_apt - docker: - - image: nvidia/cuda:8.0-devel-ubuntu16.04 - 8.0-devel-ubuntu14.04: - <<: *job_apt - docker: - - image: nvidia/cuda:8.0-devel-ubuntu14.04 - 7.5-devel-ubuntu14.04: - <<: *job_apt - docker: - - image: nvidia/cuda:7.5-devel-ubuntu14.04 - 7.0-devel-ubuntu14.04: - <<: *job_apt - docker: - - image: nvidia/cuda:7.0-devel-ubuntu14.04 - 6.5-devel-ubuntu14.04: - <<: *job_apt - docker: - - image: nvidia/cuda:6.5-devel-ubuntu14.04 - 10.0-devel-centos7: - <<: *job_yum - docker: - - image: nvidia/cuda:10.0-devel-centos7 - 9.2-devel-centos7: - <<: *job_yum - docker: - - image: nvidia/cuda:9.2-devel-centos7 - 9.1-devel-centos7: - <<: *job_yum - docker: - - image: nvidia/cuda:9.1-devel-centos7 - 9.0-devel-centos7: - <<: *job_yum - docker: - - image: nvidia/cuda:9.0-devel-centos7 - 8.0-devel-centos7: - <<: *job_yum - docker: - - image: nvidia/cuda:8.0-devel-centos7 - 7.5-devel-centos7: - <<: *job_yum - docker: - - image: nvidia/cuda:7.5-devel-centos7 - 7.0-devel-centos7: - <<: *job_yum - docker: - - image: nvidia/cuda:7.0-devel-centos7 - 10.0-devel-centos6: - <<: *job_yum - docker: - - image: nvidia/cuda:10.0-devel-centos6 - 9.2-devel-centos6: - <<: *job_yum - docker: - - image: nvidia/cuda:9.2-devel-centos6 - 9.1-devel-centos6: - <<: *job_yum - docker: - - image: nvidia/cuda:9.1-devel-centos6 - 9.0-devel-centos6: - <<: *job_yum - docker: - - image: nvidia/cuda:9.0-devel-centos6 - 8.0-devel-centos6: - <<: *job_yum - docker: - - image: nvidia/cuda:8.0-devel-centos6 - 7.5-devel-centos6: - <<: *job_yum + cuda10.0-ubuntu18.04: + <<: *cargo docker: - - image: nvidia/cuda:7.5-devel-centos6 + - image: registry.gitlab.com/rust-cuda/container:cuda10.0-ubuntu18.04 workflows: version: 2 tests: jobs: - - latest - - 9.2-devel-ubuntu18.04 - - 10.0-devel-ubuntu16.04 - - 9.2-devel-ubuntu16.04 - - 9.1-devel-ubuntu16.04 - - 9.0-devel-ubuntu16.04 - - 8.0-devel-ubuntu16.04 - - 8.0-devel-ubuntu14.04 - - 7.5-devel-ubuntu14.04 - - 7.0-devel-ubuntu14.04 - - 6.5-devel-ubuntu14.04 - - 10.0-devel-centos7 - - 9.2-devel-centos7 - - 9.1-devel-centos7 - - 9.0-devel-centos7 - - 8.0-devel-centos7 - - 7.5-devel-centos7 - - 7.0-devel-centos7 - - 10.0-devel-centos6 - - 9.2-devel-centos6 - - 9.1-devel-centos6 - - 9.0-devel-centos6 - - 8.0-devel-centos6 - - 7.5-devel-centos6 + - cuda10.0-ubuntu18.04 diff --git a/build.rs b/build.rs index ea632f3..e743fe0 100644 --- a/build.rs +++ b/build.rs @@ -30,13 +30,6 @@ fn find_cuda() -> Vec { valid_paths.push(base.join("lib64/stubs")); continue; } - let base = base.join("targets/x86_64-linux"); - let header = base.join("include/cuda.h"); - if header.is_file() { - valid_paths.push(base.join("lib")); - valid_paths.push(base.join("lib/stubs")); - continue; - } } eprintln!("Found CUDA paths: {:?}", valid_paths); valid_paths @@ -114,9 +107,9 @@ fn main() { println!("cargo:rustc-link-search=native={}", path.display()); } }; - println!("cargo:rustc-link-lib=dylib=cuda"); println!("cargo:rustc-link-lib=dylib=cudart"); println!("cargo:rustc-link-lib=dylib=cublas"); + println!("cargo:rustc-link-lib=dylib=cuda"); println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-env-changed=CUDA_LIBRARY_PATH"); } From 0eac0153ad5b3c90ad14d694064f87f13ff81bf5 Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Wed, 23 Jan 2019 04:07:42 +0900 Subject: [PATCH 08/11] Drop header check --- build.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/build.rs b/build.rs index e743fe0..1df5987 100644 --- a/build.rs +++ b/build.rs @@ -23,12 +23,10 @@ fn find_cuda() -> Vec { // CUDA directory must have include/cuda.h header file let mut valid_paths = vec![]; for base in &candidates { - let base = PathBuf::from(base); - let header = base.join("include/cuda.h"); - if header.is_file() { - valid_paths.push(base.join("lib64")); - valid_paths.push(base.join("lib64/stubs")); - continue; + let lib = PathBuf::from(base).join("lib64"); + if lib.is_dir() { + valid_paths.push(lib.clone()); + valid_paths.push(lib.join("stubs")); } } eprintln!("Found CUDA paths: {:?}", valid_paths); From 87eb06e66b9d27426d62f5c50430cb0ef87a1d23 Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Wed, 23 Jan 2019 04:18:43 +0900 Subject: [PATCH 09/11] Add /usr/local/cuda-* type default path --- Cargo.toml | 3 +++ build.rs | 11 +++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 6a3ef37..d8af302 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,3 +13,6 @@ keywords = ["GPGPU", "CUDA", "ffi"] license = "MIT" readme = "README.md" categories = [] + +[build-dependencies] +glob = "*" diff --git a/build.rs b/build.rs index 1df5987..2dde2a4 100644 --- a/build.rs +++ b/build.rs @@ -1,3 +1,6 @@ +extern crate glob; + +use glob::glob; use std::{env, path::PathBuf}; fn read_env() -> Vec { @@ -17,10 +20,14 @@ fn read_env() -> Vec { fn find_cuda() -> Vec { let mut candidates = read_env(); - candidates.push(PathBuf::from("/usr/local/cuda")); candidates.push(PathBuf::from("/opt/cuda")); + candidates.push(PathBuf::from("/usr/local/cuda")); + for e in glob("/usr/local/cuda-*").unwrap() { + if let Ok(path) = e { + candidates.push(path) + } + } - // CUDA directory must have include/cuda.h header file let mut valid_paths = vec![]; for base in &candidates { let lib = PathBuf::from(base).join("lib64"); From b5e1a6ed5c78e471ed4ec7e27010a3dc4b7e4819 Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Thu, 24 Jan 2019 01:32:58 +0900 Subject: [PATCH 10/11] Revert "Fix" This reverts commit d3346350a4969a32441db9f1e27c71ca065f8db0. --- .circleci/config.yml | 149 +++++++++++++++++++++++++++++++++++++++++-- build.rs | 9 ++- 2 files changed, 151 insertions(+), 7 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index b385fd1..1472c76 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,21 +1,158 @@ version: 2 .cargo: &cargo + name: Cargo build + command: | + export PATH=/root/.cargo/bin:$PATH + export LD_LIBRARY_PATH="/usr/local/cuda/compat" + cargo test -v + +.job_apt_template: &job_apt + steps: + - checkout + - run: + name: Install Rust + command: | + apt update + apt install -y curl + curl https://sh.rustup.rs -sSf | sh -s -- -y + - run: + <<: *cargo + +.job_yum_template: &job_yum steps: - checkout - run: - name: Cargo test + name: Install Rust command: | - cargo test -vv + yum install -y curl + curl https://sh.rustup.rs -sSf | sh -s -- -y + - run: + <<: *cargo jobs: - cuda10.0-ubuntu18.04: - <<: *cargo + latest: + <<: *job_apt + docker: + - image: nvidia/cuda:latest + 9.2-devel-ubuntu18.04: + <<: *job_apt + docker: + - image: nvidia/cuda:9.2-devel-ubuntu18.04 + 10.0-devel-ubuntu16.04: + <<: *job_apt + docker: + - image: nvidia/cuda:10.0-devel-ubuntu16.04 + 9.2-devel-ubuntu16.04: + <<: *job_apt + docker: + - image: nvidia/cuda:9.2-devel-ubuntu16.04 + 9.1-devel-ubuntu16.04: + <<: *job_apt + docker: + - image: nvidia/cuda:9.1-devel-ubuntu16.04 + 9.0-devel-ubuntu16.04: + <<: *job_apt + docker: + - image: nvidia/cuda:9.0-devel-ubuntu16.04 + 8.0-devel-ubuntu16.04: + <<: *job_apt + docker: + - image: nvidia/cuda:8.0-devel-ubuntu16.04 + 8.0-devel-ubuntu14.04: + <<: *job_apt + docker: + - image: nvidia/cuda:8.0-devel-ubuntu14.04 + 7.5-devel-ubuntu14.04: + <<: *job_apt + docker: + - image: nvidia/cuda:7.5-devel-ubuntu14.04 + 7.0-devel-ubuntu14.04: + <<: *job_apt + docker: + - image: nvidia/cuda:7.0-devel-ubuntu14.04 + 6.5-devel-ubuntu14.04: + <<: *job_apt + docker: + - image: nvidia/cuda:6.5-devel-ubuntu14.04 + 10.0-devel-centos7: + <<: *job_yum + docker: + - image: nvidia/cuda:10.0-devel-centos7 + 9.2-devel-centos7: + <<: *job_yum + docker: + - image: nvidia/cuda:9.2-devel-centos7 + 9.1-devel-centos7: + <<: *job_yum + docker: + - image: nvidia/cuda:9.1-devel-centos7 + 9.0-devel-centos7: + <<: *job_yum + docker: + - image: nvidia/cuda:9.0-devel-centos7 + 8.0-devel-centos7: + <<: *job_yum + docker: + - image: nvidia/cuda:8.0-devel-centos7 + 7.5-devel-centos7: + <<: *job_yum + docker: + - image: nvidia/cuda:7.5-devel-centos7 + 7.0-devel-centos7: + <<: *job_yum + docker: + - image: nvidia/cuda:7.0-devel-centos7 + 10.0-devel-centos6: + <<: *job_yum + docker: + - image: nvidia/cuda:10.0-devel-centos6 + 9.2-devel-centos6: + <<: *job_yum + docker: + - image: nvidia/cuda:9.2-devel-centos6 + 9.1-devel-centos6: + <<: *job_yum + docker: + - image: nvidia/cuda:9.1-devel-centos6 + 9.0-devel-centos6: + <<: *job_yum + docker: + - image: nvidia/cuda:9.0-devel-centos6 + 8.0-devel-centos6: + <<: *job_yum + docker: + - image: nvidia/cuda:8.0-devel-centos6 + 7.5-devel-centos6: + <<: *job_yum docker: - - image: registry.gitlab.com/rust-cuda/container:cuda10.0-ubuntu18.04 + - image: nvidia/cuda:7.5-devel-centos6 workflows: version: 2 tests: jobs: - - cuda10.0-ubuntu18.04 + - latest + - 9.2-devel-ubuntu18.04 + - 10.0-devel-ubuntu16.04 + - 9.2-devel-ubuntu16.04 + - 9.1-devel-ubuntu16.04 + - 9.0-devel-ubuntu16.04 + - 8.0-devel-ubuntu16.04 + - 8.0-devel-ubuntu14.04 + - 7.5-devel-ubuntu14.04 + - 7.0-devel-ubuntu14.04 + - 6.5-devel-ubuntu14.04 + - 10.0-devel-centos7 + - 9.2-devel-centos7 + - 9.1-devel-centos7 + - 9.0-devel-centos7 + - 8.0-devel-centos7 + - 7.5-devel-centos7 + - 7.0-devel-centos7 + - 10.0-devel-centos6 + - 9.2-devel-centos6 + - 9.1-devel-centos6 + - 9.0-devel-centos6 + - 8.0-devel-centos6 + - 7.5-devel-centos6 diff --git a/build.rs b/build.rs index 2dde2a4..042c9aa 100644 --- a/build.rs +++ b/build.rs @@ -35,6 +35,13 @@ fn find_cuda() -> Vec { valid_paths.push(lib.clone()); valid_paths.push(lib.join("stubs")); } + let base = base.join("targets/x86_64-linux"); + let header = base.join("include/cuda.h"); + if header.is_file() { + valid_paths.push(base.join("lib")); + valid_paths.push(base.join("lib/stubs")); + continue; + } } eprintln!("Found CUDA paths: {:?}", valid_paths); valid_paths @@ -112,9 +119,9 @@ fn main() { println!("cargo:rustc-link-search=native={}", path.display()); } }; + println!("cargo:rustc-link-lib=dylib=cuda"); println!("cargo:rustc-link-lib=dylib=cudart"); println!("cargo:rustc-link-lib=dylib=cublas"); - println!("cargo:rustc-link-lib=dylib=cuda"); println!("cargo:rerun-if-changed=build.rs"); println!("cargo:rerun-if-env-changed=CUDA_LIBRARY_PATH"); } From 600fb49b348d4d6b87a99b1e8333d803ceb186b1 Mon Sep 17 00:00:00 2001 From: Toshiki Teramura Date: Thu, 24 Jan 2019 01:34:19 +0900 Subject: [PATCH 11/11] Do not cargo test --- .circleci/config.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 1472c76..26e7a35 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -4,8 +4,7 @@ version: 2 name: Cargo build command: | export PATH=/root/.cargo/bin:$PATH - export LD_LIBRARY_PATH="/usr/local/cuda/compat" - cargo test -v + cargo build -v .job_apt_template: &job_apt steps: