Clang-format tests, examples, libraries, benchmarks, etc.

This commit is contained in:
Antonio Sánchez
2023-12-05 21:22:55 +00:00
committed by Rasmus Munk Larsen
parent 3252ecc7a4
commit 46e9cdb7fe
876 changed files with 33453 additions and 37795 deletions

View File

@@ -1,14 +1,14 @@
//=====================================================
// File : size_lin_log.hh
// Author : L. Plagne <laurent.plagne@edf.fr)>
// Author : L. Plagne <laurent.plagne@edf.fr)>
// Copyright (C) EDF R&D, mar déc 3 18:59:37 CET 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
@@ -16,55 +16,41 @@
// 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 SIZE_LIN_LOG
#define SIZE_LIN_LOG
#include "size_log.hh"
template<class Vector>
void size_lin_log(const int nb_point, const int /*size_min*/, const int size_max, Vector & X)
{
int ten=10;
int nine=9;
template <class Vector>
void size_lin_log(const int nb_point, const int /*size_min*/, const int size_max, Vector& X) {
int ten = 10;
int nine = 9;
X.resize(nb_point);
if (nb_point>ten){
for (int i=0;i<nine;i++){
X[i]=i+1;
if (nb_point > ten) {
for (int i = 0; i < nine; i++) {
X[i] = i + 1;
}
Vector log_size;
size_log(nb_point-nine,ten,size_max,log_size);
for (int i=0;i<nb_point-nine;i++){
X[i+nine]=log_size[i];
size_log(nb_point - nine, ten, size_max, log_size);
for (int i = 0; i < nb_point - nine; i++) {
X[i + nine] = log_size[i];
}
}
else{
for (int i=0;i<nb_point;i++){
X[i]=i+1;
} else {
for (int i = 0; i < nb_point; i++) {
X[i] = i + 1;
}
}
// for (int i=0;i<nb_point;i++){
// INFOS("computed sizes : X["<<i<<"]="<<X[i]);
// }
// for (int i=0;i<nb_point;i++){
// INFOS("computed sizes : X["<<i<<"]="<<X[i]);
// }
}
#endif

View File

@@ -1,14 +1,14 @@
//=====================================================
// File : size_log.hh
// Author : L. Plagne <laurent.plagne@edf.fr)>
// Author : L. Plagne <laurent.plagne@edf.fr)>
// Copyright (C) EDF R&D, lun sep 30 14:23:17 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
@@ -16,7 +16,7 @@
// 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 SIZE_LOG
#define SIZE_LOG
@@ -25,30 +25,26 @@
// resize() method
// [] operator for setting element
// the vector element are int compatible.
template<class Vector>
void size_log(const int nb_point, const int size_min, const int size_max, Vector & X)
{
template <class Vector>
void size_log(const int nb_point, const int size_min, const int size_max, Vector& X) {
X.resize(nb_point);
float ls_min=log(float(size_min));
float ls_max=log(float(size_max));
float ls_min = log(float(size_min));
float ls_max = log(float(size_max));
float ls=0.0;
float ls = 0.0;
float delta_ls=(ls_max-ls_min)/(float(nb_point-1));
float delta_ls = (ls_max - ls_min) / (float(nb_point - 1));
int size=0;
int size = 0;
for (int i=0;i<nb_point;i++){
for (int i = 0; i < nb_point; i++) {
ls = ls_min + float(i) * delta_ls;
ls = ls_min + float(i)*delta_ls ;
size=int(exp(ls));
size = int(exp(ls));
X[i]=size;
X[i] = size;
}
}
#endif

View File

@@ -9,82 +9,120 @@
/* --- Definition macros file to print information if _DEBUG_ is defined --- */
# ifndef UTILITIES_H
# define UTILITIES_H
#ifndef UTILITIES_H
#define UTILITIES_H
# include <stdlib.h>
//# include <iostream> ok for gcc3.01
# include <iostream>
#include <stdlib.h>
// # include <iostream> ok for gcc3.01
#include <iostream>
/* --- INFOS is always defined (without _DEBUG_): to be used for warnings, with release version --- */
# define HEREWEARE cout<<flush ; cerr << __FILE__ << " [" << __LINE__ << "] : " << flush ;
# define INFOS(chain) {HEREWEARE ; cerr << chain << endl ;}
# define PYSCRIPT(chain) {cout<<flush ; cerr << "---PYSCRIPT--- " << chain << endl ;}
#define HEREWEARE \
cout << flush; \
cerr << __FILE__ << " [" << __LINE__ << "] : " << flush;
#define INFOS(chain) \
{ \
HEREWEARE; \
cerr << chain << endl; \
}
#define PYSCRIPT(chain) \
{ \
cout << flush; \
cerr << "---PYSCRIPT--- " << chain << endl; \
}
/* --- To print date and time of compilation of current source on stdout --- */
# if defined ( __GNUC__ )
# define COMPILER "g++" ;
# elif defined ( __sun )
# define COMPILER "CC" ;
# elif defined ( __KCC )
# define COMPILER "KCC" ;
# elif defined ( __PGI )
# define COMPILER "pgCC" ;
# else
# define COMPILER "undefined" ;
# endif
#if defined(__GNUC__)
#define COMPILER "g++";
#elif defined(__sun)
#define COMPILER "CC";
#elif defined(__KCC)
#define COMPILER "KCC";
#elif defined(__PGI)
#define COMPILER "pgCC";
#else
#define COMPILER "undefined";
#endif
# ifdef INFOS_COMPILATION
# error INFOS_COMPILATION already defined
# endif
# define INFOS_COMPILATION {\
cerr << flush;\
cout << __FILE__ ;\
cout << " [" << __LINE__ << "] : " ;\
cout << "COMPILED with " << COMPILER ;\
cout << ", " << __DATE__ ; \
cout << " at " << __TIME__ << endl ;\
cout << "\n\n" ;\
cout << flush ;\
}
#ifdef INFOS_COMPILATION
#error INFOS_COMPILATION already defined
#endif
#define INFOS_COMPILATION \
{ \
cerr << flush; \
cout << __FILE__; \
cout << " [" << __LINE__ << "] : "; \
cout << "COMPILED with " << COMPILER; \
cout << ", " << __DATE__; \
cout << " at " << __TIME__ << endl; \
cout << "\n\n"; \
cout << flush; \
}
# ifdef _DEBUG_
#ifdef _DEBUG_
/* --- the following MACROS are useful at debug time --- */
# define HERE cout<<flush ; cerr << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " << flush ;
# define SCRUTE(var) HERE ; cerr << #var << "=" << var << endl ;
# define MESSAGE(chain) {HERE ; cerr << chain << endl ;}
# define INTERRUPTION(code) HERE ; cerr << "INTERRUPTION return code= " << code << endl ; exit(code) ;
#define HERE \
cout << flush; \
cerr << "- Trace " << __FILE__ << " [" << __LINE__ << "] : " << flush;
#define SCRUTE(var) \
HERE; \
cerr << #var << "=" << var << endl;
#define MESSAGE(chain) \
{ \
HERE; \
cerr << chain << endl; \
}
#define INTERRUPTION(code) \
HERE; \
cerr << "INTERRUPTION return code= " << code << endl; \
exit(code);
# ifndef ASSERT
# define ASSERT(condition) if (!(condition)){ HERE ; cerr << "CONDITION " << #condition << " NOT VERIFIED"<< endl ; INTERRUPTION(1) ;}
# endif /* ASSERT */
#ifndef ASSERT
#define ASSERT(condition) \
if (!(condition)) { \
HERE; \
cerr << "CONDITION " << #condition << " NOT VERIFIED" << endl; \
INTERRUPTION(1); \
}
#endif /* ASSERT */
#define REPERE cout<<flush ; cerr << " --------------" << endl << flush ;
#define BEGIN_OF(chain) {REPERE ; HERE ; cerr << "Begin of: " << chain << endl ; REPERE ; }
#define END_OF(chain) {REPERE ; HERE ; cerr << "Normal end of: " << chain << endl ; REPERE ; }
#define REPERE \
cout << flush; \
cerr << " --------------" << endl << flush;
#define BEGIN_OF(chain) \
{ \
REPERE; \
HERE; \
cerr << "Begin of: " << chain << endl; \
REPERE; \
}
#define END_OF(chain) \
{ \
REPERE; \
HERE; \
cerr << "Normal end of: " << chain << endl; \
REPERE; \
}
#else /* ifdef _DEBUG_*/
#define HERE
#define SCRUTE(var)
#define MESSAGE(chain)
#define INTERRUPTION(code)
# else /* ifdef _DEBUG_*/
# define HERE
# define SCRUTE(var)
# define MESSAGE(chain)
# define INTERRUPTION(code)
# ifndef ASSERT
# define ASSERT(condition)
# endif /* ASSERT */
#ifndef ASSERT
#define ASSERT(condition)
#endif /* ASSERT */
#define REPERE
#define BEGIN_OF(chain)
#define END_OF(chain)
#endif /* ifdef _DEBUG_*/
# endif /* ifdef _DEBUG_*/
# endif /* ifndef UTILITIES_H */
#endif /* ifndef UTILITIES_H */

View File

@@ -1,14 +1,14 @@
//=====================================================
// File : dump_file_x_y.hh
// Author : L. Plagne <laurent.plagne@edf.fr)>
// Author : L. Plagne <laurent.plagne@edf.fr)>
// Copyright (C) EDF R&D, lun sep 30 14:23:20 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
@@ -16,7 +16,7 @@
// 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 XY_FILE_HH
#define XY_FILE_HH
#include <fstream>
@@ -25,24 +25,22 @@
#include <vector>
using namespace std;
bool read_xy_file(const std::string & filename, std::vector<int> & tab_sizes,
std::vector<double> & tab_mflops, bool quiet = false)
{
bool read_xy_file(const std::string& filename, std::vector<int>& tab_sizes, std::vector<double>& tab_mflops,
bool quiet = false) {
std::ifstream input_file(filename.c_str(), std::ios::in);
std::ifstream input_file (filename.c_str(),std::ios::in);
if (!input_file){
if (!input_file) {
if (!quiet) {
INFOS("!!! Error opening "<<filename);
INFOS("!!! Error opening " << filename);
}
return false;
}
int nb_point=0;
int size=0;
double mflops=0;
int nb_point = 0;
int size = 0;
double mflops = 0;
while (input_file >> size >> mflops ){
while (input_file >> size >> mflops) {
nb_point++;
tab_sizes.push_back(size);
tab_mflops.push_back(mflops);
@@ -60,16 +58,14 @@ bool read_xy_file(const std::string & filename, std::vector<int> & tab_sizes,
using namespace std;
template<class Vector_A, class Vector_B>
void dump_xy_file(const Vector_A & X, const Vector_B & Y, const std::string & filename){
ofstream outfile (filename.c_str(),ios::out) ;
int size=X.size();
for (int i=0;i<size;i++)
outfile << X[i] << " " << Y[i] << endl;
template <class Vector_A, class Vector_B>
void dump_xy_file(const Vector_A& X, const Vector_B& Y, const std::string& filename) {
ofstream outfile(filename.c_str(), ios::out);
int size = X.size();
for (int i = 0; i < size; i++) outfile << X[i] << " " << Y[i] << endl;
outfile.close();
}
}
#endif