Commit 47816454 authored by Blake Nelson's avatar Blake Nelson

Added the gfortran version of ACML.


git-svn-id: https://gforge.sci.utah.edu/svn/nektar/trunk@197 305cdda6-5ce1-45b3-a98d-dfc68c8b3305
parent 7357a3ef
......@@ -10,6 +10,7 @@ IF( ${CMAKE_COMPILER_IS_GNUCXX} )
ENDIF( ${CMAKE_COMPILER_IS_GNUCXX} )
SET(USE_MKL OFF CACHE BOOL "Use the Intel Math Kernel Library (MKL) for BLAS and Lapack support." )
SET(USE_ACML OFF CACHE BOOL "Use the AMD Core Math Library (ACML) for BLAS and Lapack support." )
SET(USE_ATLAS OFF CACHE BOOL "Use ATLAS for BLAS and Lapack support." )
SET(USE_EXPRESSION_TEMPLATES ON CACHE BOOL "")
......@@ -25,6 +26,10 @@ IF( USE_ATLAS )
INCLUDE( FindAtlas )
ENDIF( USE_ATLAS )
IF( USE_ACML )
INCLUDE (FindACML)
ENDIF( USE_ACML )
INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${BOOST_INCLUDE_DIR} ${LOKI_INCLUDE_DIR} ${PROJECT_BINARY_DIR})
SET(NEKTAR_VERSION 0.1.1)
......@@ -66,5 +71,11 @@ IF( USE_ATLAS )
SET(NEKTAR_USING_ATLAS TRUE)
ENDIF( USE_ATLAS )
IF( USE_ACML )
SET(NEKTAR_USING_BLAS TRUE)
SET(NEKTAR_USING_LAPACK TRUE)
SET(NEKTAR_USING_ACML TRUE)
ENDIF( USE_ACML )
SUBDIRS(LibUtilities LocalRegions MultiRegions SpatialDomains StdRegions Stochastic UnitTests)
FIND_PATH(ACML_INCLUDE_PATH acml.h /usr/include /usr/local/include
/opt/acml3.5.0/gnu64/include
/opt/acml3.5.0/gfortran64_int64/include
/opt/acml3.5.0/gfortran64_mp_int64/include )
#FIND_LIBRARY( BOOST_UNIT_TEST_LIB NAMES boost_unit_test_framework
# PATHS /usr/lib /usr/local/lib C:\\Boost\\lib )
#FIND_LIBRARY( BOOST_PROGRAM_OPTIONS_LIB NAMES boost_program_options
# PATHS /usr/lib /usr/local/lib C:\\Boost\\lib )
#FIND_LIBRARY( BOOST_FILESYSTEM_LIB NAMES boost_filesystem
# PATHS /usr/lib /usr/local/lib C:\\Boost\\lib )
SET(ACML_LIB_PATH ${ACML_INCLUDE_PATH}/../lib)
FIND_LIBRARY( ACML NAMES acml PATHS ${ACML_LIB_PATH} )
SET( ACML_BLAS_INCLUDE_FILE ${ACML_INCLUDE_PATH}/acml.h )
SET( ACML_LAPACK_INCLUDE_FILE ${ACML_INCLUDE_PATH}/acml.h )
IF (ACML_INCLUDE_PATH)
SET(ACML_FOUND ON)
ENDIF (ACML_INCLUDE_PATH)
IF (ACML_FOUND)
IF (NOT ACML_FIND_QUIETLY)
MESSAGE(STATUS "Found ACML: ${ACML_INCLUDE_PATH}")
ENDIF (NOT ACML_FIND_QUIETLY)
ELSE(ACML_FOUND)
IF (ACML_FIND_REQUIRED)
MESSAGE(FATAL_ERROR "Could not find ACML")
ENDIF (ACML_FIND_REQUIRED)
ENDIF (ACML_FOUND)
......@@ -44,6 +44,10 @@ namespace Nektar
CBLAS_TRANSPOSE TransposeMapping[] = { CblasNoTrans, CblasTrans, CblasConjTrans };
#endif
#ifdef NEKTAR_USING_ACML
char AcmlTransposeMapping[] = { 'N', 'T', 'C' };
#endif
void dgemm(const MatrixOrder order, const Transpose MatrixATranspose, const Transpose MatrixBTranspose,
const int M, const int N, const int K,
const double alpha, const double* A, const int lda, const double* B,
......@@ -61,6 +65,13 @@ namespace Nektar
alpha, A, lda, B, ldb, beta, C, ldc);
#endif
#ifdef NEKTAR_USING_ACML
// The const_cast is necessary here because ACML has a broken interface. The BLAS contract specifies
// that A and B are not modified, so this should be safe.
::dgemm(AcmlTransposeMapping[MatrixATranspose], AcmlTransposeMapping[MatrixBTranspose],
M, N, K, alpha, const_cast<double*>(A), lda, const_cast<double*>(B), ldb, beta, C, ldc);
#endif
}
void dgemm(const int rowsInA, const int columnsInA, const int columnsInB,
......@@ -78,6 +89,9 @@ namespace Nektar
/**
$Log: blas.cpp,v $
Revision 1.3 2006/11/06 17:09:09 bnelson
*** empty log message ***
Revision 1.2 2006/10/30 05:11:16 bnelson
Added preliminary linear system and block matrix support.
......
......@@ -40,11 +40,16 @@
#cmakedefine NEKTAR_USING_BLAS
#cmakedefine NEKTAR_USING_MKL
#cmakedefine NEKTAR_USING_ATLAS
#cmakedefine NEKTAR_USING_ACML
#ifdef NEKTAR_USING_MKL
#include <@MKL_BLAS_INCLUDE_FILE@>
#endif
#ifdef NEKTAR_USING_ACML
#include <@ACML_BLAS_INCLUDE_FILE@>
#endif
#ifdef NEKTAR_USING_ATLAS
#ifdef __cplusplus
extern "C"
......
......@@ -71,7 +71,12 @@ void dgetrs(int matrixRows, int matrixColumns, const double* A, double* x)
int pivotSize = std::max(1, std::min(m, n));
int info = 0;
boost::shared_array<int> ipivot = Nektar::MemoryManager::AllocateSharedArray<int>(pivotSize);
#ifdef NEKTAR_USING_ACML
dgetrf(m, n, factoredMatrix.GetPtr().get(), m, ipivot.get(), &info);
#else
dgetrf(&m, &n, factoredMatrix.GetPtr().get(), &m, ipivot.get(), &info);
#endif
if( info < 0 )
{
......@@ -89,7 +94,12 @@ void dgetrs(int matrixRows, int matrixColumns, const double* A, double* x)
//void dgetrs(char *trans,int *n,int *nrhs,double *a,int *lda,int *ipiv,double *b,int *ldb,int *info);
char trans = 'N';
int nrhs = 1; // ONly 1 right hand side.
#ifdef NEKTAR_USING_ACML
dgetrs(trans, matrixRows, nrhs, factoredMatrix.GetPtr().get(), matrixRows, ipivot.get(), x, matrixRows, &info);
#else
dgetrs(&trans, &matrixRows, &nrhs, factoredMatrix.GetPtr().get(), &matrixRows, ipivot.get(), x, &matrixRows, &info);
#endif //NEKTAR_USING_ACML
if( info < 0 )
{
......
......@@ -47,6 +47,10 @@
#include <@MKL_LAPACK_INCLUDE_FILE@>
#endif //NEKTAR_USING_MKL
#ifdef NEKTAR_USING_ACML
#include <@ACML_LAPACK_INCLUDE_FILE@>
#endif //NEKTAR_USING_ACML
// dgetrs is defined as normal in MKL. We'll only need a common interface here
// if things are different in other implementations.
//void dgetrs(char *trans, int *n, int *nrhs, double *a, int *lda, int *ipiv, double *b, int *ldb, int *info)
......
......@@ -57,6 +57,10 @@ IF( USE_MKL AND MKL_FOUND )
)
ENDIF( USE_MKL AND MKL_FOUND )
IF( USE_ACML AND ACML_FOUND )
TARGET_LINK_LIBRARIES(UnitTests ${ACML} gfortran )
ENDIF( USE_ACML AND ACML_FOUND )
IF( USE_ATLAS AND ATLAS_FOUND )
TARGET_LINK_LIBRARIES(UnitTests
${ATLAS_LAPACK}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment