From 3661cc6b8e190233c8f9f3fe25c7e50f414b299f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ga=C3=ABtan=20Cassiers?= Date: Mon, 26 Apr 2021 10:59:05 +0200 Subject: [PATCH] Add DYN_ARCH/USE_THREADS/USE_OPENMP features --- openblas-build/src/build.rs | 2 ++ openblas-src/Cargo.toml | 3 +++ openblas-src/build.rs | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/openblas-build/src/build.rs b/openblas-build/src/build.rs index 10d15ca..f74289f 100644 --- a/openblas-build/src/build.rs +++ b/openblas-build/src/build.rs @@ -394,9 +394,11 @@ impl Configure { } if self.use_thread { args.push("USE_THREAD=1".into()); + args.push("NUM_THREADS=256".into()); } if self.use_openmp { args.push("USE_OPENMP=1".into()); + args.push("NUM_THREADS=256".into()); } if matches!(self.interface, Interface::ILP64) { args.push("INTERFACE64=1".into()); diff --git a/openblas-src/Cargo.toml b/openblas-src/Cargo.toml index e0911dd..f32cff9 100644 --- a/openblas-src/Cargo.toml +++ b/openblas-src/Cargo.toml @@ -31,6 +31,9 @@ cblas = [] lapacke = [] static = [] system = [] +use_thread = [] +use_openmp = [] +dynamic_arch = [] [dev-dependencies] libc = "0.2" diff --git a/openblas-src/build.rs b/openblas-src/build.rs index f555c03..43ae8f0 100644 --- a/openblas-src/build.rs +++ b/openblas-src/build.rs @@ -155,6 +155,15 @@ fn build() { cfg.compilers.hostcc = env::var("OPENBLAS_HOSTCC").ok(); cfg.compilers.fc = env::var("OPENBLAS_FC").ok(); cfg.compilers.ranlib = env::var("OPENBLAS_RANLIB").ok(); + if feature_enabled("use_thread") { + cfg.use_thread = true; + } + if feature_enabled("use_openmp") { + cfg.use_openmp = true; + } + if feature_enabled("dynamic_arch") { + cfg.no_shared = true; + } let output = if feature_enabled("cache") { use std::hash::*;