From 630191c2b765328fa1597c2c097e769ada02acdb Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 21 Sep 2018 17:50:03 +0200 Subject: [PATCH] src/aubio_priv.h: split BLAS and ATLAS support --- src/aubio_priv.h | 18 +++++++++++++++--- src/fmat.c | 2 +- src/fvec.c | 2 +- src/mathutils.c | 6 +++--- 4 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/aubio_priv.h b/src/aubio_priv.h index 5bb10bfb..589c47af 100644 --- a/src/aubio_priv.h +++ b/src/aubio_priv.h @@ -70,12 +70,20 @@ #include #endif -#ifdef HAVE_ACCELERATE +#if defined(HAVE_ACCELERATE) #define HAVE_ATLAS 1 +#define HAVE_BLAS 1 #include #elif defined(HAVE_ATLAS_CBLAS_H) +#elif defined(HAVE_BLAS) +#if defined(HAVE_ATLAS_CBLAS_H) #define HAVE_ATLAS 1 #include +#elif defined(HAVE_OPENBLAS_CBLAS_H) +#include +#elif defined(HAVE_CBLAS_H) +#include +#endif #endif #ifdef HAVE_ACCELERATE @@ -111,19 +119,23 @@ #endif /* HAVE_AUBIO_DOUBLE */ #endif /* HAVE_ACCELERATE */ -#ifdef HAVE_ATLAS +#if defined(HAVE_BLAS) #ifndef HAVE_AUBIO_DOUBLE +#ifdef HAVE_ATLAS #define aubio_catlas_set catlas_sset +#endif /* HAVE_ATLAS */ #define aubio_cblas_copy cblas_scopy #define aubio_cblas_swap cblas_sswap #define aubio_cblas_dot cblas_sdot #else /* HAVE_AUBIO_DOUBLE */ +#ifdef HAVE_ATLAS #define aubio_catlas_set catlas_dset +#endif /* HAVE_ATLAS */ #define aubio_cblas_copy cblas_dcopy #define aubio_cblas_swap cblas_dswap #define aubio_cblas_dot cblas_ddot #endif /* HAVE_AUBIO_DOUBLE */ -#endif /* HAVE_ATLAS */ +#endif /* HAVE_BLAS */ #if defined HAVE_INTEL_IPP #include diff --git a/src/fmat.c b/src/fmat.c index c8541a52..307b0730 100644 --- a/src/fmat.c +++ b/src/fmat.c @@ -160,7 +160,7 @@ void fmat_vecmul(const fmat_t *s, const fvec_t *scale, fvec_t *output) { assert(s->height == output->length); assert(s->length == scale->length); #endif -#if !defined(HAVE_ACCELERATE) && !defined(HAVE_ATLAS) +#if !defined(HAVE_ACCELERATE) && !defined(HAVE_BLAS) uint_t j; fvec_zeros(output); for (j = 0; j < s->length; j++) { diff --git a/src/fvec.c b/src/fvec.c index d356f81a..3bb0b173 100644 --- a/src/fvec.c +++ b/src/fvec.c @@ -134,7 +134,7 @@ void fvec_copy(const fvec_t *s, fvec_t *t) { } #if defined(HAVE_INTEL_IPP) aubio_ippsCopy(s->data, t->data, (int)s->length); -#elif defined(HAVE_ATLAS) +#elif defined(HAVE_BLAS) aubio_cblas_copy(s->length, s->data, 1, t->data, 1); #elif defined(HAVE_ACCELERATE) aubio_vDSP_mmov(s->data, t->data, 1, s->length, 1, 1); diff --git a/src/mathutils.c b/src/mathutils.c index ef7b0dec..a40900ce 100644 --- a/src/mathutils.c +++ b/src/mathutils.c @@ -271,7 +271,7 @@ fvec_shift (fvec_t * s) uint_t half = s->length / 2, start = half, j; // if length is odd, middle element is moved to the end if (2 * half < s->length) start ++; -#ifndef HAVE_ATLAS +#ifndef HAVE_BLAS for (j = 0; j < half; j++) { ELEM_SWAP (s->data[j], s->data[j + start]); } @@ -291,7 +291,7 @@ fvec_ishift (fvec_t * s) uint_t half = s->length / 2, start = half, j; // if length is odd, middle element is moved to the beginning if (2 * half < s->length) start ++; -#ifndef HAVE_ATLAS +#ifndef HAVE_BLAS for (j = 0; j < half; j++) { ELEM_SWAP (s->data[j], s->data[j + start]); } @@ -328,7 +328,7 @@ smpl_t aubio_level_lin (const fvec_t * f) { smpl_t energy = 0.; -#ifndef HAVE_ATLAS +#ifndef HAVE_BLAS uint_t j; for (j = 0; j < f->length; j++) { energy += SQR (f->data[j]); -- 2.11.0