Skip to content

Commit 2aa0a58

Browse files
oon3m0oomartin-frbg
authored andcommitted
Use BLAS rather than CBLAS in test_fork.c (#1626)
This is handy for people not using lapack.
1 parent a399d00 commit 2aa0a58

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

utest/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ endif ()
2525

2626
# known to hang with the native Windows and Android threads
2727
# FIXME needs checking if this works on any of the other platforms
28-
if (NOT NO_CBLAS)
2928
if (NOT USE_OPENMP)
3029
if (OS_CYGWIN_NT OR OS_LINUX)
3130
set(OpenBLAS_utest_src
@@ -34,7 +33,6 @@ set(OpenBLAS_utest_src
3433
)
3534
endif()
3635
endif()
37-
endif()
3836

3937
if (NOT NO_LAPACK)
4038
set(OpenBLAS_utest_src

utest/Makefile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,11 @@ endif
1717

1818
#this does not work with OpenMP nor with native Windows or Android threads
1919
# FIXME TBD if this works on OSX, SunOS, POWER and zarch
20-
ifneq ($(NO_CBLAS), 1)
2120
ifndef USE_OPENMP
2221
ifeq ($(OSNAME), $(filter $(OSNAME),Linux CYGWIN_NT))
2322
OBJS += test_fork.o
2423
endif
2524
endif
26-
endif
2725

2826
all : run_test
2927

utest/test_fork.c

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ modification, are permitted provided that the following conditions are
1313
notice, this list of conditions and the following disclaimer in
1414
the documentation and/or other materials provided with the
1515
distribution.
16-
3. Neither the name of the OpenBLAS project nor the names of
17-
its contributors may be used to endorse or promote products
18-
derived from this software without specific prior written
16+
3. Neither the name of the OpenBLAS project nor the names of
17+
its contributors may be used to endorse or promote products
18+
derived from this software without specific prior written
1919
permission.
2020
2121
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
@@ -48,19 +48,21 @@ void* xmalloc(size_t n)
4848
}
4949
}
5050

51-
void check_dgemm(double *a, double *b, double *result, double *expected, int n)
51+
void check_dgemm(double *a, double *b, double *result, double *expected, blasint n)
5252
{
53+
char trans1 = 'T';
54+
char trans2 = 'N';
55+
double zerod = 0, oned = 1;
5356
int i;
54-
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, n, n, n,
55-
1.0, a, n, b, n, 0.0, result, n);
57+
BLASFUNC(dgemm)(&trans1, &trans2, &n, &n, &n, &oned, a, &n, b, &n, &zerod, result, &n);
5658
for(i = 0; i < n * n; ++i) {
5759
ASSERT_DBL_NEAR_TOL(expected[i], result[i], DOUBLE_EPS);
5860
}
5961
}
6062

6163
CTEST(fork, safety)
6264
{
63-
int n = 1000;
65+
blasint n = 1000;
6466
int i;
6567

6668
double *a, *b, *c, *d;
@@ -84,8 +86,10 @@ CTEST(fork, safety)
8486

8587
// Compute a DGEMM product in the parent process prior to forking to
8688
// ensure that the OpenBLAS thread pool is initialized.
87-
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, n, n, n,
88-
1.0, a, n, b, n, 0.0, c, n);
89+
char trans1 = 'T';
90+
char trans2 = 'N';
91+
double zerod = 0, oned = 1;
92+
BLASFUNC(dgemm)(&trans1, &trans2, &n, &n, &n, &oned, a, &n, b, &n, &zerod, c, &n);
8993

9094
fork_pid = fork();
9195
if (fork_pid == -1) {

0 commit comments

Comments
 (0)