Skip to content

Add tests with reference BLAS and LAPACK #128

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ These BLAS libraries are known to work with libblastrampoline (successfully test
5. Fujitsu BLAS (use in Julia through [FujitsuBLAS.jl](https://github.com/giordano/FujitsuBLAS.jl))
6. [ARMPL BLAS](https://developer.arm.com/Tools%20and%20Software/Arm%20Performance%20Libraries)
7. [NVPL BLAS](https://docs.nvidia.com/nvpl/_static/blas/)
8. [Reference BLAS and LAPACK](https://github.com/Reference-LAPACK/lapack)

## Basic usage

Expand Down
4 changes: 4 additions & 0 deletions test/Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
[deps]
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
CompilerSupportLibraries_jll = "e66e0078-7015-5450-92f7-15fbd957f2ae"
LAPACK32_jll = "17f450c3-bd24-55df-bb84-8c51b4b939e3"
LAPACK_jll = "51474c39-65e3-53ba-86ba-03b1b862ec14"
MKL_jll = "856f044c-d86e-5d09-b602-aeab76dc8ba7"
OpenBLAS32_jll = "656ef2d0-ae68-5445-9ca0-591084a874a2"
OpenBLAS_jll = "4536629a-c528-5b80-bd46-f80d51c5b363"
ReferenceBLAS32_jll = "9e84b91c-71b0-5f24-acdc-49dbe8049396"
ReferenceBLAS_jll = "ee697234-451c-51c9-b102-303d89a9c3a0"

# Force an old version of OpenBLAS32_jll so that it's missing some newer symbols
[compat]
Expand Down
6 changes: 5 additions & 1 deletion test/dpstrf_test/dpstrf_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ int main()
// return value
MANGLE(dpstrf_)("U", &order, &A[0][0], &lda, &pivot[0], &rank, &tol, &work[0], &info);
if (info != 0) {
printf("ERROR: info == %ld!\n", info);
#ifdef ILP64
printf("ERROR: info == %ld!\n", info);
#else
printf("ERROR: info == %d!\n", info);
#endif
return 1;
}

Expand Down
21 changes: 21 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using OpenBLAS_jll, OpenBLAS32_jll, MKL_jll, CompilerSupportLibraries_jll
using ReferenceBLAS32_jll, LAPACK32_jll, ReferenceBLAS_jll, LAPACK_jll
using Pkg, Artifacts, Base.BinaryPlatforms, Libdl, Test

include("utils.jl")
Expand Down Expand Up @@ -124,6 +125,14 @@ end
run_all_tests("openblas", reverse(OpenBLAS32_jll.LIBPATH_list), :LP64, "")
end

@testset "Vanilla ReferenceBLAS32_jll (LP64)" begin
run_all_tests("blas32", reverse(ReferenceBLAS32_jll.LIBPATH_list), :LP64, "", tests = [dgemm, sdot])
end

# @testset "Vanilla ReferenceBLAS_jll (ILP64)" begin
# run_all_tests("blas", reverse(ReferenceBLAS_jll.LIBPATH_list), :ILP64, "", tests = [dgemm, sdot])
# end

# Next, build a version that links against `libblastrampoline`, and tell
# the trampoline to forwards calls to `OpenBLAS_jll`
lbt_link_name, lbt_dir = build_libblastrampoline()
Expand Down Expand Up @@ -170,6 +179,17 @@ end
end
end

@testset "LBT -> ReferenceBLAS32_jll / LAPACK32_jll (LP64)" begin
libdirs = unique(vcat(lbt_dir, ReferenceBLAS32_jll.LIBPATH_list..., LAPACK32_jll.LIBPATH_list..., CompilerSupportLibraries_jll.LIBPATH_list...))
run_all_tests(blastrampoline_link_name(), libdirs, :LP64, string(ReferenceBLAS32_jll.libblas32_path, ";", LAPACK32_jll.liblapack32_path); tests = [dgemm, dpstrf, sgesv, sdot])
end

# Disabling these tests for now, until we rename `libblas.so` and `liblapack.so` to `libblas64.so` and `liblapack64.so` in Yggdrasil.
# @testset "LBT -> ReferenceBLAS_jll / LAPACK_jll (ILP64)" begin
# libdirs = unique(vcat(lbt_dir, ReferenceBLAS_jll.LIBPATH_list..., LAPACK_jll.LIBPATH_list..., CompilerSupportLibraries_jll.LIBPATH_list...))
# run_all_tests(blastrampoline_link_name(), libdirs, :ILP64, string(ReferenceBLAS_jll.libblas_path, ";", LAPACK_jll.liblapack_path); tests = [dgemm, dpstrf, sgesv, sdot])
# end

# Test against MKL_jll using `libmkl_rt`, which is :LP64 by default
if MKL_jll.is_available()
# On i686, we can't do complex return style autodetection, so we manually set it,
Expand All @@ -178,6 +198,7 @@ if MKL_jll.is_available()
if Sys.ARCH == :i686
extra_env["LBT_FORCE_RETSTYLE"] = "ARGUMENT"
end

@testset "LBT -> MKL_jll (LP64)" begin
libdirs = unique(vcat(lbt_dir, MKL_jll.LIBPATH_list..., CompilerSupportLibraries_jll.LIBPATH_list...))
run_all_tests(blastrampoline_link_name(), libdirs, :LP64, MKL_jll.libmkl_rt_path; tests = [dgemm, dgemmt, dpstrf, sgesv, sdot, cdotc], extra_env)
Expand Down