diff --git a/utest/CMakeLists.txt b/utest/CMakeLists.txt index 75e6fad7f..c179c7bcb 100644 --- a/utest/CMakeLists.txt +++ b/utest/CMakeLists.txt @@ -8,9 +8,28 @@ else () utest_main.c test_amax.c test_rotmg.c + test_rot.c + test_axpy.c + test_dotu.c + test_dsdot.c + test_swap.c ) endif () +if (NOT USE_OPENMP) +if (NOT OS_WINDOWS) +set(OpenBLAS_utest_src + ${OpenBLAS_utest_src} + test_fork.c + ) +elseif (OS_CYGWIN_NT) +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 03457b0c4..1b43fd303 100644 --- a/utest/Makefile +++ b/utest/Makefile @@ -8,13 +8,14 @@ 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 endif +ifndef USE_OPENMP ifndef OS_WINDOWS OBJS += test_fork.o else @@ -22,6 +23,7 @@ ifdef OS_CYGWIN_NT OBJS += test_fork.o endif endif +endif all : run_test diff --git a/utest/test_axpy.c b/utest/test_axpy.c index 696eb7a51..826ab2e5d 100644 --- a/utest/test_axpy.c +++ b/utest/test_axpy.c @@ -31,30 +31,29 @@ 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; 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 -void test_zdotu_n_1(void) +CTEST( zdotu,zdotu_n_1) { int N=1,incX=1,incY=1; double x1[]={1.0,1.0}; @@ -42,19 +42,17 @@ void test_zdotu_n_1(void) double x2[]={1.0,1.0}; double y2[]={1.0,2.0}; double _Complex result1=0.0; - double _Complex result2=0.0; + double _Complex result2={-1.0000+3.0000*I}; //OpenBLAS 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); + ASSERT_DBL_NEAR_TOL(creal(result1), creal(result2), DOUBLE_EPS); + ASSERT_DBL_NEAR_TOL(cimag(result1), cimag(result2), DOUBLE_EPS); // printf("\%lf,%lf\n",creal(result1),cimag(result1)); } -void test_zdotu_offset_1(void) +CTEST(zdotu, zdotu_offset_1) { int N=1,incX=1,incY=1; double x1[]={1.0,2.0,3.0,4.0}; @@ -62,14 +60,12 @@ void test_zdotu_offset_1(void) 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; + double _Complex result2={-9.0000+32.0000*I}; //OpenBLAS 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); + ASSERT_DBL_NEAR_TOL(creal(result1), creal(result2), DOUBLE_EPS); + ASSERT_DBL_NEAR_TOL(cimag(result1), cimag(result2), DOUBLE_EPS); // printf("\%lf,%lf\n",creal(result1),cimag(result1)); } diff --git a/utest/test_dsdot.c b/utest/test_dsdot.c index 536153c7e..c8170c950 100644 --- a/utest/test_dsdot.c +++ b/utest/test_dsdot.c @@ -31,9 +31,9 @@ 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; @@ -41,11 +41,9 @@ void test_dsdot_n_1() int incy=1; int 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..d1d8b51dd 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; 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 @@ -183,6 +184,282 @@ CTEST(drotmg, rotmg_D1eqD2_X1eqX2){ } } +CTEST(axpy,daxpy_inc_0) +{ + int i; + int 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