@@ -16,29 +16,35 @@ pub const VALID_CONFIGS: &[&str] = &[
16
16
#[ derive( Debug , Clone , Copy , PartialEq ) ]
17
17
pub enum LinkType {
18
18
Static ,
19
- Shared ,
19
+ Dynamic ,
20
20
}
21
21
22
22
impl fmt:: Display for LinkType {
23
23
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
24
24
match self {
25
25
LinkType :: Static => write ! ( f, "static" ) ,
26
- LinkType :: Shared => write ! ( f, "dynamic" ) ,
26
+ LinkType :: Dynamic => write ! ( f, "dynamic" ) ,
27
27
}
28
28
}
29
29
}
30
30
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.
31
35
#[ derive( Debug , Clone , Copy , PartialEq ) ]
32
- pub enum Interface {
36
+ pub enum DataModel {
37
+ /// `long` and pointer are 64bit, i.e. `sizeof(int) == 4`
33
38
LP64 ,
39
+ /// `int`, `long` and pointer are 64bit, i.e. `sizeof(int) == 8`
34
40
ILP64 ,
35
41
}
36
42
37
- impl fmt:: Display for Interface {
43
+ impl fmt:: Display for DataModel {
38
44
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
39
45
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" ) ,
42
48
}
43
49
}
44
50
}
@@ -61,13 +67,13 @@ impl fmt::Display for Threading {
61
67
}
62
68
}
63
69
64
- /// Configuration for linking Intel MKL, e.g. `mkl-static-lp64-seq`
70
+ /// Configuration for Intel MKL, e.g. `mkl-static-lp64-seq`
65
71
///
66
- /// There are 2x2x2=8 combinations of [LinkType], [Interface ], and [Threading].
72
+ /// There are 2x2x2=8 combinations of [LinkType], [DataModel ], and [Threading].
67
73
#[ derive( Debug , Clone , Copy , PartialEq ) ]
68
74
pub struct Config {
69
75
pub link : LinkType ,
70
- pub index_size : Interface ,
76
+ pub index_size : DataModel ,
71
77
pub parallel : Threading ,
72
78
}
73
79
@@ -90,13 +96,13 @@ impl Config {
90
96
91
97
let link = match parts[ 1 ] {
92
98
"static" => LinkType :: Static ,
93
- "dynamic" => LinkType :: Shared ,
99
+ "dynamic" => LinkType :: Dynamic ,
94
100
another => bail ! ( "Invalid link spec: {}" , another) ,
95
101
} ;
96
102
97
103
let index_size = match parts[ 2 ] {
98
- "lp64" => Interface :: LP64 ,
99
- "ilp64" => Interface :: ILP64 ,
104
+ "lp64" => DataModel :: LP64 ,
105
+ "ilp64" => DataModel :: ILP64 ,
100
106
another => bail ! ( "Invalid index spec: {}" , another) ,
101
107
} ;
102
108
@@ -129,10 +135,10 @@ impl Config {
129
135
pub fn libs ( & self ) -> Vec < String > {
130
136
let mut libs = Vec :: new ( ) ;
131
137
match self . index_size {
132
- Interface :: LP64 => {
138
+ DataModel :: LP64 => {
133
139
libs. push ( "mkl_intel_lp64" . into ( ) ) ;
134
140
}
135
- Interface :: ILP64 => {
141
+ DataModel :: ILP64 => {
136
142
libs. push ( "mkl_intel_ilp64" . into ( ) ) ;
137
143
}
138
144
} ;
@@ -158,7 +164,7 @@ impl Config {
158
164
pub fn additional_libs ( & self ) -> Vec < String > {
159
165
match self . link {
160
166
LinkType :: Static => Vec :: new ( ) ,
161
- LinkType :: Shared => {
167
+ LinkType :: Dynamic => {
162
168
let mut libs = Vec :: new ( ) ;
163
169
for prefix in & [ "mkl" , "mkl_vml" ] {
164
170
for suffix in & [ "def" , "avx" , "avx2" , "avx512" , "avx512_mic" , "mc" , "mc3" ] {
@@ -185,7 +191,7 @@ mod tests {
185
191
cfg,
186
192
Config {
187
193
link: LinkType :: Static ,
188
- index_size: Interface :: LP64 ,
194
+ index_size: DataModel :: LP64 ,
189
195
parallel: Threading :: OpenMP
190
196
}
191
197
) ;
0 commit comments