Skip to content

Commit 66ae109

Browse files
committed
Add test for dual LP64/ILP64 MKL v2022+
1 parent b1dc3d8 commit 66ae109

File tree

2 files changed

+60
-9
lines changed

2 files changed

+60
-9
lines changed

test/Manifest.toml

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ deps = ["Markdown"]
3232
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
3333

3434
[[JLLWrappers]]
35-
git-tree-sha1 = "a431f5f2ca3f4feef3bd7a5e94b8b8d4f2f647a0"
35+
deps = ["Preferences"]
36+
git-tree-sha1 = "22df5b96feef82434b07327e2d3c770a9b21e023"
3637
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
37-
version = "1.2.0"
38+
version = "1.4.0"
3839

3940
[[LazyArtifacts]]
4041
deps = ["Artifacts", "Pkg"]
@@ -64,9 +65,9 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
6465

6566
[[MKL_jll]]
6667
deps = ["Artifacts", "IntelOpenMP_jll", "JLLWrappers", "LazyArtifacts", "Libdl", "Pkg"]
67-
git-tree-sha1 = "c253236b0ed414624b083e6b72bfe891fbd2c7af"
68+
git-tree-sha1 = "e595b205efd49508358f7dc670a940c790204629"
6869
uuid = "856f044c-d86e-5d09-b602-aeab76dc8ba7"
69-
version = "2021.1.1+1"
70+
version = "2022.0.0+0"
7071

7172
[[Markdown]]
7273
deps = ["Base64"]
@@ -84,18 +85,24 @@ uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
8485

8586
[[OpenBLAS32_jll]]
8687
deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "Pkg"]
87-
git-tree-sha1 = "ba4a8f683303c9082e84afba96f25af3c7fb2436"
88+
git-tree-sha1 = "9c6c2ed4b7acd2137b878eb96c68e63b76199d0f"
8889
uuid = "656ef2d0-ae68-5445-9ca0-591084a874a2"
89-
version = "0.3.12+1"
90+
version = "0.3.17+0"
9091

9192
[[OpenBLAS_jll]]
9293
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
9394
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
9495

9596
[[Pkg]]
96-
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs"]
97+
deps = ["Artifacts", "Dates", "Downloads", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"]
9798
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
9899

100+
[[Preferences]]
101+
deps = ["TOML"]
102+
git-tree-sha1 = "2cf929d64681236a2e074ffafb8d568733d2e6af"
103+
uuid = "21216c6a-2e73-6563-6e65-726566657250"
104+
version = "1.2.3"
105+
99106
[[Printf]]
100107
deps = ["Unicode"]
101108
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
@@ -105,7 +112,7 @@ deps = ["InteractiveUtils", "Markdown", "Sockets", "Unicode"]
105112
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
106113

107114
[[Random]]
108-
deps = ["Serialization"]
115+
deps = ["SHA", "Serialization"]
109116
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
110117

111118
[[SHA]]
@@ -139,3 +146,7 @@ uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
139146
[[nghttp2_jll]]
140147
deps = ["Artifacts", "Libdl"]
141148
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
149+
150+
[[p7zip_jll]]
151+
deps = ["Artifacts", "Libdl"]
152+
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"

test/direct.jl

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using Libdl, Test, OpenBLAS_jll, OpenBLAS32_jll
1+
using Libdl, Test, OpenBLAS_jll, OpenBLAS32_jll, MKL_jll
22

33
include("utils.jl")
44

@@ -180,3 +180,43 @@ end
180180
self_traces = filter(entry -> string(entry.file) == @__FILE__, stacktraces[1])
181181
@test length(self_traces) == 3
182182
end
183+
184+
if MKL_jll.is_available() && Sys.WORD_SIZE == 64
185+
# Since MKL v2022, we can explicitly link against ILP64-suffixed symbols
186+
@testset "MKL v2022 ILP64 loading" begin
187+
# Load the ILP64 interface library. Remember, you must load the `core`
188+
# and a `threading` library first, with `RTLD_LAZY` for this to work!
189+
lbt_forward(lbt_handle, libmkl_rt; clear=true, suffix_hint = "64")
190+
191+
# Test that we have only one library loaded
192+
config = lbt_get_config(lbt_handle)
193+
libs = unpack_loaded_libraries(config)
194+
@test length(libs) == 1
195+
196+
# Test that it's MKL and it's correctly identified
197+
@test libs[1].libname == MKL_jll.libmkl_rt_path
198+
@test libs[1].interface == LBT_INTERFACE_ILP64
199+
200+
# Test that `dgemm` forwards to `dgemm_` within the MKL binary
201+
mkl_dgemm = dlsym(MKL_jll.libmkl_rt_handle, :dgemm_64)
202+
@test lbt_get_forward(lbt_handle, "dgemm_", LBT_INTERFACE_ILP64) == mkl_dgemm
203+
end
204+
205+
@testset "MKL v2022 dual-interface loading" begin
206+
# Also test that we can load both ILP64 and LP64 at the same time!
207+
lbt_forward(lbt_handle, libmkl_rt; clear=true, suffix_hint = "64")
208+
lbt_forward(lbt_handle, libmkl_rt; suffix_hint = "")
209+
210+
# Test that we have both libraries loaded
211+
config = lbt_get_config(lbt_handle)
212+
libs = unpack_loaded_libraries(config)
213+
@test length(libs) == 2
214+
215+
# Test that it's MKL and it's correctly identified
216+
sort!(libs; by = l -> l.libname)
217+
@test libs[1].libname == libmkl_rt
218+
@test libs[1].interface == LBT_INTERFACE_ILP64
219+
@test libs[2].libname == libmkl_rt
220+
@test libs[2].interface == LBT_INTERFACE_LP64
221+
end
222+
end

0 commit comments

Comments
 (0)