Commit ab6eaaf7 authored by Dave Moxey's avatar Dave Moxey

Add more fine-grained control over utilities and remove some more unused code/compiler definitions

parent 8b935787
......@@ -161,28 +161,24 @@ OPTION(NEKTAR_USE_EXPRESSION_TEMPLATES
MARK_AS_ADVANCED(NEKTAR_USE_EXPRESSION_TEMPLATES)
# BLAS Support
OPTION(NEKTAR_USE_BLAS_LAPACK "Use Blas and lapack routines." ON)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_SYSTEM_BLAS_LAPACK
"Use the system provided blas and lapack libraries" ON
"UNIX; NOT APPLE; NOT NEKTAR_USE_OPENBLAS; NOT NEKTAR_USE_MKL; NOT NEKTAR_USE_ACML; NOT NEKTAR_USE_ACCELERATE_FRAMEWORK" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_OPENBLAS
"Use OpenBLAS library as a substitute to native BLAS." OFF
"NEKTAR_USE_BLAS_LAPACK" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_SMV
"Use LibSMV library for faster small matrix-vector multiplies." OFF
"NEKTAR_USE_BLAS_LAPACK" OFF)
"NOT NEKTAR_USE_SYSTEM_BLAS_LAPACK" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_ACML
"Use the AMD Core Math Library (ACML) for BLAS and Lapack support." OFF
"NEKTAR_USE_BLAS_LAPACK" OFF)
"NOT NEKTAR_USE_SYSTEM_BLAS_LAPACK" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_MKL
"Use the Intel Math Kernel Library (MKL) for BLAS and Lapack support." OFF
"NEKTAR_USE_BLAS_LAPACK" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_SYSTEM_BLAS_LAPACK
"Use the system provided blas and lapack libraries" ON
"NEKTAR_USE_BLAS_LAPACK; UNIX; NOT APPLE; NOT NEKTAR_USE_OPENBLAS; NOT NEKTAR_USE_MKL; NOT NEKTAR_USE_ACML; NOT NEKTAR_USE_ACCELERATE_FRAMEWORK" OFF)
"NOT NEKTAR_USE_SYSTEM_BLAS_LAPACK" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_ACCELERATE_FRAMEWORK
"Use the Mac Accelerate Framework for BLAS and Lapack support." ON
"NEKTAR_USE_BLAS_LAPACK; APPLE" OFF)
"NOT NEKTAR_USE_SYSTEM_BLAS_LAPACK; APPLE" OFF)
CMAKE_DEPENDENT_OPTION(NEKTAR_USE_WIN32_LAPACK
"Use Win32 Lapack provided with the Third Party Distribution."
ON "NEKTAR_USE_BLAS_LAPACK; WIN32" OFF)
ON "NOT NEKTAR_USE_SYSTEM_BLAS_LAPACK; WIN32" OFF)
# Memory pools
OPTION(NEKTAR_USE_MEMORY_POOLS
......@@ -232,7 +228,6 @@ INCLUDE (ThirdPartyFFTW)
INCLUDE (ThirdPartyArpack)
INCLUDE (ThirdPartyMPI)
INCLUDE (ThirdPartyVTK)
INCLUDE (ThirdPartySMV)
INCLUDE (ThirdPartyOCE)
INCLUDE (ThirdPartyTetGen)
INCLUDE (ThirdPartyCCM)
......@@ -241,32 +236,18 @@ INCLUDE (Doxygen)
IF( NEKTAR_USE_MKL )
INCLUDE (FindMKL)
SET(NEKTAR_USING_BLAS TRUE)
SET(NEKTAR_USING_LAPACK TRUE)
SET(NEKTAR_USING_MKL TRUE)
ENDIF( NEKTAR_USE_MKL )
IF( NEKTAR_USE_OPENBLAS )
INCLUDE (FindOpenBlas)
SET(NEKTAR_USING_OPENBLAS TRUE)
ENDIF( NEKTAR_USE_OPENBLAS )
IF( NEKTAR_USE_SMV )
INCLUDE (FindSMV)
SET(NEKTAR_USING_SMV TRUE)
ADD_DEFINITIONS(-DNEKTAR_USING_SMV)
ENDIF( NEKTAR_USE_SMV )
IF( NEKTAR_USE_ACCELERATE_FRAMEWORK )
INCLUDE (FindAccelerateFramework)
ENDIF( NEKTAR_USE_ACCELERATE_FRAMEWORK )
IF( NEKTAR_USE_ACML )
INCLUDE (FindACML)
SET(NEKTAR_USING_BLAS TRUE)
SET(NEKTAR_USING_LAPACK TRUE)
SET(NEKTAR_USING_ACML TRUE)
ADD_DEFINITIONS(-DUSE_ACML)
ENDIF( NEKTAR_USE_ACML )
IF( NEKTAR_USE_WIN32_LAPACK )
......@@ -275,24 +256,12 @@ ENDIF( NEKTAR_USE_WIN32_LAPACK )
IF( NEKTAR_USE_SYSTEM_BLAS_LAPACK )
INCLUDE(ThirdPartyBlasLapack)
SET(NEKTAR_USING_BLAS TRUE)
SET(NEKTAR_USING_LAPACK TRUE)
ENDIF( NEKTAR_USE_SYSTEM_BLAS_LAPACK )
IF( NEKTAR_USE_BLAS_LAPACK )
SET(NEKTAR_USING_BLAS TRUE)
SET(NEKTAR_USING_LAPACK TRUE)
ADD_DEFINITIONS( -DNEKTAR_USING_LAPACK -DNEKTAR_USING_BLAS )
ENDIF( NEKTAR_USE_BLAS_LAPACK )
IF( NEKTAR_USE_TINYXML_STL )
ADD_DEFINITIONS( -DTIXML_USE_STL)
ENDIF( NEKTAR_USE_TINYXML_STL )
IF( NEKTAR_USE_DIRECT_BLAS_CALLS )
ADD_DEFINITIONS(-DNEKTAR_USING_DIRECT_BLAS_CALLS)
ENDIF( NEKTAR_USE_DIRECT_BLAS_CALLS )
IF( NEKTAR_USE_EXPRESSION_TEMPLATES )
ADD_DEFINITIONS(-DNEKTAR_USE_EXPRESSION_TEMPLATES -DNEKTAR_USING_CMAKE)
ENDIF( NEKTAR_USE_EXPRESSION_TEMPLATES )
......@@ -338,10 +307,8 @@ IF (NEKTAR_BUILD_SOLVERS)
ADD_SUBDIRECTORY(solvers)
ENDIF(NEKTAR_BUILD_SOLVERS)
IF (NEKTAR_BUILD_UTILITIES)
INCLUDE_DIRECTORIES(utilities)
ADD_SUBDIRECTORY(utilities)
ENDIF (NEKTAR_BUILD_UTILITIES)
INCLUDE_DIRECTORIES(utilities)
ADD_SUBDIRECTORY(utilities)
IF (NEKTAR_BUILD_TESTS)
INCLUDE_DIRECTORIES(tests)
......
SET(SMV_SEARCH_PATHS
${CMAKE_SOURCE_DIR}/ThirdParty/libsmv/build/lib
${CMAKE_SOURCE_DIR}/../ThirdParty/libsmv/build/lib
${CMAKE_SOURCE_DIR}/ThirdParty/dist/build/lib
${CMAKE_SOURCE_DIR}/../ThirdParty/dist/build/lib)
FIND_PATH(SMV_INCLUDE_DIR NAMES smv.h PATHS ${SMV_SEARCH_PATHS})
FIND_LIBRARY(SMV_LIBRARY NAMES smv PATHS ${SMV_SEARCH_PATHS})
SET(SMV_FOUND FALSE)
IF (SMV_LIBRARY)
SET(SMV_FOUND TRUE)
INCLUDE_DIRECTORIES(${SMV_INCLUDE_DIR})
MARK_AS_ADVANCED(SMV_LIBRARY)
MARK_AS_ADVANCED(SMV_INCLUDE_DIR)
ENDIF (SMV_LIBRARY)
IF (SMV_FOUND)
IF (NOT SMV_FIND_QUIETLY)
MESSAGE(STATUS "Found SMV: ${SMV_INCLUDE_DIR}")
ENDIF (NOT SMV_FIND_QUIETLY)
ELSE(SMV_FOUND)
IF (SMV_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find SMV")
ENDIF (SMV_FIND_REQUIRED)
ENDIF (SMV_FOUND)
OPTION(THIRDPARTY_BUILD_SMV "Build LibSMV" OFF)
IF (THIRDPARTY_BUILD_SMV)
INCLUDE(ExternalProject)
EXTERNALPROJECT_ADD(
libsmvf1.0
URL ${TPURL}/libsmvf1.0.tar.gz
URL_MD5 "40cad0538acebd4aa83136ef9319150e"
STAMP_DIR ${TPBUILD}/stamp
DOWNLOAD_DIR ${TPSRC}
SOURCE_DIR ${TPSRC}/libsmvf1.0
BINARY_DIR ${TPBUILD}/libsmvf1.0
TMP_DIR ${TPBUILD}/libsmvf1.0-tmp
INSTALL_DIR ${TPDIST}
CONFIGURE_COMMAND ${CMAKE_COMMAND}
-DCMAKE_INSTALL_PREFIX:PATH=${TPDIST} ${TPSRC}/libsmvf1.0
INSTALL_COMMAND echo "LibSMV compiled successfully"
)
SET(SMV smv CACHE FILEPATH "Path to LibSMV." FORCE)
MARK_AS_ADVANCED(SMV)
LINK_DIRECTORIES(${TPDIST}/lib)
MESSAGE(STATUS "Build LibSMV: ${TPDIST}/lib/lib${SMV}.a")
SET(NEKTAR_USING_SMV TRUE)
ADD_DEFINITIONS(-DNEKTAR_USING_SMV)
ELSE (THIRDPARTY_BUILD_SMV)
IF (NEKTAR_USE_SMV)
INCLUDE(FindSMV)
IF (SMV_FOUND)
MESSAGE(STATUS "Found LibSMV: ${SMV_LIBRARY}")
ENDIF(SMV_FOUND)
ENDIF (NEKTAR_USE_SMV)
ENDIF (THIRDPARTY_BUILD_SMV)
SET(LibrarySubDirs FieldUtils GlobalMapping LibUtilities LocalRegions
Collections MultiRegions SpatialDomains StdRegions)
SET(UnitTestSubDirs UnitTests)
SET(DemoSubDirs Demos)
SET(TimingsSubDirs Timings)
SET(SolverUtilsSubDirs SolverUtils)
SET(NekMeshUtilsSubDirs NekMeshUtils)
SUBDIRS(${LibrarySubDirs})
# Main library sub-directories, required by all of Nektar++.
SUBDIRS(GlobalMapping LibUtilities LocalRegions Collections MultiRegions
SpatialDomains StdRegions)
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/library)
IF( NEKTAR_BUILD_UNIT_TESTS )
SUBDIRS(${UnitTestSubDirs})
ENDIF( NEKTAR_BUILD_UNIT_TESTS )
IF (NEKTAR_BUILD_UNIT_TESTS)
SUBDIRS(UnitTests)
ENDIF()
IF (NEKTAR_BUILD_DEMOS)
SUBDIRS(Demos)
ENDIF()
IF( NEKTAR_BUILD_DEMOS )
SUBDIRS(${DemoSubDirs})
ENDIF( NEKTAR_BUILD_DEMOS )
IF (NEKTAR_BUILD_TIMINGS)
SUBDIRS(Timings)
ENDIF()
IF( NEKTAR_BUILD_TIMINGS )
SUBDIRS(${TimingsSubDirs})
ENDIF( NEKTAR_BUILD_TIMINGS )
IF (NEKTAR_BUILD_SOLVERS)
SUBDIRS(SolverUtils)
ENDIF()
IF( NEKTAR_BUILD_SOLVERS )
SUBDIRS(${SolverUtilsSubDirs})
ENDIF( NEKTAR_BUILD_SOLVERS )
IF (NEKTAR_UTILITY_NEKMESH)
SUBDIRS(NekMeshUtils)
ENDIF()
IF( NEKTAR_BUILD_UTILITIES )
SUBDIRS(${NekMeshUtilsSubDirs})
ENDIF( NEKTAR_BUILD_UTILITIES )
IF (NEKTAR_UTILITY_FIELDCONVERT OR NEKTAR_BUILD_SOLVERS)
SUBDIRS(FieldUtils)
ENDIF()
......@@ -241,10 +241,6 @@ SET(LinearAlgebraHeaders
./LinearAlgebra/SparseUtils.hpp
)
IF(NEKTAR_USING_SMV)
SET(LinearAlgebraHeaders ${LinearAlgebraHeaders} ./LinearAlgebra/LibSMV.hpp)
ENDIF(NEKTAR_USING_SMV)
SET(LinearAlgebraSources
./LinearAlgebra/blas.cpp
./LinearAlgebra/BlockMatrix.cpp
......@@ -261,10 +257,6 @@ SET(LinearAlgebraSources
./LinearAlgebra/SparseMatrix.cpp
)
IF(NEKTAR_USING_SMV)
SET(LinearAlgebraSources ${LinearAlgebraSources} ./LinearAlgebra/LibSMV.cpp)
ENDIF(NEKTAR_USING_SMV)
SET(MemoryHeaders
./Memory/ThreadSpecificPool.hpp
./Memory/NekMemoryManager.hpp
......@@ -484,10 +476,6 @@ IF( NEKTAR_USE_BLAS_LAPACK )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${OPENBLAS})
ENDIF( NEKTAR_USE_OPENBLAS AND OPENBLAS_FOUND )
IF( NEKTAR_USE_SMV AND SMV_FOUND )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${SMV_LIBRARY})
ENDIF( NEKTAR_USE_SMV AND SMV_FOUND )
IF( NEKTAR_USE_SYSTEM_BLAS_LAPACK )
TARGET_LINK_LIBRARIES(LibUtilities LINK_PUBLIC ${NATIVE_LAPACK} ${NATIVE_BLAS})
ENDIF( NEKTAR_USE_SYSTEM_BLAS_LAPACK )
......
......@@ -98,7 +98,6 @@ namespace Blas
const double& beta, double* c, const int& ldc);
}
#ifdef NEKTAR_USING_BLAS
/// \brief BLAS level 1: Copy \a x to \a y
static inline void Dcopy (const int& n, const double *x, const int& incx,
double *y, const int& incy)
......@@ -227,55 +226,5 @@ namespace Blas
{
Dgemm('N','N',N,M,K,a,B,N,A,K,b,C,N) ;
}
#endif //NEKTAR_USING_BLAS
}
#endif //NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_BLAS_HPP
/***
$Log: Blas.hpp,v $
Revision 1.6 2008/04/06 05:55:11 bnelson
Changed ConstArray to Array<const>
Revision 1.5 2008/02/28 09:57:08 sherwin
Added array version of some routines
Revision 1.4 2007/09/02 23:33:04 bnelson
*** empty log message ***
Revision 1.3 2007/08/29 22:35:21 bnelson
Added upper triangular matrix time vector.
Revision 1.2 2007/06/17 22:54:23 bnelson
Fixed the row-major matrix multiplication wrapper function.
Revision 1.1 2007/04/03 03:59:24 bnelson
Moved Lapack.hpp, Blas.hpp, Transf77.hpp to LinearAlgebra
Revision 1.3 2007/02/04 00:15:40 bnelson
*** empty log message ***
Revision 1.2 2006/06/01 13:44:28 kirby
*** empty log message ***
Revision 1.1 2006/06/01 11:07:52 kirby
*** empty log message ***
Revision 1.1 2006/05/04 18:57:41 kirby
*** empty log message ***
Revision 1.4 2006/02/26 21:13:45 bnelson
Fixed a variety of compiler errors caused by updates to the coding standard.
Revision 1.3 2006/02/15 08:07:15 sherwin
Put codes into standard although have not yet been compiled
Revision 1.2 2006/02/12 21:51:42 sherwin
Added licence
Revision 1.1 2006/02/12 15:06:12 sherwin
Changed .h files to .hpp
**/
......@@ -55,7 +55,6 @@ namespace Blas
const double *y, const int& incy);
}
#ifdef NEKTAR_USING_BLAS
static inline void Dcopy (const int& n, const Nektar::Array <Nektar::OneD, const double> &x, const int& incx, Nektar::Array<Nektar::OneD,double> &y, const int& incy)
{
ASSERTL1(static_cast<unsigned int>(n*incx) <= x.num_elements()+x.GetOffset(),"Array out of bounds");
......@@ -79,25 +78,5 @@ namespace Blas
{
return F77NAME(ddot)(n,&x[0],incx,&y[0],incy);
}
#endif // NEKTAR_USING BLAS
}
#endif // NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_BLASARRAY_HPP
/***
$Log: BlasArray.hpp,v $
Revision 1.5 2008/05/10 18:27:32 sherwin
Modifications necessary for QuadExp Unified DG Solver
Revision 1.4 2008/04/30 02:55:51 bnelson
Fixed gcc compiler warning.
Revision 1.3 2008/04/06 05:55:11 bnelson
Changed ConstArray to Array<const>
Revision 1.2 2008/03/12 15:22:45 pvos
Clean up of the code
Revision 1.1 2008/02/28 09:57:08 sherwin
Added array version of some routines
**/
......@@ -103,8 +103,6 @@ namespace Lapack
// Non-standard versions.
void dgetrs(char trans, int matrixRows, int matrixColumns, const double* A, double* x);
#ifdef NEKTAR_USING_LAPACK
/// \brief factor a real packed-symmetric matrix using Bunch-Kaufman
/// pivoting.
static inline void Dsptrf (const char& uplo, const int& n,
......@@ -251,54 +249,5 @@ namespace Lapack
{
F77NAME(dtptrs) (uplo, trans, diag, n, nrhs, a, b, ldb, info);
}
#endif //NEKTAR_USING_LAPACK
}
#endif //NEKTAR_LIB_UTILITIES_LAPACK_HPP
/***
$Log: Lapack.hpp,v $
Revision 1.5 2008/06/01 19:04:57 bnelson
Added triangular solvers.
Revision 1.4 2008/04/30 02:57:15 bnelson
Fixed gcc compiler warning.
Revision 1.3 2008/04/06 05:55:11 bnelson
Changed ConstArray to Array<const>
Revision 1.2 2007/04/10 14:00:45 sherwin
Update to include SharedArray in all 2D element (including Nodal tris). Have also remvoed all new and double from 2D shapes in StdRegions
Revision 1.1 2007/04/03 03:59:24 bnelson
Moved Lapack.hpp, Blas.hpp, Transf77.hpp to LinearAlgebra
Revision 1.3 2007/02/04 00:15:40 bnelson
*** empty log message ***
Revision 1.2 2006/06/01 13:44:28 kirby
*** empty log message ***
Revision 1.1 2006/06/01 11:07:52 kirby
*** empty log message ***
Revision 1.1 2006/05/04 18:57:43 kirby
*** empty log message ***
Revision 1.4 2006/02/26 21:13:45 bnelson
Fixed a variety of compiler errors caused by updates to the coding standard.
Revision 1.3 2006/02/15 08:07:15 sherwin
Put codes into standard although have not yet been compiled
Revision 1.2 2006/02/12 21:51:42 sherwin
Added licence
Revision 1.1 2006/02/12 15:06:12 sherwin
Changed .h files to .hpp
**/
///////////////////////////////////////////////////////////////////////////////
//
// File: LibSMV.cpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: wrapper of functions around SMV routines
//
///////////////////////////////////////////////////////////////////////////////
#ifdef NEKTAR_USING_SMV
#include <LibUtilities/LinearAlgebra/LibSMV.hpp>
// Translations for using Fortran version of SMV
namespace Smv
{
/// \brief LibSmv matrix-vector multiply: Y = Y + A*X where A is [m x k]-matrix
template <typename T>
void Smvn (const int& m, const T* a, const T* x, T* y)
{
F77NAME(smv) (m,a,x,y);
}
/// Explicit instantiation with type double:
template LIB_UTILITIES_EXPORT void Smvn (const int& m,
const double* a, const double* x, double* y);
}
#endif
///////////////////////////////////////////////////////////////////////////////
//
// File: LibSMV.hpp
//
// For more information, please see: http://www.nektar.info
//
// The MIT License
//
// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
// Department of Aeronautics, Imperial College London (UK), and Scientific
// Computing and Imaging Institute, University of Utah (USA).
//
// License for the specific language governing rights and limitations under
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: wrapper of functions around SMV routines
//
///////////////////////////////////////////////////////////////////////////////
#ifndef NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_SMV_HPP
#define NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_SMV_HPP
#ifdef NEKTAR_USING_SMV
#include <LibUtilities/LinearAlgebra/TransF77.hpp>
#include <LibUtilities/LibUtilitiesDeclspec.h>
#include <boost/preprocessor/iteration/local.hpp>
#include <smv.h>
namespace Smv
{
// Translations for using Fortran version of SMV
extern "C"
{
/// \brief Matrix-vector multiply C = C + A*B where
/// A is [m x m], B is [m] and C is [m].
/// Expected: no matrix transpose, row-major ordering,
/// unit increments and no matrix views (lda != m|n|k),
/// type double, no constant factors.
void F77NAME(smv) (
const int& m,
const double* a, const double* b, double* c);
/// \brief Rank-specific matrix-vector LibSMV multiply
/// kernels. Row-major ordering, unit increments,
/// type double. May eventually call dgemv
/// implementation that LibSMV is linked against.
#define BOOST_PP_LOCAL_MACRO(n) \
void F77NAME(smv_##n) \
(const double* a, \
const double* b, \
double* c);
#define BOOST_PP_LOCAL_LIMITS (1, LIBSMV_MAX_RANK)
#include BOOST_PP_LOCAL_ITERATE()
}
/// \brief LibSmv matrix-vector multiply: Y = Y + A*X where A is [m x m]-matrix
template <typename T>
LIB_UTILITIES_EXPORT void Smvn (const int& m,
const T* a, const T* x, T* y);
}
#endif // NEKTAR_USING_SMV
#endif //NEKTAR_LIB_UTILITIES_LINEAR_ALGEBRA_SMV_HPP
......@@ -87,7 +87,6 @@ namespace Nektar
Array<OneD, DataType>& data,
const char transpose)
{
#ifdef NEKTAR_USING_BLAS
ASSERTL0(rows==columns, "Only square matrices can be inverted.");
ASSERTL0(transpose=='N', "Only untransposed matrices may be inverted.");
......@@ -123,11 +122,6 @@ namespace Nektar
std::string message = "ERROR: Element u_" + boost::lexical_cast<std::string>(info) + boost::lexical_cast<std::string>(info) + " is 0 from dgetri";
ASSERTL0(false, message.c_str());
}
#else
// error Full matrix inversion not supported without blas.
BOOST_STATIC_ASSERT(sizeof(DataType) == 0);
#endif
}
static void EigenSolve(unsigned int n,
......@@ -206,7 +200,6 @@ namespace Nektar
static void Invert(unsigned int rows, unsigned int columns,
Array<OneD, DataType>& data)
{
#ifdef NEKTAR_USING_BLAS
ASSERTL0(rows==columns, "Only square matrices can be inverted.");
int n = columns;
......@@ -240,11 +233,6 @@ namespace Nektar
std::string message = "ERROR: Element u_" + boost::lexical_cast<std::string>(info) + boost::lexical_cast<std::string>(info) + " is 0 from dsptri";
ASSERTL0(false, message.c_str());
}
#else
// error Full matrix inversion not supported without blas.
BOOST_STATIC_ASSERT(sizeof(DataType) == 0);
#endif
}
static boost::tuples::tuple<unsigned int, unsigned int>
......
......@@ -29,8 +29,8 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
// Description: 0-based sparse BSR storage class with own unrolled and
// LibSMV multiply kernels.
// Description: 0-based sparse BSR storage class with own unrolled multiply
// kernels.
//
///////////////////////////////////////////////////////////////////////////////
......@@ -45,8 +45,6 @@
#include <LibUtilities/LinearAlgebra/StorageSmvBsr.hpp>
#include <LibUtilities/LinearAlgebra/NistSparseDescriptors.hpp>
#include <LibUtilities/LinearAlgebra/LibSMV.hpp>
#include <boost/preprocessor/iteration/local.hpp>
#include <boost/lexical_cast.hpp>
......@@ -243,17 +241,6 @@ namespace Nektar
throw 1;
}
#ifdef NEKTAR_USING_SMV
// Set pointer to rank-specific matrix-vector multiply kernel.
// Number of ranks is defined by LibSMV library
switch (blkDim)
{
#define BOOST_PP_LOCAL_MACRO(n) case n: m_mvKernel = Smv::F77NAME(smv_##n); break;
#define BOOST_PP_LOCAL_LIMITS (1, LIBSMV_MAX_RANK)
#include BOOST_PP_LOCAL_ITERATE()
}
#endif
processBcoInput(blkRows,blkCols,blkDim,bcoMat);
}
......@@ -389,18 +376,7 @@ namespace Nektar
{
case 1: Multiply_1x1(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
case 2: Multiply_2x2(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
#ifndef NEKTAR_USING_SMV
case 3: Multiply_3x3(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
case 4: Multiply_4x4(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
#endif
default:
#ifdef NEKTAR_USING_SMV
if (m_blkDim <= LIBSMV_MAX_RANK)
{
Multiply_libsmv(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
}
else
#endif
{
Multiply_generic(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
}
......@@ -426,18 +402,7 @@ namespace Nektar
{
case 1: Multiply_1x1(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
case 2: Multiply_2x2(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
#ifndef NEKTAR_USING_SMV
case 3: Multiply_3x3(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
case 4: Multiply_4x4(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
#endif
default:
#ifdef NEKTAR_USING_SMV
if (m_blkDim <= LIBSMV_MAX_RANK)
{
Multiply_libsmv(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
}
else
#endif
{
Multiply_generic(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
}
......@@ -465,18 +430,7 @@ namespace Nektar
{
case 1: Multiply_1x1(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
case 2: Multiply_2x2(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
#ifndef NEKTAR_USING_SMV
case 3: Multiply_3x3(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
case 4: Multiply_4x4(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
#endif
default:
#ifdef NEKTAR_USING_SMV
if (m_blkDim <= LIBSMV_MAX_RANK)
{
Multiply_libsmv(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
}
else
#endif
{
Multiply_generic(mb,kb,val,bindx,bpntrb,bpntre,b,c); return;
}
......@@ -626,42 +580,6 @@ namespace Nektar
}
}
#ifdef NEKTAR_USING_SMV
/// Generic zero-based BSR multiply
template<typename DataType>
void StorageSmvBsr<DataType>::Multiply_libsmv(
const int mb,
const int kb,
const double* val,
const int* bindx,
const int* bpntrb,
const int* bpntre,