diff --git a/kernel/x86/KERNEL.NEHALEM b/kernel/x86/KERNEL.NEHALEM index 65b03ae50..835520efb 100644 --- a/kernel/x86/KERNEL.NEHALEM +++ b/kernel/x86/KERNEL.NEHALEM @@ -1 +1,3 @@ include $(KERNELDIR)/KERNEL.PENRYN +SSWAPKERNEL = ../arm/swap.c +DSWAPKERNEL = ../arm/swap.c diff --git a/utest/CMakeLists.txt b/utest/CMakeLists.txt index 75e6fad7f..1b426afe7 100644 --- a/utest/CMakeLists.txt +++ b/utest/CMakeLists.txt @@ -8,9 +8,32 @@ else () utest_main.c test_amax.c test_rotmg.c + test_rot.c + test_axpy.c + test_dsdot.c + test_swap.c ) endif () +# crashing on travis cl with an error code suggesting resource not found +if (NOT MSVC) +set(OpenBLAS_utest_src + ${OpenBLAS_utest_src} + test_dotu.c + ) +endif () + +# known to hang with the native Windows and Android threads +# FIXME needs checking if this works on any of the other platforms +if (NOT USE_OPENMP) +if (OS_CYGWIN_NT OR OS_LINUX) +set(OpenBLAS_utest_src + ${OpenBLAS_utest_src} + test_fork.c + ) +endif() +endif() + if (NOT NO_LAPACK) set(OpenBLAS_utest_src ${OpenBLAS_utest_src} diff --git a/utest/Makefile b/utest/Makefile index 625a3bcf4..e40b3c6db 100644 --- a/utest/Makefile +++ b/utest/Makefile @@ -8,20 +8,18 @@ UTESTBIN=openblas_utest include $(TOPDIR)/Makefile.system -OBJS=utest_main.o test_amax.o test_rotmg.o +OBJS=utest_main.o test_amax.o test_rotmg.o test_axpy.o test_dotu.o test_dsdot.o test_swap.o test_rot.o #test_rot.o test_swap.o test_axpy.o test_dotu.o test_dsdot.o test_fork.o ifneq ($(NO_LAPACK), 1) -#OBJS += test_potrs.o +OBJS += test_potrs.o endif +#this does not work with OpenMP nor with native Windows or Android threads +# FIXME TBD if this works on OSX, SunOS, POWER and zarch ifndef USE_OPENMP -ifndef OS_WINDOWS +ifeq ($(OSNAME), $(filter $(OSNAME),Linux CYGWIN_NT)) OBJS += test_fork.o -else -ifdef OS_CYGWIN_NT -OBJS += test_fork.o -endif endif endif diff --git a/utest/test_axpy.c b/utest/test_axpy.c index 696eb7a51..783755333 100644 --- a/utest/test_axpy.c +++ b/utest/test_axpy.c @@ -31,88 +31,81 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **********************************************************************************/ -#include "common_utest.h" +#include "openblas_utest.h" -void test_daxpy_inc_0(void) +CTEST(axpy,daxpy_inc_0) { - int i; - int N=8,incX=0,incY=0; + blasint i; + blasint N=8,incX=0,incY=0; double a=0.25; double x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0}; double y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0}; + double x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0}; - double y2[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0}; + double y2[]={4.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0}; //OpenBLAS BLASFUNC(daxpy)(&N,&a,x1,&incX,y1,&incY); - //reference - BLASFUNC_REF(daxpy)(&N,&a,x2,&incX,y2,&incY); for(i=0; i +#include -void test_zdotu_n_1(void) +CTEST( zdotu,zdotu_n_1) { - int N=1,incX=1,incY=1; + blasint N=1,incX=1,incY=1; double x1[]={1.0,1.0}; double y1[]={1.0,2.0}; - double x2[]={1.0,1.0}; - double y2[]={1.0,2.0}; - double _Complex result1=0.0; - double _Complex result2=0.0; - //OpenBLAS + + openblas_complex_double result1=openblas_make_complex_double(0.0,0.0); + openblas_complex_double result2=openblas_make_complex_double(-1.0000,3.0000); +#ifdef RETURN_BY_STACK + BLASFUNC(zdotu)(&result1,&N,x1,&incX,y1,&incY); +#else result1=BLASFUNC(zdotu)(&N,x1,&incX,y1,&incY); - //reference - result2=BLASFUNC_REF(zdotu)(&N,x2,&incX,y2,&incY); - - CU_ASSERT_DOUBLE_EQUAL(creal(result1), creal(result2), CHECK_EPS); - CU_ASSERT_DOUBLE_EQUAL(cimag(result1), cimag(result2), CHECK_EPS); -// printf("\%lf,%lf\n",creal(result1),cimag(result1)); - +#endif + +#ifdef OPENBLAS_COMPLEX_STRUCT + ASSERT_DBL_NEAR_TOL(result1.real, result2.real, DOUBLE_EPS); + ASSERT_DBL_NEAR_TOL(result1.imag, result2.imag, DOUBLE_EPS); +#else + ASSERT_DBL_NEAR_TOL(creal(result1), creal(result2), DOUBLE_EPS); + ASSERT_DBL_NEAR_TOL(cimag(result1), cimag(result2), DOUBLE_EPS); +#endif + } -void test_zdotu_offset_1(void) +CTEST(zdotu, zdotu_offset_1) { - int N=1,incX=1,incY=1; + blasint N=1,incX=1,incY=1; double x1[]={1.0,2.0,3.0,4.0}; double y1[]={5.0,6.0,7.0,8.0}; - double x2[]={1.0,2.0,3.0,4.0}; - double y2[]={5.0,6.0,7.0,8.0}; - double _Complex result1=0.0; - double _Complex result2=0.0; - //OpenBLAS + + openblas_complex_double result1=openblas_make_complex_double(0.0,0.0); + openblas_complex_double result2=openblas_make_complex_double(-9.0,32.0); +#ifdef RETURN_BY_STACK + BLASFUNC(zdotu)(&result1,&N,x1+1,&incX,y1+1,&incY); +#else result1=BLASFUNC(zdotu)(&N,x1+1,&incX,y1+1,&incY); - //reference - result2=BLASFUNC_REF(zdotu)(&N,x2+1,&incX,y2+1,&incY); - - CU_ASSERT_DOUBLE_EQUAL(creal(result1), creal(result2), CHECK_EPS); - CU_ASSERT_DOUBLE_EQUAL(cimag(result1), cimag(result2), CHECK_EPS); -// printf("\%lf,%lf\n",creal(result1),cimag(result1)); +#endif + +#ifdef OPENBLAS_COMPLEX_STRUCT + ASSERT_DBL_NEAR_TOL(result1.real, result2.real, DOUBLE_EPS); + ASSERT_DBL_NEAR_TOL(result1.imag, result2.imag, DOUBLE_EPS); +#else + ASSERT_DBL_NEAR_TOL(creal(result1), creal(result2), DOUBLE_EPS); + ASSERT_DBL_NEAR_TOL(cimag(result1), cimag(result2), DOUBLE_EPS); +#endif } - diff --git a/utest/test_dsdot.c b/utest/test_dsdot.c index 536153c7e..7d082a372 100644 --- a/utest/test_dsdot.c +++ b/utest/test_dsdot.c @@ -31,21 +31,19 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **********************************************************************************/ -#include "common_utest.h" +#include "openblas_utest.h" -void test_dsdot_n_1() +CTEST(dsdot,dsdot_n_1) { - float x= 0.172555164; - float y= -0.0138700781; - int incx=1; - int incy=1; - int n=1; + float x= 0.172555164F; + float y= -0.0138700781F; + blasint incx=1; + blasint incy=1; + blasint n=1; - double res1=0.0f, res2=0.0f; + double res1=0.0f, res2=-0.00239335360107; res1=BLASFUNC(dsdot)(&n, &x, &incx, &y, &incy); - res2=BLASFUNC_REF(dsdot)(&n, &x, &incx, &y, &incy); - - CU_ASSERT_DOUBLE_EQUAL(res1, res2, CHECK_EPS); + ASSERT_DBL_NEAR_TOL(res1, res2, DOUBLE_EPS); } diff --git a/utest/test_rot.c b/utest/test_rot.c index b8f9f177a..2a47b8058 100644 --- a/utest/test_rot.c +++ b/utest/test_rot.c @@ -31,88 +31,82 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. **********************************************************************************/ -#include "common_utest.h" +#include "openblas_utest.h" -void test_drot_inc_0(void) +CTEST(rot,drot_inc_0) { - int i=0; - int N=4,incX=0,incY=0; + blasint i=0; + blasint N=4,incX=0,incY=0; double c=0.25,s=0.5; double x1[]={1.0,3.0,5.0,7.0}; double y1[]={2.0,4.0,6.0,8.0}; - double x2[]={1.0,3.0,5.0,7.0}; - double y2[]={2.0,4.0,6.0,8.0}; + double x2[]={-0.21484375000000,3.0,5.0,7.0}; + double y2[]={ 0.03906250000000,4.0,6.0,8.0}; + //OpenBLAS BLASFUNC(drot)(&N,x1,&incX,y1,&incY,&c,&s); - //reference - BLASFUNC_REF(drot)(&N,x2,&incX,y2,&incY,&c,&s); for(i=0; i +#include #define CTEST_MAIN #define CTEST_SEGFAULT @@ -56,7 +57,7 @@ CTEST (drotmg,rotmg){ double te_y1, tr_y1; double te_param[5]; double tr_param[5]; - int i=0; + blasint i=0; // original test case for libGoto bug fixed by feb2014 rewrite te_d1= 0.21149573940783739; te_d2= 0.046892057172954082; @@ -103,7 +104,7 @@ CTEST (drotmg,rotmg_issue1452){ double te_y1, tr_y1; double te_param[5]; double tr_param[5]; - int i=0; + blasint i=0; // from issue #1452, buggy version returned 0.000244 for param[3] te_d1 = 5.9e-8; @@ -148,7 +149,7 @@ CTEST(drotmg, rotmg_D1eqD2_X1eqX2){ double te_y1, tr_y1; double te_param[5]; double tr_param[5]; - int i=0; + blasint i=0; te_d1= tr_d1=2.; te_d2= tr_d2=2.; te_x1= tr_x1=8.; @@ -183,9 +184,314 @@ CTEST(drotmg, rotmg_D1eqD2_X1eqX2){ } } +CTEST(axpy,daxpy_inc_0) +{ + blasint i; + blasint N=8,incX=0,incY=0; + double a=0.25; + double x1[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0}; + double y1[]={2.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0}; + + double x2[]={1.0,3.0,5.0,7.0,1.0,3.0,5.0,7.0}; + double y2[]={4.0,4.0,6.0,8.0,2.0,4.0,6.0,8.0}; + + //OpenBLAS + BLASFUNC(daxpy)(&N,&a,x1,&incX,y1,&incY); + + for(i=0; i