Skip to content

Commit 2b2b25c

Browse files
authored
Merge pull request #90 from rust-math/windows-oneapi
intel-mkl-tool supports windows
2 parents 8007eea + 868fe1e commit 2b2b25c

File tree

4 files changed

+264
-116
lines changed

4 files changed

+264
-116
lines changed

.github/workflows/intel-mkl-sys.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,3 +51,29 @@ jobs:
5151
--manifest-path=intel-mkl-sys/Cargo.toml
5252
--no-default-features
5353
--features=${{ matrix.feature }}
54+
55+
windows:
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
feature:
60+
- mkl-static-lp64-iomp
61+
- mkl-static-lp64-seq
62+
- mkl-static-ilp64-iomp
63+
- mkl-static-ilp64-seq
64+
runs-on: windows-2022
65+
steps:
66+
- uses: actions/checkout@v1
67+
- name: Get MKL using NuGet
68+
run: |
69+
nuget install intelmkl.devel.cluster.win-x64
70+
nuget install intelmkl.static.cluster.win-x64
71+
- uses: actions-rs/cargo@v1
72+
with:
73+
command: test
74+
args: >
75+
--manifest-path=intel-mkl-sys/Cargo.toml
76+
--no-default-features
77+
--features=${{ matrix.feature }}
78+
env:
79+
MKLROOT: ${{ github.workspace }}

.github/workflows/intel-mkl-tool.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,22 @@ jobs:
8383
--manifest-path=intel-mkl-tool/Cargo.toml
8484
--release
8585
--example seek
86+
87+
seek-windows:
88+
runs-on: windows-2022
89+
steps:
90+
- uses: actions/checkout@v1
91+
- name: Get MKL using NuGet
92+
run: |
93+
nuget install intelmkl.devel.cluster.win-x64
94+
nuget install intelmkl.static.cluster.win-x64
95+
- name: Run seek example
96+
uses: actions-rs/cargo@v1
97+
with:
98+
command: run
99+
args: >
100+
--manifest-path=intel-mkl-tool/Cargo.toml
101+
--release
102+
--example seek
103+
env:
104+
MKLROOT: ${{ github.workspace }}

intel-mkl-tool/src/config.rs

Lines changed: 17 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,19 @@
11
use anyhow::{bail, Result};
22
use std::{fmt, str::FromStr};
33

4+
macro_rules! impl_otherwise {
5+
($e:ident, $a:ident, $b:ident) => {
6+
impl $e {
7+
pub fn otherwise(&self) -> Self {
8+
match self {
9+
$e::$a => $e::$b,
10+
$e::$b => $e::$a,
11+
}
12+
}
13+
}
14+
};
15+
}
16+
417
pub const VALID_CONFIGS: &[&str] = &[
518
"mkl-dynamic-ilp64-iomp",
619
"mkl-dynamic-ilp64-seq",
@@ -18,6 +31,7 @@ pub enum LinkType {
1831
Static,
1932
Dynamic,
2033
}
34+
impl_otherwise!(LinkType, Static, Dynamic);
2135

2236
impl fmt::Display for LinkType {
2337
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -56,6 +70,7 @@ pub enum DataModel {
5670
/// `int`, `long` and pointer are 64bit, i.e. `sizeof(int) == 8`
5771
ILP64,
5872
}
73+
impl_otherwise!(DataModel, LP64, ILP64);
5974

6075
impl fmt::Display for DataModel {
6176
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
@@ -92,6 +107,8 @@ pub enum Threading {
92107
Sequential,
93108
}
94109

110+
impl_otherwise!(Threading, OpenMP, Sequential);
111+
95112
impl Default for Threading {
96113
fn default() -> Self {
97114
Threading::Sequential
@@ -159,59 +176,6 @@ impl Config {
159176
.map(|name| Self::from_str(name).unwrap())
160177
.collect()
161178
}
162-
163-
/// Common components
164-
///
165-
/// The order must be following (or equivalent libs)
166-
///
167-
/// mkl_intel_lp64 > mkl_intel_thread > mkl_core > iomp5
168-
///
169-
pub fn libs(&self) -> Vec<String> {
170-
let mut libs = Vec::new();
171-
match self.index_size {
172-
DataModel::LP64 => {
173-
libs.push("mkl_intel_lp64".into());
174-
}
175-
DataModel::ILP64 => {
176-
libs.push("mkl_intel_ilp64".into());
177-
}
178-
};
179-
match self.parallel {
180-
Threading::OpenMP => {
181-
libs.push("mkl_intel_thread".into());
182-
}
183-
Threading::Sequential => {
184-
libs.push("mkl_sequential".into());
185-
}
186-
};
187-
libs.push("mkl_core".into());
188-
if matches!(self.parallel, Threading::OpenMP) {
189-
libs.push("iomp5".into());
190-
}
191-
libs
192-
}
193-
194-
/// Dynamically loaded libraries, e.g. `libmkl_vml_avx2.so`
195-
///
196-
/// - MKL seeks additional shared library **on runtime**.
197-
/// This function lists these files for packaging.
198-
pub fn additional_libs(&self) -> Vec<String> {
199-
match self.link {
200-
LinkType::Static => Vec::new(),
201-
LinkType::Dynamic => {
202-
let mut libs = Vec::new();
203-
for prefix in &["mkl", "mkl_vml"] {
204-
for suffix in &["def", "avx", "avx2", "avx512", "avx512_mic", "mc", "mc3"] {
205-
libs.push(format!("{}_{}", prefix, suffix));
206-
}
207-
}
208-
libs.push("mkl_rt".into());
209-
libs.push("mkl_vml_mc2".into());
210-
libs.push("mkl_vml_cmpt".into());
211-
libs
212-
}
213-
}
214-
}
215179
}
216180

217181
#[cfg(test)]

0 commit comments

Comments
 (0)