Skip to content

Commit dcd169c

Browse files
committed
Rename LinkType::Shared -> Dynamic, Interface -> DataModel
1 parent f84cfe2 commit dcd169c

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

intel-mkl-tool/src/config.rs

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,35 @@ pub const VALID_CONFIGS: &[&str] = &[
1616
#[derive(Debug, Clone, Copy, PartialEq)]
1717
pub enum LinkType {
1818
Static,
19-
Shared,
19+
Dynamic,
2020
}
2121

2222
impl fmt::Display for LinkType {
2323
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
2424
match self {
2525
LinkType::Static => write!(f, "static"),
26-
LinkType::Shared => write!(f, "dynamic"),
26+
LinkType::Dynamic => write!(f, "dynamic"),
2727
}
2828
}
2929
}
3030

31+
/// Data model of library
32+
///
33+
/// Array index of some APIs in MKL are defined by `int` in C,
34+
/// whose size is not fixed.
3135
#[derive(Debug, Clone, Copy, PartialEq)]
32-
pub enum Interface {
36+
pub enum DataModel {
37+
/// `long` and pointer are 64bit, i.e. `sizeof(int) == 4`
3338
LP64,
39+
/// `int`, `long` and pointer are 64bit, i.e. `sizeof(int) == 8`
3440
ILP64,
3541
}
3642

37-
impl fmt::Display for Interface {
43+
impl fmt::Display for DataModel {
3844
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
3945
match self {
40-
Interface::LP64 => write!(f, "lp64"),
41-
Interface::ILP64 => write!(f, "ilp64"),
46+
DataModel::LP64 => write!(f, "lp64"),
47+
DataModel::ILP64 => write!(f, "ilp64"),
4248
}
4349
}
4450
}
@@ -61,13 +67,13 @@ impl fmt::Display for Threading {
6167
}
6268
}
6369

64-
/// Configuration for linking Intel MKL, e.g. `mkl-static-lp64-seq`
70+
/// Configuration for Intel MKL, e.g. `mkl-static-lp64-seq`
6571
///
66-
/// There are 2x2x2=8 combinations of [LinkType], [Interface], and [Threading].
72+
/// There are 2x2x2=8 combinations of [LinkType], [DataModel], and [Threading].
6773
#[derive(Debug, Clone, Copy, PartialEq)]
6874
pub struct Config {
6975
pub link: LinkType,
70-
pub index_size: Interface,
76+
pub index_size: DataModel,
7177
pub parallel: Threading,
7278
}
7379

@@ -90,13 +96,13 @@ impl Config {
9096

9197
let link = match parts[1] {
9298
"static" => LinkType::Static,
93-
"dynamic" => LinkType::Shared,
99+
"dynamic" => LinkType::Dynamic,
94100
another => bail!("Invalid link spec: {}", another),
95101
};
96102

97103
let index_size = match parts[2] {
98-
"lp64" => Interface::LP64,
99-
"ilp64" => Interface::ILP64,
104+
"lp64" => DataModel::LP64,
105+
"ilp64" => DataModel::ILP64,
100106
another => bail!("Invalid index spec: {}", another),
101107
};
102108

@@ -129,10 +135,10 @@ impl Config {
129135
pub fn libs(&self) -> Vec<String> {
130136
let mut libs = Vec::new();
131137
match self.index_size {
132-
Interface::LP64 => {
138+
DataModel::LP64 => {
133139
libs.push("mkl_intel_lp64".into());
134140
}
135-
Interface::ILP64 => {
141+
DataModel::ILP64 => {
136142
libs.push("mkl_intel_ilp64".into());
137143
}
138144
};
@@ -158,7 +164,7 @@ impl Config {
158164
pub fn additional_libs(&self) -> Vec<String> {
159165
match self.link {
160166
LinkType::Static => Vec::new(),
161-
LinkType::Shared => {
167+
LinkType::Dynamic => {
162168
let mut libs = Vec::new();
163169
for prefix in &["mkl", "mkl_vml"] {
164170
for suffix in &["def", "avx", "avx2", "avx512", "avx512_mic", "mc", "mc3"] {
@@ -185,7 +191,7 @@ mod tests {
185191
cfg,
186192
Config {
187193
link: LinkType::Static,
188-
index_size: Interface::LP64,
194+
index_size: DataModel::LP64,
189195
parallel: Threading::OpenMP
190196
}
191197
);

intel-mkl-tool/src/entry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ impl Targets {
2121
{
2222
let target = match config.link {
2323
LinkType::Static => format!("{}{}.{}", mkl::PREFIX, name, mkl::EXTENSION_STATIC),
24-
LinkType::Shared => format!("{}{}.{}", mkl::PREFIX, name, mkl::EXTENSION_SHARED),
24+
LinkType::Dynamic => format!("{}{}.{}", mkl::PREFIX, name, mkl::EXTENSION_SHARED),
2525
};
2626
targets.insert(target, None);
2727
}
@@ -217,7 +217,7 @@ impl Entry {
217217
LinkType::Static => {
218218
println!("cargo:rustc-link-lib=static={}", lib);
219219
}
220-
LinkType::Shared => {
220+
LinkType::Dynamic => {
221221
println!("cargo:rustc-link-lib=dylib={}", lib);
222222
}
223223
}

0 commit comments

Comments
 (0)