From 4825ff82d6863e13598ca7e99b6f6ba0a2b80b79 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 | 6 ++++-- openblas-src/Cargo.toml | 3 +++ openblas-src/build.rs | 9 +++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/openblas-build/src/build.rs b/openblas-build/src/build.rs index 2fe8da6..7ee408a 100644 --- a/openblas-build/src/build.rs +++ b/openblas-build/src/build.rs @@ -177,10 +177,12 @@ impl Configure { args.push("NO_LAPACKE=1".into()) } if self.use_thread { - args.push("USE_THREAD=1".into()) + args.push("USE_THREAD=1".into()); + args.push("NUM_THREADS=128".into()); } if self.use_openmp { - args.push("USE_OPENMP=1".into()) + args.push("USE_OPENMP=1".into()); + args.push("NUM_THREADS=128".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 16fd3be..98e9388 100644 --- a/openblas-src/Cargo.toml +++ b/openblas-src/Cargo.toml @@ -43,6 +43,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 5865271..5aa95a5 100644 --- a/openblas-src/build.rs +++ b/openblas-src/build.rs @@ -106,6 +106,15 @@ fn build() { } else { cfg.no_static = true; } + 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::{collections::hash_map::DefaultHasher, hash::*};