Skip to content

Commit 89cc629

Browse files
committed
pkg-config feature will not works for mkl-*-*-iomp cases
1 parent d709c0a commit 89cc629

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

intel-mkl-tool/src/entry.rs

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,24 @@ pub struct Library {
2222
}
2323

2424
impl Library {
25-
/// Try to find MKL using pkg-config
25+
/// Find MKL using `pkg-config`
26+
///
27+
/// This only use the installed prefix obtained by `pkg-config --variable=prefix`
28+
///
29+
/// ```text
30+
/// $ pkg-config --variable=prefix mkl-static-lp64-seq
31+
/// /opt/intel/mkl
32+
/// ```
33+
///
34+
/// Then pass it to [Self::seek_directory].
35+
///
36+
/// Limitation
37+
/// -----------
38+
/// This will not work for `mkl-*-*-iomp` configure since `libiomp5.{a,so}`
39+
/// will not be found under the prefix directory of MKL.
40+
/// Please use `$MKLROOT` environment variable for this case,
41+
/// see [Self::new] for detail.
42+
///
2643
pub fn pkg_config(config: Config) -> Result<Option<Self>> {
2744
if let Ok(out) = Command::new("pkg-config")
2845
.arg("--variable=prefix")
@@ -48,6 +65,8 @@ impl Library {
4865
/// - This will seek the directory recursively until finding MKL libraries,
4966
/// but do not follow symbolic links.
5067
/// - This will not seek directory named `ia32*`
68+
/// - Retuns `Ok(None)` if `libiomp5.{a,so}` is not found with `mkl-*-*-iomp` configure
69+
/// even if MKL binaries are found.
5170
///
5271
pub fn seek_directory(config: Config, root_dir: impl AsRef<Path>) -> Result<Option<Self>> {
5372
let root_dir = root_dir.as_ref();
@@ -268,6 +287,10 @@ mod tests {
268287
#[test]
269288
fn pkg_config() {
270289
for cfg in Config::possibles() {
290+
// pkg-config will not work for `mkl-*-*-iomp` cases
291+
if cfg.parallel == Threading::OpenMP {
292+
continue;
293+
}
271294
let lib = Library::pkg_config(cfg).unwrap().unwrap();
272295
dbg!(lib.version().unwrap());
273296
}

0 commit comments

Comments
 (0)