imported a reworked version of BTL (Benchmark for Templated Libraries).

the modifications to initial code follow:
* changed build system from plain makefiles to cmake
* added eigen2 (4 versions: vec/novec and fixed/dynamic), GMM++, MTL4 interfaces
* added "transposed matrix * vector" product action
* updated blitz interface to use condensed products instead of hand coded loops
* removed some deprecated interfaces
* changed default storage order to column major for all libraries
* new generic bench timer strategy which is supposed to be more accurate
* various code clean-up
This commit is contained in:
Gael Guennebaud
2008-07-09 14:04:48 +00:00
parent 5f55ab524c
commit 28539e7597
115 changed files with 8825 additions and 2 deletions

View File

@@ -0,0 +1,118 @@
//=====================================================
// File : ATLAS_LU_solve_interface.hh
// Author : L. Plagne <laurent.plagne@edf.fr)>
// Copyright (C) EDF R&D, lun sep 30 14:23:22 CEST 2002
//=====================================================
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
#ifndef ATLAS_LU_solve_interface_HH
#define ATLAS_LU_solve_interface_HH
#include "ATLAS_interface.hh"
extern "C"
{
#include <atlas_level1.h>
#include <atlas_level2.h>
#include <atlas_level3.h>
#include "cblas.h"
#include <atlas_lapack.h>
}
template<class real>
class ATLAS_LU_solve_interface : public ATLAS_interface<real>
{
public :
typedef typename ATLAS_interface<real>::gene_matrix gene_matrix;
typedef typename ATLAS_interface<real>::gene_vector gene_vector;
typedef int * Pivot_Vector;
inline static void new_Pivot_Vector(Pivot_Vector & pivot, int N)
{
pivot = new int[N];
}
inline static void free_Pivot_Vector(Pivot_Vector & pivot)
{
delete pivot;
}
inline static void LU_factor(gene_matrix & LU, Pivot_Vector & pivot, int N)
{
int error=ATL_dgetrf(CblasColMajor,N,N,LU,N,pivot);
}
inline static void LU_solve(const gene_matrix & LU, const Pivot_Vector pivot, const gene_vector &B, gene_vector X, int N)
{
copy_vector(B,X,N);
ATL_dgetrs(CblasColMajor,CblasNoTrans,N,1,LU,N,pivot,X,N);
}
};
template<>
class ATLAS_LU_solve_interface<float> : public ATLAS_interface<float>
{
public :
typedef int * Pivot_Vector;
inline static void new_Pivot_Vector(Pivot_Vector & pivot, int N)
{
pivot = new int[N];
}
inline static void free_Pivot_Vector(Pivot_Vector & pivot)
{
delete pivot;
}
inline static void LU_factor(gene_matrix & LU, Pivot_Vector & pivot, int N)
{
int error=ATL_sgetrf(CblasColMajor,N,N,LU,N,pivot);
}
inline static void LU_solve(const gene_matrix & LU, const Pivot_Vector pivot, const gene_vector &B, gene_vector X, int N)
{
copy_vector(B,X,N);
ATL_sgetrs(CblasColMajor,CblasNoTrans,N,1,LU,N,pivot,X,N);
}
};
#endif

View File

@@ -0,0 +1,120 @@
//=====================================================
// File : ATLAS_interface.hh
// Author : L. Plagne <laurent.plagne@edf.fr)>
// Copyright (C) EDF R&D, lun sep 30 14:23:21 CEST 2002
//=====================================================
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
#ifndef ATLAS_PRODUIT_MATRICE_VECTEUR_HH
#define ATLAS_PRODUIT_MATRICE_VECTEUR_HH
#include "f77_interface_base.hh"
#include <string>
extern "C"
{
#include <atlas_level1.h>
#include <atlas_level2.h>
#include <atlas_level3.h>
#include "cblas.h"
}
template<class real>
class ATLAS_interface : public f77_interface_base<real>
{
public :
typedef typename f77_interface_base<real>::gene_matrix gene_matrix;
typedef typename f77_interface_base<real>::gene_vector gene_vector;
static inline std::string name( void )
{
return "ATLAS";
}
static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)
{
ATL_dgemv(CblasNoTrans,N,N,1.0,A,N,B,1,0.0,X,1);
}
static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N)
{
ATL_dgemm(CblasNoTrans,CblasNoTrans,N,N,N,1.0,A,N,B,N,0.0,X,N);
}
static inline void ata_product(gene_matrix & A, gene_matrix & X, int N)
{
ATL_dgemm(CblasTrans,CblasNoTrans,N,N,N,1.0,A,N,A,N,0.0,X,N);
}
static inline void aat_product(gene_matrix & A, gene_matrix & X, int N)
{
ATL_dgemm(CblasNoTrans,CblasTrans,N,N,N,1.0,A,N,A,N,0.0,X,N);
}
static inline void axpy(real coef, const gene_vector & X, gene_vector & Y, int N)
{
ATL_daxpy(N,coef,X,1,Y,1);
}
};
template<>
class ATLAS_interface<float> : public f77_interface_base<float>
{
public :
static inline std::string name( void )
{
return "ATLAS";
}
static inline void matrix_vector_product(gene_matrix & A, gene_vector & B, gene_vector & X, int N)
{
ATL_sgemv(CblasNoTrans,N,N,1.0,A,N,B,1,0.0,X,1);
}
static inline void matrix_matrix_product(gene_matrix & A, gene_matrix & B, gene_matrix & X, int N)
{
ATL_sgemm(CblasNoTrans,CblasNoTrans,N,N,N,1.0,A,N,B,N,0.0,X,N);
}
static inline void ata_product(gene_matrix & A, gene_matrix & X, int N)
{
ATL_sgemm(CblasTrans,CblasNoTrans,N,N,N,1.0,A,N,A,N,0.0,X,N);
}
static inline void aat_product(gene_matrix & A, gene_matrix & X, int N)
{
ATL_sgemm(CblasNoTrans,CblasTrans,N,N,N,1.0,A,N,A,N,0.0,X,N);
}
static inline void axpy(float coef, const gene_vector & X, gene_vector & Y, int N)
{
ATL_saxpy(N,coef,X,1,Y,1);
}
};
#endif

View File

@@ -0,0 +1,4 @@
include_directories(${BLITZ_INCLUDES})
add_executable(btl_blitz main.cpp)
target_link_libraries(btl_blitz ${BLITZ_LIBRARIES})

View File

@@ -0,0 +1,49 @@
//=====================================================
// File : main.cpp
// Author : L. Plagne <laurent.plagne@edf.fr)>
// Copyright (C) EDF R&D, lun sep 30 14:23:21 CEST 2002
//=====================================================
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
#include "utilities.h"
#include "ATLAS_interface.hh"
#include "ATLAS_LU_solve_interface.hh"
#include "bench.hh"
#include "action_matrix_vector_product.hh"
#include "action_matrix_matrix_product.hh"
#include "action_axpy.hh"
#include "action_lu_solve.hh"
#include "action_ata_product.hh"
#include "action_aat_product.hh"
int main()
{
bench<Action_axpy<ATLAS_interface<REAL_TYPE> > >(MIN_AXPY,MAX_AXPY,NB_POINT);
bench<Action_matrix_vector_product<ATLAS_interface<REAL_TYPE> > >(MIN_MV,MAX_MV,NB_POINT);
bench<Action_matrix_matrix_product<ATLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
bench<Action_ata_product<ATLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
bench<Action_aat_product<ATLAS_interface<REAL_TYPE> > >(MIN_MM,MAX_MM,NB_POINT);
// bench<Action_lu_solve<ATLAS_LU_solve_interface<REAL_TYPE> > >(MIN_LU,MAX_LU,NB_POINT);
return 0;
}

View File

@@ -0,0 +1,33 @@
Bonjour à tous,
Une dizaine de candidats Neptune se sont déjà déclarés pour la formation C++
(sur la base de 2 jours/semaine pendant 1 mois).
Il faut faire une proposition de date pour la formation. Les vacances scolaires zone C (Paris)
se terminent le 22 avril (au matin) nous pourrions commencer ce jour.
A priori il me semble que deux jours consécutifs soient préférables. Je propose les mardi et mercredi
de chaque semaine. Sachant qu'il y a 2 jeudi (1er et 8 mai) consécutifs qui sont fériés.
Dans cette hypothèse les dates de formation seraient :
Mardi 22 avril (Vincent/Marc)
Mercredi 23 avril (Marc)
Mardi 29 avril (Marc/Antoine)
Mercredi 30 avril (Antoine)
Mardi 6 mai (Antoine)
Mercredi 7 mai (Antoine)
Mardi 13 mai (Laurent)
Mercredi 14 mai (Laurent)
J'ai mis entre parenthèse les intervenants principaux (on doit choisir le deuxième formateur pour chaque session).
Qu'en pensez-vous ?
Je dois toujours présenter un programme, pouvez-vous me donner vos programmes respectifs...?
Laurent