diff --git a/CMakeLists.txt b/CMakeLists.txt index 35030000..6d9761e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -415,10 +415,8 @@ else() if(ATLAS_FOUND) set(ARMA_USE_ATLAS true) - set(ARMA_ATLAS_INCLUDE_DIR ${ATLAS_INCLUDE_DIR}) set(ARMA_LIBS ${ARMA_LIBS} ${ATLAS_LIBRARIES}) - message(STATUS "ATLAS_INCLUDE_DIR = ${ATLAS_INCLUDE_DIR}") message(STATUS "") message(STATUS "*** NOTE: support for ATLAS is deprecated and will be removed;") message(STATUS "*** NOTE: recommend to use OpenBLAS or FlexiBLAS instead.") diff --git a/cmake_aux/Modules/ARMA_FindATLAS.cmake b/cmake_aux/Modules/ARMA_FindATLAS.cmake index 491a3617..6ad1eee6 100644 --- a/cmake_aux/Modules/ARMA_FindATLAS.cmake +++ b/cmake_aux/Modules/ARMA_FindATLAS.cmake @@ -1,20 +1,3 @@ -find_path(ATLAS_CBLAS_INCLUDE_DIR -NAMES cblas.h -PATHS /usr/include/atlas/ /usr/include/ /usr/local/include/atlas/ /usr/local/include/ -) - -find_path(ATLAS_CLAPACK_INCLUDE_DIR -NAMES clapack.h -PATHS /usr/include/atlas/ /usr/include/ /usr/local/include/atlas/ /usr/local/include/ -) - -if(ATLAS_CBLAS_INCLUDE_DIR AND ATLAS_CLAPACK_INCLUDE_DIR) - if(ATLAS_CBLAS_INCLUDE_DIR STREQUAL ATLAS_CLAPACK_INCLUDE_DIR) - set(ATLAS_INCLUDE_DIR ${ATLAS_CBLAS_INCLUDE_DIR}) - endif() -endif() - - set(ATLAS_NAMES) set(ATLAS_NAMES ${ATLAS_NAMES} tatlas) set(ATLAS_NAMES ${ATLAS_NAMES} satlas) @@ -45,7 +28,7 @@ if(ATLAS_TMP_LIBRARIES) endif() -if(ATLAS_LIBRARY AND ATLAS_INCLUDE_DIR) +if(ATLAS_LIBRARY) set(ATLAS_LIBRARIES ${ATLAS_LIBRARY}) set(ATLAS_FOUND "YES") else() @@ -64,4 +47,4 @@ else() endif() -# mark_as_advanced(ATLAS_LIBRARY ATLAS_INCLUDE_DIR) +# mark_as_advanced(ATLAS_LIBRARY) diff --git a/include/armadillo b/include/armadillo index 139dfbbe..ea56ebe3 100644 --- a/include/armadillo +++ b/include/armadillo @@ -73,7 +73,6 @@ #endif -#include "armadillo_bits/include_atlas.hpp" #include "armadillo_bits/include_hdf5.hpp" #include "armadillo_bits/include_superlu.hpp" @@ -122,15 +121,15 @@ namespace arma #include "armadillo_bits/SpBase_bones.hpp" #include "armadillo_bits/def_blas.hpp" - #include "armadillo_bits/def_lapack.hpp" #include "armadillo_bits/def_atlas.hpp" + #include "armadillo_bits/def_lapack.hpp" #include "armadillo_bits/def_arpack.hpp" #include "armadillo_bits/def_superlu.hpp" #include "armadillo_bits/def_hdf5.hpp" #include "armadillo_bits/translate_blas.hpp" - #include "armadillo_bits/translate_lapack.hpp" #include "armadillo_bits/translate_atlas.hpp" + #include "armadillo_bits/translate_lapack.hpp" #include "armadillo_bits/translate_arpack.hpp" #include "armadillo_bits/translate_superlu.hpp" diff --git a/include/armadillo_bits/config.hpp b/include/armadillo_bits/config.hpp index 6b86ed8a..6072eb6b 100644 --- a/include/armadillo_bits/config.hpp +++ b/include/armadillo_bits/config.hpp @@ -68,6 +68,11 @@ //// Make sure the directory has a trailing / #endif +#if !defined(ARMA_USE_ATLAS) +// #define ARMA_USE_ATLAS +//// NOTE: support for ATLAS is deprecated and will be removed. +#endif + // #define ARMA_USE_WRAPPER //// Comment out the above line if you're getting linking errors when compiling your programs, //// or if you prefer to directly link with LAPACK, BLAS + etc instead of the Armadillo runtime library. @@ -111,13 +116,6 @@ //// You may also need to enable or disable the following options: //// ARMA_BLAS_LONG, ARMA_BLAS_LONG_LONG, ARMA_USE_FORTRAN_HIDDEN_ARGS -// #define ARMA_USE_ATLAS -// #define ARMA_ATLAS_INCLUDE_DIR /usr/include/ -//// NOTE: support for ATLAS is deprecated and will be removed. -//// If you're using ATLAS and the compiler can't find cblas.h and/or clapack.h -//// uncomment the above define and specify the appropriate include directory. -//// Make sure the directory has a trailing / - #if !defined(ARMA_USE_OPENMP) // #define ARMA_USE_OPENMP //// Uncomment the above line to forcefully enable use of OpenMP for parallelisation. @@ -258,7 +256,6 @@ #if defined(ARMA_DONT_USE_ATLAS) #undef ARMA_USE_ATLAS - #undef ARMA_ATLAS_INCLUDE_DIR #endif #if defined(ARMA_DONT_USE_WRAPPER) diff --git a/include/armadillo_bits/config.hpp.cmake b/include/armadillo_bits/config.hpp.cmake index eb4a3a82..62d8f635 100644 --- a/include/armadillo_bits/config.hpp.cmake +++ b/include/armadillo_bits/config.hpp.cmake @@ -68,6 +68,11 @@ //// Make sure the directory has a trailing / #endif +#if !defined(ARMA_USE_ATLAS) +#cmakedefine ARMA_USE_ATLAS +//// NOTE: support for ATLAS is deprecated and will be removed. +#endif + #cmakedefine ARMA_USE_WRAPPER //// Comment out the above line if you're getting linking errors when compiling your programs, //// or if you prefer to directly link with LAPACK, BLAS + etc instead of the Armadillo runtime library. @@ -111,13 +116,6 @@ //// You may also need to enable or disable the following options: //// ARMA_BLAS_LONG, ARMA_BLAS_LONG_LONG, ARMA_USE_FORTRAN_HIDDEN_ARGS -#cmakedefine ARMA_USE_ATLAS -#define ARMA_ATLAS_INCLUDE_DIR ${ARMA_ATLAS_INCLUDE_DIR}/ -//// NOTE: support for ATLAS is deprecated and will be removed. -//// If you're using ATLAS and the compiler can't find cblas.h and/or clapack.h -//// uncomment the above define and specify the appropriate include directory. -//// Make sure the directory has a trailing / - #if !defined(ARMA_USE_OPENMP) // #define ARMA_USE_OPENMP //// Uncomment the above line to forcefully enable use of OpenMP for parallelisation. @@ -256,6 +254,10 @@ #undef ARMA_SUPERLU_INCLUDE_DIR #endif +#if defined(ARMA_DONT_USE_ATLAS) + #undef ARMA_USE_ATLAS +#endif + #if defined(ARMA_DONT_USE_WRAPPER) #undef ARMA_USE_WRAPPER #undef ARMA_USE_HDF5_ALT diff --git a/include/armadillo_bits/def_atlas.hpp b/include/armadillo_bits/def_atlas.hpp index 2d542006..d0621d2b 100644 --- a/include/armadillo_bits/def_atlas.hpp +++ b/include/armadillo_bits/def_atlas.hpp @@ -16,88 +16,63 @@ // ------------------------------------------------------------------------ +// TODO: remove support for ATLAS in next major version + #ifdef ARMA_USE_ATLAS -// TODO: remove support for ATLAS in next major version - -//! \namespace atlas namespace for ATLAS functions (imported from the global namespace) -namespace atlas +typedef enum { - using ::CblasColMajor; - using ::CblasNoTrans; - using ::CblasTrans; - using ::CblasConjTrans; - using ::CblasLower; - using ::CblasUpper; + atlas_CblasRowMajor = 101, + atlas_CblasColMajor = 102 + } + atlas_CBLAS_LAYOUT; + +typedef enum + { + atlas_CblasNoTrans = 111, + atlas_CblasTrans = 112, + atlas_CblasConjTrans = 113 + } + atlas_CBLAS_TRANS; - #if defined(ARMA_USE_WRAPPER) - extern "C" - { - float wrapper_cblas_sasum(const int N, const float *X, const int incX); - double wrapper_cblas_dasum(const int N, const double *X, const int incX); - - float wrapper_cblas_snrm2(const int N, const float *X, const int incX); - double wrapper_cblas_dnrm2(const int N, const double *X, const int incX); - - float wrapper_cblas_sdot(const int N, const float *X, const int incX, const float *Y, const int incY); - double wrapper_cblas_ddot(const int N, const double *X, const int incX, const double *Y, const int incY); - - void wrapper_cblas_cdotu_sub(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu); - void wrapper_cblas_zdotu_sub(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu); - - - void wrapper_cblas_sgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const float alpha, - const float *A, const int lda, const float *X, const int incX, const float beta, float *Y, const int incY); - - void wrapper_cblas_dgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const double alpha, - const double *A, const int lda, const double *X, const int incX, const double beta, double *Y, const int incY); - - void wrapper_cblas_cgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const void *alpha, - const void *A, const int lda, const void *X, const int incX, const void *beta, void *Y, const int incY); - - void wrapper_cblas_zgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const void *alpha, - const void *A, const int lda, const void *X, const int incX, const void *beta, void *Y, const int incY); - - - - void wrapper_cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, - const int M, const int N, const int K, const float alpha, - const float *A, const int lda, const float *B, const int ldb, const float beta, float *C, const int ldc); - - void wrapper_cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, - const int M, const int N, const int K, const double alpha, - const double *A, const int lda, const double *B, const int ldb, const double beta, double *C, const int ldc); - - void wrapper_cblas_cgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, - const int M, const int N, const int K, const void *alpha, - const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc); - - void wrapper_cblas_zgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, - const int M, const int N, const int K, const void *alpha, - const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc); - - - - void wrapper_cblas_ssyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, - const int N, const int K, const float alpha, - const float *A, const int lda, const float beta, float *C, const int ldc); - - void wrapper_cblas_dsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, - const int N, const int K, const double alpha, - const double *A, const int lda, const double beta, double *C, const int ldc); - - - - void wrapper_cblas_cherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, - const int N, const int K, const float alpha, - const void *A, const int lda, const float beta, void *C, const int ldc); - - void wrapper_cblas_zherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, - const int N, const int K, const double alpha, - const void *A, const int lda, const double beta, void *C, const int ldc); - } - #endif +typedef enum + { + atlas_CblasUpper = 121, + atlas_CblasLower = 122 + } + atlas_CBLAS_UPLO; + + +extern "C" + { + float arma_wrapper(cblas_sasum)(const int N, const float *X, const int incX); + double arma_wrapper(cblas_dasum)(const int N, const double *X, const int incX); + + float arma_wrapper(cblas_snrm2)(const int N, const float *X, const int incX); + double arma_wrapper(cblas_dnrm2)(const int N, const double *X, const int incX); + + float arma_wrapper(cblas_sdot)(const int N, const float *X, const int incX, const float *Y, const int incY); + double arma_wrapper(cblas_ddot)(const int N, const double *X, const int incX, const double *Y, const int incY); + + void arma_wrapper(cblas_cdotu_sub)(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu); + void arma_wrapper(cblas_zdotu_sub)(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu); + + void arma_wrapper(cblas_sgemv)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const float alpha, const float *A, const int lda, const float *X, const int incX, const float beta, float *Y, const int incY); + void arma_wrapper(cblas_dgemv)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const double alpha, const double *A, const int lda, const double *X, const int incX, const double beta, double *Y, const int incY); + void arma_wrapper(cblas_cgemv)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const void *alpha, const void *A, const int lda, const void *X, const int incX, const void *beta, void *Y, const int incY); + void arma_wrapper(cblas_zgemv)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const void *alpha, const void *A, const int lda, const void *X, const int incX, const void *beta, void *Y, const int incY); + + void arma_wrapper(cblas_sgemm)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const float alpha, const float *A, const int lda, const float *B, const int ldb, const float beta, float *C, const int ldc); + void arma_wrapper(cblas_dgemm)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const double alpha, const double *A, const int lda, const double *B, const int ldb, const double beta, double *C, const int ldc); + void arma_wrapper(cblas_cgemm)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const void *alpha, const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc); + void arma_wrapper(cblas_zgemm)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const void *alpha, const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc); + + void arma_wrapper(cblas_ssyrk)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const float alpha, const float *A, const int lda, const float beta, float *C, const int ldc); + void arma_wrapper(cblas_dsyrk)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const double alpha, const double *A, const int lda, const double beta, double *C, const int ldc); + + void arma_wrapper(cblas_cherk)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const float alpha, const void *A, const int lda, const float beta, void *C, const int ldc); + void arma_wrapper(cblas_zherk)(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const double alpha, const void *A, const int lda, const double beta, void *C, const int ldc); } diff --git a/include/armadillo_bits/include_atlas.hpp b/include/armadillo_bits/include_atlas.hpp deleted file mode 100644 index 73765265..00000000 --- a/include/armadillo_bits/include_atlas.hpp +++ /dev/null @@ -1,43 +0,0 @@ -// SPDX-License-Identifier: Apache-2.0 -// -// Copyright 2008-2016 Conrad Sanderson (http://conradsanderson.id.au) -// Copyright 2008-2016 National ICT Australia (NICTA) -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ------------------------------------------------------------------------ - - -// TODO: remove support for ATLAS in next major version - -#if defined(ARMA_USE_ATLAS) - #if !defined(ARMA_ATLAS_INCLUDE_DIR) - extern "C" - { - #include - } - #else - #define ARMA_STR1(x) x - #define ARMA_STR2(x) ARMA_STR1(x) - - #define ARMA_CBLAS ARMA_STR2(ARMA_ATLAS_INCLUDE_DIR)ARMA_STR2(cblas.h) - - extern "C" - { - #include ARMA_INCFILE_WRAP(ARMA_CBLAS) - } - - #undef ARMA_STR1 - #undef ARMA_STR2 - #undef ARMA_CBLAS - #undef ARMA_CLAPACK - #endif -#endif diff --git a/include/armadillo_bits/mul_gemm.hpp b/include/armadillo_bits/mul_gemm.hpp index 2476d310..27e31832 100644 --- a/include/armadillo_bits/mul_gemm.hpp +++ b/include/armadillo_bits/mul_gemm.hpp @@ -280,9 +280,9 @@ class gemm atlas::cblas_gemm ( - atlas::CblasColMajor, - (do_trans_A) ? ( is_cx::yes ? CblasConjTrans : atlas::CblasTrans ) : atlas::CblasNoTrans, - (do_trans_B) ? ( is_cx::yes ? CblasConjTrans : atlas::CblasTrans ) : atlas::CblasNoTrans, + atlas_CblasColMajor, + (do_trans_A) ? ( is_cx::yes ? atlas_CblasConjTrans : atlas_CblasTrans ) : atlas_CblasNoTrans, + (do_trans_B) ? ( is_cx::yes ? atlas_CblasConjTrans : atlas_CblasTrans ) : atlas_CblasNoTrans, C.n_rows, C.n_cols, (do_trans_A) ? A.n_rows : A.n_cols, diff --git a/include/armadillo_bits/mul_gemv.hpp b/include/armadillo_bits/mul_gemv.hpp index bd07d3f7..2580e4ab 100644 --- a/include/armadillo_bits/mul_gemv.hpp +++ b/include/armadillo_bits/mul_gemv.hpp @@ -327,9 +327,9 @@ class gemv atlas::cblas_gemm ( - atlas::CblasColMajor, - (do_trans_A) ? ( is_cx::yes ? CblasConjTrans : atlas::CblasTrans ) : atlas::CblasNoTrans, - atlas::CblasNoTrans, + atlas_CblasColMajor, + (do_trans_A) ? ( is_cx::yes ? atlas_CblasConjTrans : atlas_CblasTrans ) : atlas_CblasNoTrans, + atlas_CblasNoTrans, (do_trans_A) ? A.n_cols : A.n_rows, 1, (do_trans_A) ? A.n_rows : A.n_cols, @@ -349,8 +349,8 @@ class gemv atlas::cblas_gemv ( - atlas::CblasColMajor, - (do_trans_A) ? ( is_cx::yes ? CblasConjTrans : atlas::CblasTrans ) : atlas::CblasNoTrans, + atlas_CblasColMajor, + (do_trans_A) ? ( is_cx::yes ? atlas_CblasConjTrans : atlas_CblasTrans ) : atlas_CblasNoTrans, A.n_rows, A.n_cols, (use_alpha) ? alpha : eT(1), diff --git a/include/armadillo_bits/mul_herk.hpp b/include/armadillo_bits/mul_herk.hpp index 1ad63ac0..ab9ec76a 100644 --- a/include/armadillo_bits/mul_herk.hpp +++ b/include/armadillo_bits/mul_herk.hpp @@ -359,9 +359,9 @@ class herk atlas::cblas_herk ( - atlas::CblasColMajor, - atlas::CblasUpper, - (do_trans_A) ? CblasConjTrans : atlas::CblasNoTrans, + atlas_CblasColMajor, + atlas_CblasUpper, + (do_trans_A) ? atlas_CblasConjTrans : atlas_CblasNoTrans, C.n_cols, (do_trans_A) ? A.n_rows : A.n_cols, (use_alpha) ? alpha : T(1), diff --git a/include/armadillo_bits/mul_syrk.hpp b/include/armadillo_bits/mul_syrk.hpp index aa447830..c2da3a27 100644 --- a/include/armadillo_bits/mul_syrk.hpp +++ b/include/armadillo_bits/mul_syrk.hpp @@ -318,9 +318,9 @@ class syrk atlas::cblas_syrk ( - atlas::CblasColMajor, - atlas::CblasUpper, - (do_trans_A) ? atlas::CblasTrans : atlas::CblasNoTrans, + atlas_CblasColMajor, + atlas_CblasUpper, + (do_trans_A) ? atlas_CblasTrans : atlas_CblasNoTrans, C.n_cols, (do_trans_A) ? A.n_rows : A.n_cols, (use_alpha) ? alpha : eT(1), diff --git a/include/armadillo_bits/translate_atlas.hpp b/include/armadillo_bits/translate_atlas.hpp index 6eca6022..d58b1387 100644 --- a/include/armadillo_bits/translate_atlas.hpp +++ b/include/armadillo_bits/translate_atlas.hpp @@ -21,7 +21,7 @@ // TODO: remove support for ATLAS in next major version -//! \namespace atlas namespace for ATLAS functions (imported from the global namespace) +//! \namespace atlas namespace for ATLAS functions namespace atlas { @@ -142,7 +142,7 @@ namespace atlas void cblas_gemv ( - const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, + const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const eT alpha, const eT *A, const int lda, @@ -156,25 +156,25 @@ namespace atlas if(is_float::value) { typedef float T; - arma_wrapper(cblas_sgemv)(Order, TransA, M, N, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, incY); + arma_wrapper(cblas_sgemv)(layout, TransA, M, N, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, incY); } else if(is_double::value) { typedef double T; - arma_wrapper(cblas_dgemv)(Order, TransA, M, N, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, incY); + arma_wrapper(cblas_dgemv)(layout, TransA, M, N, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)X, incX, (const T)tmp_real(beta), (T*)Y, incY); } else if(is_cx_float::value) { typedef std::complex T; - arma_wrapper(cblas_cgemv)(Order, TransA, M, N, (const T*)&alpha, (const T*)A, lda, (const T*)X, incX, (const T*)&beta, (T*)Y, incY); + arma_wrapper(cblas_cgemv)(layout, TransA, M, N, (const T*)&alpha, (const T*)A, lda, (const T*)X, incX, (const T*)&beta, (T*)Y, incY); } else if(is_cx_double::value) { typedef std::complex T; - arma_wrapper(cblas_zgemv)(Order, TransA, M, N, (const T*)&alpha, (const T*)A, lda, (const T*)X, incX, (const T*)&beta, (T*)Y, incY); + arma_wrapper(cblas_zgemv)(layout, TransA, M, N, (const T*)&alpha, (const T*)A, lda, (const T*)X, incX, (const T*)&beta, (T*)Y, incY); } } @@ -185,8 +185,8 @@ namespace atlas void cblas_gemm ( - const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, - const enum CBLAS_TRANSPOSE TransB, const int M, const int N, + const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, + const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const eT alpha, const eT *A, const int lda, const eT *B, const int ldb, const eT beta, eT *C, const int ldc @@ -197,25 +197,25 @@ namespace atlas if(is_float::value) { typedef float T; - arma_wrapper(cblas_sgemm)(Order, TransA, TransB, M, N, K, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta), (T*)C, ldc); + arma_wrapper(cblas_sgemm)(layout, TransA, TransB, M, N, K, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta), (T*)C, ldc); } else if(is_double::value) { typedef double T; - arma_wrapper(cblas_dgemm)(Order, TransA, TransB, M, N, K, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta), (T*)C, ldc); + arma_wrapper(cblas_dgemm)(layout, TransA, TransB, M, N, K, (const T)tmp_real(alpha), (const T*)A, lda, (const T*)B, ldb, (const T)tmp_real(beta), (T*)C, ldc); } else if(is_cx_float::value) { typedef std::complex T; - arma_wrapper(cblas_cgemm)(Order, TransA, TransB, M, N, K, (const T*)&alpha, (const T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc); + arma_wrapper(cblas_cgemm)(layout, TransA, TransB, M, N, K, (const T*)&alpha, (const T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc); } else if(is_cx_double::value) { typedef std::complex T; - arma_wrapper(cblas_zgemm)(Order, TransA, TransB, M, N, K, (const T*)&alpha, (const T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc); + arma_wrapper(cblas_zgemm)(layout, TransA, TransB, M, N, K, (const T*)&alpha, (const T*)A, lda, (const T*)B, ldb, (const T*)&beta, (T*)C, ldc); } } @@ -226,7 +226,7 @@ namespace atlas void cblas_syrk ( - const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, + const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const eT alpha, const eT* A, const int lda, const eT beta, eT* C, const int ldc ) @@ -236,13 +236,13 @@ namespace atlas if(is_float::value) { typedef float T; - arma_wrapper(cblas_ssyrk)(Order, Uplo, Trans, N, K, (const T)alpha, (const T*)A, lda, (const T)beta, (T*)C, ldc); + arma_wrapper(cblas_ssyrk)(layout, Uplo, Trans, N, K, (const T)alpha, (const T*)A, lda, (const T)beta, (T*)C, ldc); } else if(is_double::value) { typedef double T; - arma_wrapper(cblas_dsyrk)(Order, Uplo, Trans, N, K, (const T)alpha, (const T*)A, lda, (const T)beta, (T*)C, ldc); + arma_wrapper(cblas_dsyrk)(layout, Uplo, Trans, N, K, (const T)alpha, (const T*)A, lda, (const T)beta, (T*)C, ldc); } } @@ -253,7 +253,7 @@ namespace atlas void cblas_herk ( - const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, + const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const T alpha, const std::complex* A, const int lda, const T beta, std::complex* C, const int ldc ) @@ -265,7 +265,7 @@ namespace atlas typedef float TT; typedef std::complex cx_TT; - arma_wrapper(cblas_cherk)(Order, Uplo, Trans, N, K, (const TT)alpha, (const cx_TT*)A, lda, (const TT)beta, (cx_TT*)C, ldc); + arma_wrapper(cblas_cherk)(layout, Uplo, Trans, N, K, (const TT)alpha, (const cx_TT*)A, lda, (const TT)beta, (cx_TT*)C, ldc); } else if(is_double::value) @@ -273,7 +273,7 @@ namespace atlas typedef double TT; typedef std::complex cx_TT; - arma_wrapper(cblas_zherk)(Order, Uplo, Trans, N, K, (const TT)alpha, (const cx_TT*)A, lda, (const TT)beta, (cx_TT*)C, ldc); + arma_wrapper(cblas_zherk)(layout, Uplo, Trans, N, K, (const TT)alpha, (const cx_TT*)A, lda, (const TT)beta, (cx_TT*)C, ldc); } } diff --git a/src/wrapper1.cpp b/src/wrapper1.cpp index 85fccd67..a701bc28 100644 --- a/src/wrapper1.cpp +++ b/src/wrapper1.cpp @@ -27,7 +27,6 @@ #include "armadillo_bits/compiler_setup.hpp" #include "armadillo_bits/typedef_elem.hpp" -#include "armadillo_bits/include_atlas.hpp" #include "armadillo_bits/include_superlu.hpp" @@ -58,6 +57,7 @@ namespace arma { #include "armadillo_bits/def_blas.hpp" +#include "armadillo_bits/def_atlas.hpp" #include "armadillo_bits/def_lapack.hpp" #include "armadillo_bits/def_arpack.hpp" #include "armadillo_bits/def_superlu.hpp" @@ -194,6 +194,124 @@ extern "C" + #if defined(ARMA_USE_ATLAS) + + float wrapper_cblas_sasum(const int N, const float *X, const int incX) + { + return cblas_sasum(N, X, incX); + } + + double wrapper_cblas_dasum(const int N, const double *X, const int incX) + { + return cblas_dasum(N, X, incX); + } + + + + float wrapper_cblas_snrm2(const int N, const float *X, const int incX) + { + return cblas_snrm2(N, X, incX); + } + + double wrapper_cblas_dnrm2(const int N, const double *X, const int incX) + { + return cblas_dnrm2(N, X, incX); + } + + + + float wrapper_cblas_sdot(const int N, const float *X, const int incX, const float *Y, const int incY) + { + return cblas_sdot(N, X, incX, Y, incY); + } + + double wrapper_cblas_ddot(const int N, const double *X, const int incX, const double *Y, const int incY) + { + return cblas_ddot(N, X, incX, Y, incY); + } + + void wrapper_cblas_cdotu_sub(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu) + { + cblas_cdotu_sub(N, X, incX, Y, incY, dotu); + } + + void wrapper_cblas_zdotu_sub(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu) + { + cblas_zdotu_sub(N, X, incX, Y, incY, dotu); + } + + + + void wrapper_cblas_sgemv(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const float alpha, const float *A, const int lda, const float *X, const int incX, const float beta, float *Y, const int incY) + { + cblas_sgemv(layout, TransA, M, N, alpha, A, lda, X, incX, beta, Y, incY); + } + + void wrapper_cblas_dgemv(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const double alpha, const double *A, const int lda, const double *X, const int incX, const double beta, double *Y, const int incY) + { + cblas_dgemv(layout, TransA, M, N, alpha, A, lda, X, incX, beta, Y, incY); + } + + void wrapper_cblas_cgemv(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const void *alpha, const void *A, const int lda, const void *X, const int incX, const void *beta, void *Y, const int incY) + { + cblas_cgemv(layout, TransA, M, N, alpha, A, lda, X, incX, beta, Y, incY); + } + + void wrapper_cblas_zgemv(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const int M, const int N, const void *alpha, const void *A, const int lda, const void *X, const int incX, const void *beta, void *Y, const int incY) + { + cblas_zgemv(layout, TransA, M, N, alpha, A, lda, X, incX, beta, Y, incY); + } + + + + void wrapper_cblas_sgemm(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const float alpha, const float *A, const int lda, const float *B, const int ldb, const float beta, float *C, const int ldc) + { + cblas_sgemm(layout, TransA, TransB, M, N, K, alpha, A, lda, B, ldb, beta, C, ldc); + } + + void wrapper_cblas_dgemm(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const double alpha, const double *A, const int lda, const double *B, const int ldb, const double beta, double *C, const int ldc) + { + cblas_dgemm(layout, TransA, TransB, M, N, K, alpha, A, lda, B, ldb, beta, C, ldc); + } + + void wrapper_cblas_cgemm(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const void *alpha, const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc) + { + cblas_cgemm(layout, TransA, TransB, M, N, K, alpha, A, lda, B, ldb, beta, C, ldc); + } + + void wrapper_cblas_zgemm(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_TRANS TransA, const atlas_CBLAS_TRANS TransB, const int M, const int N, const int K, const void *alpha, const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc) + { + cblas_zgemm(layout, TransA, TransB, M, N, K, alpha, A, lda, B, ldb, beta, C, ldc); + } + + + + void wrapper_cblas_ssyrk(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const float alpha, const float *A, const int lda, const float beta, float *C, const int ldc) + { + cblas_ssyrk(layout, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); + } + + void wrapper_cblas_dsyrk(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const double alpha, const double *A, const int lda, const double beta, double *C, const int ldc) + { + cblas_dsyrk(layout, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); + } + + + + void wrapper_cblas_cherk(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const float alpha, const void *A, const int lda, const float beta, void *C, const int ldc) + { + cblas_cherk(layout, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); + } + + void wrapper_cblas_zherk(const atlas_CBLAS_LAYOUT layout, const atlas_CBLAS_UPLO Uplo, const atlas_CBLAS_TRANS Trans, const int N, const int K, const double alpha, const void *A, const int lda, const double beta, void *C, const int ldc) + { + cblas_zherk(layout, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); + } + + #endif + + + #if defined(ARMA_USE_LAPACK) void arma_fortran_with_prefix(arma_sgetrf)(const blas_int* m, const blas_int* n, float* a, const blas_int* lda, blas_int* ipiv, blas_int* info) @@ -1206,144 +1324,6 @@ extern "C" - #if defined(ARMA_USE_ATLAS) - - float wrapper_cblas_sasum(const int N, const float *X, const int incX) - { - return cblas_sasum(N, X, incX); - } - - double wrapper_cblas_dasum(const int N, const double *X, const int incX) - { - return cblas_dasum(N, X, incX); - } - - - - float wrapper_cblas_snrm2(const int N, const float *X, const int incX) - { - return cblas_snrm2(N, X, incX); - } - - double wrapper_cblas_dnrm2(const int N, const double *X, const int incX) - { - return cblas_dnrm2(N, X, incX); - } - - - - float wrapper_cblas_sdot(const int N, const float *X, const int incX, const float *Y, const int incY) - { - return cblas_sdot(N, X, incX, Y, incY); - } - - double wrapper_cblas_ddot(const int N, const double *X, const int incX, const double *Y, const int incY) - { - return cblas_ddot(N, X, incX, Y, incY); - } - - void wrapper_cblas_cdotu_sub(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu) - { - cblas_cdotu_sub(N, X, incX, Y, incY, dotu); - } - - void wrapper_cblas_zdotu_sub(const int N, const void *X, const int incX, const void *Y, const int incY, void *dotu) - { - cblas_zdotu_sub(N, X, incX, Y, incY, dotu); - } - - - - void wrapper_cblas_sgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const float alpha, - const float *A, const int lda, const float *X, const int incX, const float beta, float *Y, const int incY) - { - cblas_sgemv(Order, TransA, M, N, alpha, A, lda, X, incX, beta, Y, incY); - } - - void wrapper_cblas_dgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const double alpha, - const double *A, const int lda, const double *X, const int incX, const double beta, double *Y, const int incY) - { - cblas_dgemv(Order, TransA, M, N, alpha, A, lda, X, incX, beta, Y, incY); - } - - void wrapper_cblas_cgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const void *alpha, - const void *A, const int lda, const void *X, const int incX, const void *beta, void *Y, const int incY) - { - cblas_cgemv(Order, TransA, M, N, alpha, A, lda, X, incX, beta, Y, incY); - } - - void wrapper_cblas_zgemv(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const void *alpha, - const void *A, const int lda, const void *X, const int incX, const void *beta, void *Y, const int incY) - { - cblas_zgemv(Order, TransA, M, N, alpha, A, lda, X, incX, beta, Y, incY); - } - - - - void wrapper_cblas_sgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, - const int M, const int N, const int K, const float alpha, - const float *A, const int lda, const float *B, const int ldb, const float beta, float *C, const int ldc) - { - cblas_sgemm(Order, TransA, TransB, M, N, K, alpha, A, lda, B, ldb, beta, C, ldc); - } - - void wrapper_cblas_dgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, - const int M, const int N, const int K, const double alpha, - const double *A, const int lda, const double *B, const int ldb, const double beta, double *C, const int ldc) - { - cblas_dgemm(Order, TransA, TransB, M, N, K, alpha, A, lda, B, ldb, beta, C, ldc); - } - - void wrapper_cblas_cgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, - const int M, const int N, const int K, const void *alpha, - const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc) - { - cblas_cgemm(Order, TransA, TransB, M, N, K, alpha, A, lda, B, ldb, beta, C, ldc); - } - - void wrapper_cblas_zgemm(const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, - const int M, const int N, const int K, const void *alpha, - const void *A, const int lda, const void *B, const int ldb, const void *beta, void *C, const int ldc) - { - cblas_zgemm(Order, TransA, TransB, M, N, K, alpha, A, lda, B, ldb, beta, C, ldc); - } - - - - void wrapper_cblas_ssyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, - const int N, const int K, const float alpha, - const float *A, const int lda, const float beta, float *C, const int ldc) - { - cblas_ssyrk(Order, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); - } - - void wrapper_cblas_dsyrk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, - const int N, const int K, const double alpha, - const double *A, const int lda, const double beta, double *C, const int ldc) - { - cblas_dsyrk(Order, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); - } - - - - void wrapper_cblas_cherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, - const int N, const int K, const float alpha, - const void *A, const int lda, const float beta, void *C, const int ldc) - { - cblas_cherk(Order, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); - } - - void wrapper_cblas_zherk(const enum CBLAS_ORDER Order, const enum CBLAS_UPLO Uplo, const enum CBLAS_TRANSPOSE Trans, - const int N, const int K, const double alpha, - const void *A, const int lda, const double beta, void *C, const int ldc) - { - cblas_zherk(Order, Uplo, Trans, N, K, alpha, A, lda, beta, C, ldc); - } - - #endif - - - #if defined(ARMA_USE_ARPACK) void arma_fortran_with_prefix(arma_snaupd)(blas_int* ido, char* bmat, blas_int* n, char* which, blas_int* nev, float* tol, float* resid, blas_int* ncv, float* v, blas_int* ldv, blas_int* iparam, blas_int* ipntr, float* workd, float* workl, blas_int* lworkl, blas_int* info)