Make tests for individual variable types conditional on the respective BUILD_ option

This commit is contained in:
Martin Kroeker 2020-09-13 21:52:18 +02:00 committed by GitHub
parent 593ce9e237
commit ce89398636
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 78 additions and 12 deletions

View File

@ -33,6 +33,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "openblas_utest.h"
#ifdef BUILD_SINGLE
CTEST(amax, samax){
blasint N=3, inc=1;
float te_max=0.0, tr_max=0.0;
@ -43,7 +44,8 @@ CTEST(amax, samax){
ASSERT_DBL_NEAR_TOL((double)(tr_max), (double)(te_max), SINGLE_EPS);
}
#endif
#ifdef BUILD_DOUBLE
CTEST(amax, damax){
blasint N=3, inc=1;
double te_max=0.0, tr_max=0.0;
@ -54,3 +56,5 @@ CTEST(amax, damax){
ASSERT_DBL_NEAR_TOL((double)(tr_max), (double)(te_max), DOUBLE_EPS);
}
#endif

View File

@ -33,6 +33,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "openblas_utest.h"
#ifdef BUILD_DOUBLE
CTEST(axpy,daxpy_inc_0)
{
blasint i;
@ -52,7 +53,9 @@ CTEST(axpy,daxpy_inc_0)
ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
}
}
#endif
#ifdef BUILD_COMPLEX16
CTEST(axpy,zaxpy_inc_0)
{
blasint i;
@ -71,7 +74,9 @@ CTEST(axpy,zaxpy_inc_0)
ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
}
}
#endif
#ifdef BUILD_SINGLE
CTEST(axpy,saxpy_inc_0)
{
blasint i;
@ -90,7 +95,9 @@ CTEST(axpy,saxpy_inc_0)
ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
}
}
#endif
#ifdef BUILD_COMPLEX
CTEST(axpy,caxpy_inc_0)
{
blasint i;
@ -109,3 +116,5 @@ CTEST(axpy,caxpy_inc_0)
ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
}
}
#endif

View File

@ -33,6 +33,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "openblas_utest.h"
#ifdef BUILD_COMPLEX16
CTEST( zdotu,zdotu_n_1)
{
blasint N=1,incX=1,incY=1;
@ -80,3 +81,5 @@ CTEST(zdotu, zdotu_offset_1)
#endif
}
#endif

View File

@ -36,6 +36,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#define ELEMENTS 50
#define INCREMENT 2
#ifdef BUILD_SINGLE
CTEST(ismin, positive_step_2){
blasint i;
blasint N = ELEMENTS, inc = INCREMENT;
@ -87,3 +88,4 @@ CTEST(ismax, negative_step_2){
blasint index = BLASFUNC(ismax)(&N, x, &inc);
ASSERT_EQUAL(9, index);
}
#endif

View File

@ -32,7 +32,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**********************************************************************************/
#include "openblas_utest.h"
#ifdef BUILD_SINGLE
CTEST(min, smin_negative){
blasint N=3, inc=1;
float te_min=0.0, tr_min=0.0;
@ -43,7 +43,9 @@ CTEST(min, smin_negative){
ASSERT_DBL_NEAR_TOL((double)(tr_min), (double)(te_min), SINGLE_EPS);
}
#endif
#ifdef BUILD_DOUBLE
CTEST(min, dmin_positive){
blasint N=3, inc=1;
double te_min=0.0, tr_min=0.0;
@ -54,7 +56,9 @@ CTEST(min, dmin_positive){
ASSERT_DBL_NEAR_TOL((double)(tr_min), (double)(te_min), DOUBLE_EPS);
}
#endif
#ifdef BUILD_SINGLE
CTEST(min, smin_zero){
blasint N=3, inc=1;
float te_min=0.0, tr_min=0.0;
@ -76,7 +80,9 @@ CTEST(max, smax_negative){
ASSERT_DBL_NEAR_TOL((double)(tr_max), (double)(te_max), SINGLE_EPS);
}
#endif
#ifdef BUILD_DOUBLE
CTEST(max, dmax_positive){
blasint N=3, inc=1;
double te_max=0.0, tr_max=0.0;
@ -87,7 +93,8 @@ CTEST(max, dmax_positive){
ASSERT_DBL_NEAR_TOL((double)(tr_max), (double)(te_max), DOUBLE_EPS);
}
#endif
#ifdef BUILD_SINGLE
CTEST(max, smax_zero){
blasint N=3, inc=1;
float te_max=0.0, tr_max=0.0;
@ -98,3 +105,5 @@ CTEST(max, smax_zero){
ASSERT_DBL_NEAR_TOL((double)(tr_max), (double)(te_max), SINGLE_EPS);
}
#endif

View File

@ -39,10 +39,10 @@ void BLASFUNC(zpotrs_(char*, BLASINT*, BLASINT*, complex double*,
BLASINT*, complex double*, BLASINT*, BLASINT*);
*/
//https://github.com/xianyi/OpenBLAS/issues/695
CTEST(potrf, bug_695){
#ifdef BUILD_COMPLEX
openblas_complex_float A1[100] =
{
openblas_make_complex_float(5.8525753, +0.0),
@ -153,7 +153,9 @@ CTEST(potrf, bug_695){
blasint info[1];
BLASFUNC(cpotrf)(&up, &n, (float*)(A1), &n, info);
//printf("%g+%g*I\n", creal(A1[91]), cimag(A1[91]));
#endif
#ifdef BUILD_COMPLEX16
openblas_complex_double A2[100] =
{
openblas_make_complex_double(3.0607147216796875, +0.0),
@ -283,7 +285,8 @@ CTEST(potrf, bug_695){
char lo = 'L';
blasint nrhs = 2;
BLASFUNC(zpotrs)(&lo, &n, &nrhs, (double*)(A2), &n, (double*)(B), &n, info);
#endif
#ifdef BUILD_COMPLEX
// note that this is exactly equal to A1
openblas_complex_float A3[100] =
{
@ -393,9 +396,9 @@ CTEST(potrf, bug_695){
if(isnan(CREAL(A3[91])) || isnan(CIMAG(A3[91]))) {
CTEST_ERR("%s:%d got NaN", __FILE__, __LINE__);
}
#endif
}
// Check potrf factorizes a small problem correctly
CTEST(potrf, smoketest_trivial){
float A1s[4] = {2, 0.3, 0.3, 3};
@ -439,31 +442,43 @@ CTEST(potrf, smoketest_trivial){
uplo = 'U';
}
#ifdef BUILD_SINGLE
BLASFUNC(scopy)(&nv, A1s, &inc, As, &inc);
#endif
#ifdef BUILD_DOUBLE
BLASFUNC(dcopy)(&nv, A1d, &inc, Ad, &inc);
#endif
#ifdef BUILD_COMPLEX
BLASFUNC(ccopy)(&nv, (float *)A1c, &inc, (float *)Ac, &inc);
#endif
#ifdef BUILD_COMPLEX16
BLASFUNC(zcopy)(&nv, (double *)A1z, &inc, (double *)Az, &inc);
#endif
#ifdef BUILD_SINGLE
BLASFUNC(spotrf)(&uplo, &n, As, &n, &info);
if (info != 0) {
CTEST_ERR("%s:%d info != 0", __FILE__, __LINE__);
}
#endif
#ifdef BUILD_DOUBLE
BLASFUNC(dpotrf)(&uplo, &n, Ad, &n, &info);
if (info != 0) {
CTEST_ERR("%s:%d info != 0", __FILE__, __LINE__);
}
#endif
#ifdef BUILD_COMPLEX
BLASFUNC(cpotrf)(&uplo, &n, (float *)Ac, &n, &info);
if (info != 0) {
CTEST_ERR("%s:%d info != 0", __FILE__, __LINE__);
}
#endif
#ifdef BUILD_COMPLEX16
BLASFUNC(zpotrf)(&uplo, &n, (double *)Az, &n, &info);
if (info != 0) {
CTEST_ERR("%s:%d info != 0", __FILE__, __LINE__);
}
#endif
/* Fill the other triangle */
if (uplo == 'L') {
for (i = 0; i < n; ++i) {
@ -495,14 +510,20 @@ CTEST(potrf, smoketest_trivial){
trans1 = 'C';
trans2 = 'N';
}
#ifdef BUILD_SINGLE
BLASFUNC(sgemm)(&trans1, &trans2, &n, &n, &n, &ones, As, &n, As, &n, &zeros, Bs, &n);
#endif
#ifdef BUILD_DOUBLE
BLASFUNC(dgemm)(&trans1, &trans2, &n, &n, &n, &oned, Ad, &n, Ad, &n, &zerod, Bd, &n);
#endif
#ifdef BUILD_COMPLEX
BLASFUNC(cgemm)(&trans1, &trans2, &n, &n, &n, (float *)&onec,
(float *)Ac, &n, (float *)Ac, &n, (float *)&zeroc, (float *)Bc, &n);
#endif
#ifdef BUILD_COMPLEX16
BLASFUNC(zgemm)(&trans1, &trans2, &n, &n, &n, (double *)&onez,
(double *)Az, &n, (double *)Az, &n, (double *)&zeroz, (double *)Bz, &n);
#endif
/* Check result is close to original */
for (i = 0; i < n; ++i) {
for (j = 0; j < n; ++j) {

View File

@ -33,6 +33,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "openblas_utest.h"
#ifdef BUILD_DOUBLE
CTEST(rot,drot_inc_0)
{
blasint i=0;
@ -52,7 +53,9 @@ CTEST(rot,drot_inc_0)
ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
}
}
#endif
#ifdef BUILD_COMPLEX16
CTEST(rot,zdrot_inc_0)
{
blasint i=0;
@ -72,7 +75,9 @@ CTEST(rot,zdrot_inc_0)
ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
}
}
#endif
#ifdef BUILD_SINGLE
CTEST(rot,srot_inc_0)
{
blasint i=0;
@ -91,7 +96,9 @@ CTEST(rot,srot_inc_0)
ASSERT_DBL_NEAR_TOL(y2[i], y1[i], SINGLE_EPS);
}
}
#endif
#ifdef BUILD_COMPLEX
CTEST(rot, csrot_inc_0)
{
blasint i=0;
@ -110,3 +117,5 @@ CTEST(rot, csrot_inc_0)
ASSERT_DBL_NEAR_TOL(y2[i], y1[i], SINGLE_EPS);
}
}
#endif

View File

@ -33,6 +33,7 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#include "openblas_utest.h"
#ifdef BUILD_DOUBLE
CTEST(swap,dswap_inc_0)
{
blasint i=0;
@ -50,7 +51,9 @@ CTEST(swap,dswap_inc_0)
ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
}
}
#endif
#ifdef BUILD_COMPLEX16
CTEST(swap,zswap_inc_0)
{
blasint i=0;
@ -68,7 +71,9 @@ CTEST(swap,zswap_inc_0)
ASSERT_DBL_NEAR_TOL(y2[i], y1[i], DOUBLE_EPS);
}
}
#endif
#ifdef BUILD_SINGLE
CTEST(swap,sswap_inc_0)
{
blasint i=0;
@ -86,7 +91,9 @@ CTEST(swap,sswap_inc_0)
ASSERT_DBL_NEAR_TOL(y2[i], y1[i], SINGLE_EPS);
}
}
#endif
#ifdef BUILD_COMPLEX
CTEST(swap,cswap_inc_0)
{
blasint i=0;
@ -104,3 +111,5 @@ CTEST(swap,cswap_inc_0)
ASSERT_DBL_NEAR_TOL(y2[i], y1[i], SINGLE_EPS);
}
}
#endif