Use BLAS rather than CBLAS in test_fork.c (#1626)
This is handy for people not using lapack.
This commit is contained in:
parent
a399d00425
commit
2aa0a5804e
|
@ -25,7 +25,6 @@ endif ()
|
||||||
|
|
||||||
# known to hang with the native Windows and Android threads
|
# known to hang with the native Windows and Android threads
|
||||||
# FIXME needs checking if this works on any of the other platforms
|
# FIXME needs checking if this works on any of the other platforms
|
||||||
if (NOT NO_CBLAS)
|
|
||||||
if (NOT USE_OPENMP)
|
if (NOT USE_OPENMP)
|
||||||
if (OS_CYGWIN_NT OR OS_LINUX)
|
if (OS_CYGWIN_NT OR OS_LINUX)
|
||||||
set(OpenBLAS_utest_src
|
set(OpenBLAS_utest_src
|
||||||
|
@ -34,7 +33,6 @@ set(OpenBLAS_utest_src
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
|
||||||
|
|
||||||
if (NOT NO_LAPACK)
|
if (NOT NO_LAPACK)
|
||||||
set(OpenBLAS_utest_src
|
set(OpenBLAS_utest_src
|
||||||
|
|
|
@ -17,13 +17,11 @@ endif
|
||||||
|
|
||||||
#this does not work with OpenMP nor with native Windows or Android threads
|
#this does not work with OpenMP nor with native Windows or Android threads
|
||||||
# FIXME TBD if this works on OSX, SunOS, POWER and zarch
|
# FIXME TBD if this works on OSX, SunOS, POWER and zarch
|
||||||
ifneq ($(NO_CBLAS), 1)
|
|
||||||
ifndef USE_OPENMP
|
ifndef USE_OPENMP
|
||||||
ifeq ($(OSNAME), $(filter $(OSNAME),Linux CYGWIN_NT))
|
ifeq ($(OSNAME), $(filter $(OSNAME),Linux CYGWIN_NT))
|
||||||
OBJS += test_fork.o
|
OBJS += test_fork.o
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endif
|
|
||||||
|
|
||||||
all : run_test
|
all : run_test
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,13 @@ void* xmalloc(size_t n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void check_dgemm(double *a, double *b, double *result, double *expected, int n)
|
void check_dgemm(double *a, double *b, double *result, double *expected, blasint n)
|
||||||
{
|
{
|
||||||
|
char trans1 = 'T';
|
||||||
|
char trans2 = 'N';
|
||||||
|
double zerod = 0, oned = 1;
|
||||||
int i;
|
int i;
|
||||||
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, n, n, n,
|
BLASFUNC(dgemm)(&trans1, &trans2, &n, &n, &n, &oned, a, &n, b, &n, &zerod, result, &n);
|
||||||
1.0, a, n, b, n, 0.0, result, n);
|
|
||||||
for(i = 0; i < n * n; ++i) {
|
for(i = 0; i < n * n; ++i) {
|
||||||
ASSERT_DBL_NEAR_TOL(expected[i], result[i], DOUBLE_EPS);
|
ASSERT_DBL_NEAR_TOL(expected[i], result[i], DOUBLE_EPS);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +62,7 @@ void check_dgemm(double *a, double *b, double *result, double *expected, int n)
|
||||||
|
|
||||||
CTEST(fork, safety)
|
CTEST(fork, safety)
|
||||||
{
|
{
|
||||||
int n = 1000;
|
blasint n = 1000;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
double *a, *b, *c, *d;
|
double *a, *b, *c, *d;
|
||||||
|
@ -84,8 +86,10 @@ CTEST(fork, safety)
|
||||||
|
|
||||||
// Compute a DGEMM product in the parent process prior to forking to
|
// Compute a DGEMM product in the parent process prior to forking to
|
||||||
// ensure that the OpenBLAS thread pool is initialized.
|
// ensure that the OpenBLAS thread pool is initialized.
|
||||||
cblas_dgemm(CblasRowMajor, CblasNoTrans, CblasNoTrans, n, n, n,
|
char trans1 = 'T';
|
||||||
1.0, a, n, b, n, 0.0, c, n);
|
char trans2 = 'N';
|
||||||
|
double zerod = 0, oned = 1;
|
||||||
|
BLASFUNC(dgemm)(&trans1, &trans2, &n, &n, &n, &oned, a, &n, b, &n, &zerod, c, &n);
|
||||||
|
|
||||||
fork_pid = fork();
|
fork_pid = fork();
|
||||||
if (fork_pid == -1) {
|
if (fork_pid == -1) {
|
||||||
|
|
Loading…
Reference in New Issue