Skip to content

Commit a6804e5

Browse files
committed
Move to cdotc instead of zdotc to avoid Windows x64 confusion
Our new `LBT_FORCE_RETSTYLE => ARGUMENT` doesn't work so well when it's already `ARGUMENT` on Windows x64.
1 parent dfd4f5f commit a6804e5

File tree

4 files changed

+34
-30
lines changed

4 files changed

+34
-30
lines changed

test/cdotc_test/Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
include ../../src/Make.inc
2+
3+
all: $(prefix)/cdotc_test$(EXE)
4+
5+
$(prefix):
6+
@mkdir -p $@
7+
8+
$(prefix)/cdotc_test$(EXE): cdotc_test.c | $(prefix)
9+
@$(CC) -o $@ $(CFLAGS) $^ $(LDFLAGS)
10+
11+
clean:
12+
@rm -f $(prefix)/cdotc_test$(EXE)
13+
14+
run: $(prefix)/cdotc_test$(EXE)
15+
@$(prefix)/cdotc_test$(EXE)

test/zdotc_test/zdotc_test.c renamed to test/cdotc_test/cdotc_test.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ typedef int64_t blasint;
1010
typedef int32_t blasint;
1111
#endif
1212

13-
extern void MANGLE(cblas_zdotc_sub)(blasint, double complex *, blasint, double complex *, blasint, double complex *);
14-
extern double complex MANGLE(zdotc_)(blasint *, double complex *, blasint *, double complex *, blasint *);
13+
extern void MANGLE(cblas_cdotc_sub)(blasint, float complex *, blasint, float complex *, blasint, float complex *);
14+
extern float complex MANGLE(cdotc_)(blasint *, float complex *, blasint *, float complex *, blasint *);
1515

1616
#define N 2
1717
int main()
1818
{
19-
double complex A[N], B[N];
19+
float complex A[N], B[N];
2020

2121
// Initialize `A` with known values (transposed into FORTRAN ordering)
2222
A[0] = 3.1 + 1.4*I;
@@ -30,13 +30,13 @@ int main()
3030
blasint len = N;
3131
blasint inca = 1;
3232
blasint incb = 1;
33-
complex double C;
34-
MANGLE(cblas_zdotc_sub)(len, &A[0], inca, &B[0], incb, &C);
33+
complex float C;
34+
MANGLE(cblas_cdotc_sub)(len, &A[0], inca, &B[0], incb, &C);
3535

3636
// Print out C
3737
printf("C (cblas) is: (%8.4f, %8.4f)\n", creal(C), cimag(C));
3838

3939
// Do the same thing, but with the FORTRAN interface
40-
C = MANGLE(zdotc_)(&len, &A[0], &inca, &B[0], &incb);
40+
C = MANGLE(cdotc_)(&len, &A[0], &inca, &B[0], &incb);
4141
printf("C (fortran) is: (%8.4f, %8.4f)\n", creal(C), cimag(C));
4242
}

test/runtests.jl

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -94,14 +94,14 @@ dpstrf = ("dpstrf_test", ("diag(A): 2.2601 1.8067 1.6970 0.4121",
9494
sgesv = ("sgesv_test", ("||b||^2 is: 3.0000",), true)
9595
sgesv_failure = ("sgesv_test", ("Error: no BLAS/LAPACK library loaded!",), false)
9696
sdot = ("sdot_test", ("C is: 1.9900",), true)
97-
zdotc = ("zdotc_test", (
97+
cdotc = ("cdotc_test", (
9898
"C (cblas) is: ( 1.4700, 3.8300)",
9999
"C (fortran) is: ( 1.4700, 3.8300)",
100100
), true)
101101

102102
# Helper function to run all the tests with the given arguments
103103
# Does not include `dgemmt` because that's MKL-only
104-
function run_all_tests(args...; tests = [dgemm, dpstrf, sgesv, sdot, zdotc])
104+
function run_all_tests(args...; tests = [dgemm, dpstrf, sgesv, sdot, cdotc])
105105
for test in tests
106106
run_test(test, args...)
107107
end
@@ -133,10 +133,14 @@ lbt_dir = joinpath(lbt_dir, binlib)
133133
run_all_tests(blastrampoline_link_name(), libdirs, openblas_interface, OpenBLAS_jll.libopenblas_path)
134134

135135
# Test that setting bad `LBT_FORCE_*` values actually breaks things
136+
# This can be somewhat unpredictable (segfaulting sometimes, returning zero other times)
137+
# so it's hard to test on CI, so we comment it out for now.
138+
#=
136139
withenv("LBT_FORCE_RETSTYLE" => "ARGUMENT") do
137-
zdotc_fail = ("zdotc_test", [], false)
138-
run_test(zdotc_fail, blastrampoline_link_name(), libdirs, openblas_interface, OpenBLAS_jll.libopenblas_path)
140+
cdotc_fail = ("cdotc_test", cdotc[2], false)
141+
run_test(cdotc_fail, blastrampoline_link_name(), libdirs, openblas_interface, OpenBLAS_jll.libopenblas_path)
139142
end
143+
=#
140144
end
141145

142146
# And again, but this time with OpenBLAS32_jll
@@ -156,15 +160,15 @@ end
156160
if MKL_jll.is_available()
157161
@testset "LBT -> MKL_jll (LP64)" begin
158162
libdirs = unique(vcat(lbt_dir, MKL_jll.LIBPATH_list..., CompilerSupportLibraries_jll.LIBPATH_list...))
159-
run_all_tests(blastrampoline_link_name(), libdirs, :LP64, MKL_jll.libmkl_rt_path; tests = [dgemm, dgemmt, dpstrf, sgesv, sdot, zdotc])
163+
run_all_tests(blastrampoline_link_name(), libdirs, :LP64, MKL_jll.libmkl_rt_path; tests = [dgemm, dgemmt, dpstrf, sgesv, sdot, cdotc])
160164
end
161165

162166
# Test that we can set MKL's interface via an environment variable to select ILP64, and LBT detects it properly
163167
if Sys.WORD_SIZE == 64
164168
@testset "LBT -> MKL_jll (ILP64, via env)" begin
165169
withenv("MKL_INTERFACE_LAYER" => "ILP64") do
166170
libdirs = unique(vcat(lbt_dir, MKL_jll.LIBPATH_list..., CompilerSupportLibraries_jll.LIBPATH_list...))
167-
run_all_tests(blastrampoline_link_name(), libdirs, :ILP64, MKL_jll.libmkl_rt_path; tests = [dgemm, dgemmt, dpstrf, sgesv, sdot, zdotc])
171+
run_all_tests(blastrampoline_link_name(), libdirs, :ILP64, MKL_jll.libmkl_rt_path; tests = [dgemm, dgemmt, dpstrf, sgesv, sdot, cdotc])
168172
end
169173
end
170174
end
@@ -177,7 +181,7 @@ veclib_blas_path = "/System/Library/Frameworks/Accelerate.framework/Versions/A/F
177181
if dlopen_e(veclib_blas_path) != C_NULL
178182
# Test that we can run BLAS-only tests without LAPACK loaded (`sgesv` test requires LAPACK symbols)
179183
@testset "LBT -> vecLib/libBLAS" begin
180-
run_all_tests(blastrampoline_link_name(), [lbt_dir], :LP64, veclib_blas_path; tests=[dgemm, sdot, zdotc])
184+
run_all_tests(blastrampoline_link_name(), [lbt_dir], :LP64, veclib_blas_path; tests=[dgemm, sdot, cdotc])
181185
end
182186

183187
# With LAPACK as well, run all tests except `dgemmt`
@@ -190,14 +194,14 @@ if dlopen_e(veclib_blas_path) != C_NULL
190194
if dlsym_e(veclib_lapack_handle, "dpotrf\$NEWLAPACK\$ILP64") != C_NULL
191195
@testset "LBT -> vecLib/libBLAS (ILP64)" begin
192196
veclib_blas_path_ilp64 = "$(veclib_blas_path)!\x1a\$NEWLAPACK\$ILP64"
193-
run_all_tests(blastrampoline_link_name(), [lbt_dir], :ILP64, veclib_blas_path_ilp64; tests=[dgemm, sdot, zdotc])
197+
run_all_tests(blastrampoline_link_name(), [lbt_dir], :ILP64, veclib_blas_path_ilp64; tests=[dgemm, sdot, cdotc])
194198
end
195199

196200
@testset "LBT -> vecLib/libLAPACK (ILP64)" begin
197201
veclib_lapack_path_ilp64 = "$(veclib_lapack_path)!\x1a\$NEWLAPACK\$ILP64"
198202
@warn("dpstrf test broken on new LAPACK in Accelerate")
199203
dpstrf_broken = (dpstrf[1], "diag(A): 2.2601 1.7140 0.6206 1.1878", true)
200-
run_all_tests(blastrampoline_link_name(), [lbt_dir], :ILP64, veclib_lapack_path_ilp64; tests=[dgemm, dpstrf_broken, sgesv, sdot, zdotc])
204+
run_all_tests(blastrampoline_link_name(), [lbt_dir], :ILP64, veclib_lapack_path_ilp64; tests=[dgemm, dpstrf_broken, sgesv, sdot, cdotc])
201205
end
202206
end
203207
end

test/zdotc_test/Makefile

Lines changed: 0 additions & 15 deletions
This file was deleted.

0 commit comments

Comments
 (0)