Disabled external gits

This commit is contained in:
2022-04-07 18:46:57 +02:00
parent 88cb3426ad
commit 15e7120d6d
5316 changed files with 4563444 additions and 6 deletions

View File

@@ -0,0 +1,32 @@
ADD_CUSTOM_TARGET(copy_scripts)
SET(script_files go_mean mk_mean_script.sh mk_new_gnuplot.sh
perlib_plot_settings.txt action_settings.txt gnuplot_common_settings.hh )
FOREACH(script_file ${script_files})
ADD_CUSTOM_COMMAND(
TARGET copy_scripts
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/${script_file} ${CMAKE_CURRENT_BINARY_DIR}/
ARGS
)
ENDFOREACH(script_file)
ADD_CUSTOM_COMMAND(
TARGET copy_scripts
POST_BUILD
COMMAND ${CMAKE_CXX_COMPILER} --version | head -n 1 > ${CMAKE_CURRENT_BINARY_DIR}/compiler_version.txt
ARGS
)
ADD_CUSTOM_COMMAND(
TARGET copy_scripts
POST_BUILD
COMMAND echo "${Eigen_SOURCE_DIR}" > ${CMAKE_CURRENT_BINARY_DIR}/eigen_root_dir.txt
ARGS
)
add_executable(smooth smooth.cxx)
add_executable(regularize regularize.cxx)
add_executable(main mean.cxx)
add_dependencies(main copy_scripts)

View File

@@ -0,0 +1,19 @@
aat ; "{/*1.5 A x A^T}" ; "matrix size" ; 4:5000
ata ; "{/*1.5 A^T x A}" ; "matrix size" ; 4:5000
atv ; "{/*1.5 matrix^T x vector}" ; "matrix size" ; 4:5000
axpby ; "{/*1.5 Y = alpha X + beta Y}" ; "vector size" ; 5:1000000
axpy ; "{/*1.5 Y += alpha X}" ; "vector size" ; 5:1000000
matrix_matrix ; "{/*1.5 matrix matrix product}" ; "matrix size" ; 4:5000
matrix_vector ; "{/*1.5 matrix vector product}" ; "matrix size" ; 4:5000
trmm ; "{/*1.5 triangular matrix matrix product}" ; "matrix size" ; 4:5000
trisolve_vector ; "{/*1.5 triangular solver - vector (X = inv(L) X)}" ; "size" ; 4:5000
trisolve_matrix ; "{/*1.5 triangular solver - matrix (M = inv(L) M)}" ; "size" ; 4:5000
cholesky ; "{/*1.5 Cholesky decomposition}" ; "matrix size" ; 4:5000
complete_lu_decomp ; "{/*1.5 Complete LU decomposition}" ; "matrix size" ; 4:5000
partial_lu_decomp ; "{/*1.5 Partial LU decomposition}" ; "matrix size" ; 4:5000
tridiagonalization ; "{/*1.5 Tridiagonalization}" ; "matrix size" ; 4:5000
hessenberg ; "{/*1.5 Hessenberg decomposition}" ; "matrix size" ; 4:5000
symv ; "{/*1.5 symmetric matrix vector product}" ; "matrix size" ; 4:5000
syr2 ; "{/*1.5 symmretric rank-2 update (A += u^T v + u v^T)}" ; "matrix size" ; 4:5000
ger ; "{/*1.5 general rank-1 update (A += u v^T)}" ; "matrix size" ; 4:5000
rot ; "{/*1.5 apply rotation in the plane}" ; "vector size" ; 4:1000000

View File

@@ -0,0 +1,87 @@
set noclip points
set clip one
set noclip two
set bar 1.000000
set border 31 lt -1 lw 1.000
set xdata
set ydata
set zdata
set x2data
set y2data
set boxwidth
set dummy x,y
set format x "%g"
set format y "%g"
set format x2 "%g"
set format y2 "%g"
set format z "%g"
set angles radians
set nogrid
set key title ""
set key left top Right noreverse box linetype -2 linewidth 1.000 samplen 4 spacing 1 width 0
set nolabel
set noarrow
# set nolinestyle # deprecated
set nologscale
set logscale x 10
set offsets 0, 0, 0, 0
set pointsize 1
set encoding default
set nopolar
set noparametric
set view 60, 30, 1, 1
set samples 100, 100
set isosamples 10, 10
set surface
set nocontour
set clabel '%8.3g'
set mapping cartesian
set nohidden3d
set cntrparam order 4
set cntrparam linear
set cntrparam levels auto 5
set cntrparam points 5
set size ratio 0 1,1
set origin 0,0
# set data style lines
# set function style lines
set xzeroaxis lt -2 lw 1.000
set x2zeroaxis lt -2 lw 1.000
set yzeroaxis lt -2 lw 1.000
set y2zeroaxis lt -2 lw 1.000
set tics in
set ticslevel 0.5
set tics scale 1, 0.5
set mxtics default
set mytics default
set mx2tics default
set my2tics default
set xtics border mirror norotate autofreq
set ytics border mirror norotate autofreq
set ztics border nomirror norotate autofreq
set nox2tics
set noy2tics
set timestamp "" bottom norotate offset 0,0
set rrange [ * : * ] noreverse nowriteback # (currently [-0:10] )
set trange [ * : * ] noreverse nowriteback # (currently [-5:5] )
set urange [ * : * ] noreverse nowriteback # (currently [-5:5] )
set vrange [ * : * ] noreverse nowriteback # (currently [-5:5] )
set xlabel "matrix size" offset 0,0
set x2label "" offset 0,0
set timefmt "%d/%m/%y\n%H:%M"
set xrange [ 10 : 1000 ] noreverse nowriteback
set x2range [ * : * ] noreverse nowriteback # (currently [-10:10] )
set ylabel "MFLOPS" offset 0,0
set y2label "" offset 0,0
set yrange [ * : * ] noreverse nowriteback # (currently [-10:10] )
set y2range [ * : * ] noreverse nowriteback # (currently [-10:10] )
set zlabel "" offset 0,0
set zrange [ * : * ] noreverse nowriteback # (currently [-10:10] )
set zero 1e-08
set lmargin -1
set bmargin -1
set rmargin -1
set tmargin -1
set locale "C"
set xrange [4:1024]

View File

@@ -0,0 +1,58 @@
#!/bin/bash
if [ $# < 1 ]; then
echo "Usage: $0 working_directory [tiny|large [prefix]]"
else
mkdir -p $1
##cp ../libs/*/*.dat $1
mode=large
if [ $# > 2 ]; then
mode=$2
fi
if [ $# > 3 ]; then
prefix=$3
fi
EIGENDIR=`cat eigen_root_dir.txt`
webpagefilename=$1/index.html
meanstatsfilename=$1/mean.html
echo '' > $meanstatsfilename
echo '' > $webpagefilename
echo '<p><strong>Configuration</strong>' >> $webpagefilename
echo '<ul>'\
'<li>' `cat /proc/cpuinfo | grep "model name" | head -n 1`\
' (' `uname -m` ')</li>'\
'<li> compiler: ' `cat compiler_version.txt` '</li>'\
'<li> eigen3: ' `hg identify -i $EIGENDIR` '</li>'\
'</ul>' \
'</p>' >> $webpagefilename
source mk_mean_script.sh axpy $1 11 2500 100000 250000 $mode $prefix
source mk_mean_script.sh axpby $1 11 2500 100000 250000 $mode $prefix
source mk_mean_script.sh matrix_vector $1 11 50 300 1000 $mode $prefix
source mk_mean_script.sh atv $1 11 50 300 1000 $mode $prefix
source mk_mean_script.sh matrix_matrix $1 11 100 300 1000 $mode $prefix
source mk_mean_script.sh aat $1 11 100 300 1000 $mode $prefix
# source mk_mean_script.sh ata $1 11 100 300 1000 $mode $prefix
source mk_mean_script.sh trmm $1 11 100 300 1000 $mode $prefix
source mk_mean_script.sh trisolve_vector $1 11 100 300 1000 $mode $prefix
source mk_mean_script.sh trisolve_matrix $1 11 100 300 1000 $mode $prefix
source mk_mean_script.sh cholesky $1 11 100 300 1000 $mode $prefix
source mk_mean_script.sh partial_lu_decomp $1 11 100 300 1000 $mode $prefix
source mk_mean_script.sh tridiagonalization $1 11 100 300 1000 $mode $prefix
source mk_mean_script.sh hessenberg $1 11 100 300 1000 $mode $prefix
source mk_mean_script.sh symv $1 11 50 300 1000 $mode $prefix
source mk_mean_script.sh syr2 $1 11 50 300 1000 $mode $prefix
source mk_mean_script.sh ger $1 11 50 300 1000 $mode $prefix
source mk_mean_script.sh rot $1 11 2500 100000 250000 $mode $prefix
source mk_mean_script.sh complete_lu_decomp $1 11 100 300 1000 $mode $prefix
fi
## compile the web page ##
#echo `cat footer.html` >> $webpagefilename

View File

@@ -0,0 +1,182 @@
//=====================================================
// File : mean.cxx
// Author : L. Plagne <laurent.plagne@edf.fr)>
// Copyright (C) EDF R&D, lun sep 30 14:23:15 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 <vector>
#include <string>
#include <iostream>
#include <fstream>
#include "bench_parameter.hh"
#include "utils/xy_file.hh"
#include <set>
using namespace std;
double mean_calc(const vector<int> & tab_sizes, const vector<double> & tab_mflops, const int size_min, const int size_max);
class Lib_Mean{
public:
Lib_Mean( void ):_lib_name(),_mean_in_cache(),_mean_out_of_cache(){
MESSAGE("Lib_mean Default Ctor");
MESSAGE("!!! should not be used");
exit(0);
}
Lib_Mean(const string & name, const double & mic, const double & moc):_lib_name(name),_mean_in_cache(mic),_mean_out_of_cache(moc){
MESSAGE("Lib_mean Ctor");
}
Lib_Mean(const Lib_Mean & lm):_lib_name(lm._lib_name),_mean_in_cache(lm._mean_in_cache),_mean_out_of_cache(lm._mean_out_of_cache){
MESSAGE("Lib_mean Copy Ctor");
}
~Lib_Mean( void ){
MESSAGE("Lib_mean Dtor");
}
double _mean_in_cache;
double _mean_out_of_cache;
string _lib_name;
bool operator < ( const Lib_Mean &right) const
{
//return ( this->_mean_out_of_cache > right._mean_out_of_cache) ;
return ( this->_mean_in_cache > right._mean_in_cache) ;
}
};
int main( int argc , char *argv[] )
{
if (argc<6){
INFOS("!!! Error ... usage : main what mic Mic moc Moc filename1 finename2...");
exit(0);
}
INFOS(argc);
int min_in_cache=atoi(argv[2]);
int max_in_cache=atoi(argv[3]);
int min_out_of_cache=atoi(argv[4]);
int max_out_of_cache=atoi(argv[5]);
multiset<Lib_Mean> s_lib_mean ;
for (int i=6;i<argc;i++){
string filename=argv[i];
INFOS(filename);
double mic=0;
double moc=0;
{
vector<int> tab_sizes;
vector<double> tab_mflops;
read_xy_file(filename,tab_sizes,tab_mflops);
mic=mean_calc(tab_sizes,tab_mflops,min_in_cache,max_in_cache);
moc=mean_calc(tab_sizes,tab_mflops,min_out_of_cache,max_out_of_cache);
Lib_Mean cur_lib_mean(filename,mic,moc);
s_lib_mean.insert(cur_lib_mean);
}
}
cout << "<TABLE BORDER CELLPADDING=2>" << endl ;
cout << " <TR>" << endl ;
cout << " <TH ALIGN=CENTER> " << argv[1] << " </TH>" << endl ;
cout << " <TH ALIGN=CENTER> <a href=""#mean_marker""> in cache <BR> mean perf <BR> Mflops </a></TH>" << endl ;
cout << " <TH ALIGN=CENTER> in cache <BR> % best </TH>" << endl ;
cout << " <TH ALIGN=CENTER> <a href=""#mean_marker""> out of cache <BR> mean perf <BR> Mflops </a></TH>" << endl ;
cout << " <TH ALIGN=CENTER> out of cache <BR> % best </TH>" << endl ;
cout << " <TH ALIGN=CENTER> details </TH>" << endl ;
cout << " <TH ALIGN=CENTER> comments </TH>" << endl ;
cout << " </TR>" << endl ;
multiset<Lib_Mean>::iterator is = s_lib_mean.begin();
Lib_Mean best(*is);
for (is=s_lib_mean.begin(); is!=s_lib_mean.end() ; is++){
cout << " <TR>" << endl ;
cout << " <TD> " << is->_lib_name << " </TD>" << endl ;
cout << " <TD> " << is->_mean_in_cache << " </TD>" << endl ;
cout << " <TD> " << 100*(is->_mean_in_cache/best._mean_in_cache) << " </TD>" << endl ;
cout << " <TD> " << is->_mean_out_of_cache << " </TD>" << endl ;
cout << " <TD> " << 100*(is->_mean_out_of_cache/best._mean_out_of_cache) << " </TD>" << endl ;
cout << " <TD> " <<
"<a href=\"#"<<is->_lib_name<<"_"<<argv[1]<<"\">snippet</a>/"
"<a href=\"#"<<is->_lib_name<<"_flags\">flags</a> </TD>" << endl ;
cout << " <TD> " <<
"<a href=\"#"<<is->_lib_name<<"_comments\">click here</a> </TD>" << endl ;
cout << " </TR>" << endl ;
}
cout << "</TABLE>" << endl ;
ofstream output_file ("../order_lib",ios::out) ;
for (is=s_lib_mean.begin(); is!=s_lib_mean.end() ; is++){
output_file << is->_lib_name << endl ;
}
output_file.close();
}
double mean_calc(const vector<int> & tab_sizes, const vector<double> & tab_mflops, const int size_min, const int size_max){
int size=tab_sizes.size();
int nb_sample=0;
double mean=0.0;
for (int i=0;i<size;i++){
if ((tab_sizes[i]>=size_min)&&(tab_sizes[i]<=size_max)){
nb_sample++;
mean+=tab_mflops[i];
}
}
if (nb_sample==0){
INFOS("no data for mean calculation");
return 0.0;
}
return mean/nb_sample;
}

View File

@@ -0,0 +1,68 @@
#! /bin/bash
WHAT=$1
DIR=$2
echo $WHAT script generation
cat $WHAT.hh > $WHAT.gnuplot
DATA_FILE=`find $DIR -name "*.dat" | grep $WHAT`
echo plot \\ >> $WHAT.gnuplot
for FILE in $DATA_FILE
do
LAST=$FILE
done
echo LAST=$LAST
for FILE in $DATA_FILE
do
if [ $FILE != $LAST ]
then
BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >> $WHAT.gnuplot
fi
done
BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
echo "'"$LAST"'" title "'"$TITLE"'" >> $WHAT.gnuplot
#echo set term postscript color >> $WHAT.gnuplot
#echo set output "'"$WHAT.ps"'" >> $WHAT.gnuplot
echo set term pbm small color >> $WHAT.gnuplot
echo set output "'"$WHAT.ppm"'" >> $WHAT.gnuplot
echo plot \\ >> $WHAT.gnuplot
for FILE in $DATA_FILE
do
if [ $FILE != $LAST ]
then
BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >> $WHAT.gnuplot
fi
done
BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
echo "'"$LAST"'" title "'"$TITLE"'" >> $WHAT.gnuplot
echo set term jpeg large >> $WHAT.gnuplot
echo set output "'"$WHAT.jpg"'" >> $WHAT.gnuplot
echo plot \\ >> $WHAT.gnuplot
for FILE in $DATA_FILE
do
if [ $FILE != $LAST ]
then
BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
echo "'"$FILE"'" title "'"$TITLE"'" ",\\" >> $WHAT.gnuplot
fi
done
BASE=${LAST##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
echo "'"$LAST"'" title "'"$TITLE"'" >> $WHAT.gnuplot
gnuplot -persist < $WHAT.gnuplot
rm $WHAT.gnuplot

View File

@@ -0,0 +1,52 @@
#! /bin/bash
WHAT=$1
DIR=$2
MINIC=$3
MAXIC=$4
MINOC=$5
MAXOC=$6
prefix=$8
meanstatsfilename=$2/mean.html
WORK_DIR=tmp
mkdir $WORK_DIR
DATA_FILE=`find $DIR -name "*.dat" | grep _${WHAT}`
if [ -n "$DATA_FILE" ]; then
echo ""
echo "$1..."
for FILE in $DATA_FILE
do
##echo hello world
##echo "mk_mean_script1" ${FILE}
BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
##echo "mk_mean_script1" ${TITLE}
cp $FILE ${WORK_DIR}/${TITLE}
done
cd $WORK_DIR
../main $1 $3 $4 $5 $6 * >> ../$meanstatsfilename
../mk_new_gnuplot.sh $1 $2 $7
rm -f *.gnuplot
cd ..
echo '<br/>' >> $meanstatsfilename
webpagefilename=$2/index.html
# echo '<h3>'${WHAT}'</h3>' >> $webpagefilename
echo '<hr/><a href="'$prefix$1'.pdf"><img src="'$prefix$1'.png" alt="'${WHAT}'" /></a><br/>' >> $webpagefilename
fi
rm -R $WORK_DIR

View File

@@ -0,0 +1,54 @@
#!/bin/bash
WHAT=$1
DIR=$2
cat ../gnuplot_common_settings.hh > ${WHAT}.gnuplot
echo "set title " `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 2` >> $WHAT.gnuplot
echo "set xlabel " `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 3` " offset 0,0" >> $WHAT.gnuplot
echo "set xrange [" `grep ${WHAT} ../action_settings.txt | head -n 1 | cut -d ";" -f 4` "]" >> $WHAT.gnuplot
if [ $# > 3 ]; then
if [ "$3" == "tiny" ]; then
echo "set xrange [2:16]" >> $WHAT.gnuplot
echo "set nologscale" >> $WHAT.gnuplot
fi
fi
DATA_FILE=`cat ../order_lib`
echo set term postscript color rounded enhanced >> $WHAT.gnuplot
echo set output "'"../${DIR}/$WHAT.ps"'" >> $WHAT.gnuplot
# echo set term svg color rounded enhanced >> $WHAT.gnuplot
# echo "set terminal svg enhanced size 1000 1000 fname \"Times\" fsize 36" >> $WHAT.gnuplot
# echo set output "'"../${DIR}/$WHAT.svg"'" >> $WHAT.gnuplot
echo plot \\ >> $WHAT.gnuplot
for FILE in $DATA_FILE
do
LAST=$FILE
done
for FILE in $DATA_FILE
do
BASE=${FILE##*/} ; BASE=${FILE##*/} ; AVANT=bench_${WHAT}_ ; REDUC=${BASE##*$AVANT} ; TITLE=${REDUC%.dat}
echo "'"$FILE"'" `grep $TITLE ../perlib_plot_settings.txt | head -n 1 | cut -d ";" -f 2` "\\" >> $WHAT.gnuplot
if [ $FILE != $LAST ]
then
echo ", \\" >> $WHAT.gnuplot
fi
done
echo " " >> $WHAT.gnuplot
gnuplot -persist < $WHAT.gnuplot
rm $WHAT.gnuplot
ps2pdf ../${DIR}/$WHAT.ps ../${DIR}/$WHAT.pdf
convert -background white -density 120 -rotate 90 -resize 800 +dither -colors 256 -quality 0 ../${DIR}/$WHAT.ps -background white -flatten ../${DIR}/$WHAT.png
# pstoedit -rotate -90 -xscale 0.8 -yscale 0.8 -centered -yshift -50 -xshift -100 -f plot-svg aat.ps aat2.svg

View File

@@ -0,0 +1,16 @@
eigen3 ; with lines lw 4 lt 1 lc rgbcolor "black"
eigen2 ; with lines lw 3 lt 1 lc rgbcolor "#999999"
EigenBLAS ; with lines lw 3 lt 3 lc rgbcolor "#999999"
eigen3_novec ; with lines lw 2 lt 1 lc rgbcolor "#999999"
eigen3_nogccvec ; with lines lw 2 lt 2 lc rgbcolor "#991010"
INTEL_MKL ; with lines lw 3 lt 1 lc rgbcolor "#ff0000"
ATLAS ; with lines lw 3 lt 1 lc rgbcolor "#008000"
gmm ; with lines lw 3 lt 1 lc rgbcolor "#0000ff"
ublas ; with lines lw 3 lt 1 lc rgbcolor "#00b7ff"
mtl4 ; with lines lw 3 lt 1 lc rgbcolor "#d18847"
blitz ; with lines lw 3 lt 1 lc rgbcolor "#ff00ff"
F77 ; with lines lw 3 lt 3 lc rgbcolor "#e6e64c"
OPENBLAS ; with lines lw 3 lt 1 lc rgbcolor "#C05600"
C ; with lines lw 3 lt 3 lc rgbcolor "#e6bd96"
ACML ; with lines lw 2 lt 3 lc rgbcolor "#e6e64c"
blaze ; with lines lw 3 lt 1 lc rgbcolor "#ff00ff"

View File

@@ -0,0 +1,131 @@
//=====================================================
// File : regularize.cxx
// Author : L. Plagne <laurent.plagne@edf.fr)>
// Copyright (C) EDF R&D, lun sep 30 14:23:15 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 <vector>
#include <string>
#include <iostream>
#include <fstream>
#include "bench_parameter.hh"
#include <set>
using namespace std;
void read_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops);
void regularize_curve(const string & filename,
const vector<double> & tab_mflops,
const vector<int> & tab_sizes,
int start_cut_size, int stop_cut_size);
/////////////////////////////////////////////////////////////////////////////////////////////////
int main( int argc , char *argv[] )
{
// input data
if (argc<4){
INFOS("!!! Error ... usage : main filename start_cut_size stop_cut_size regularize_filename");
exit(0);
}
INFOS(argc);
int start_cut_size=atoi(argv[2]);
int stop_cut_size=atoi(argv[3]);
string filename=argv[1];
string regularize_filename=argv[4];
INFOS(filename);
INFOS("start_cut_size="<<start_cut_size);
vector<int> tab_sizes;
vector<double> tab_mflops;
read_xy_file(filename,tab_sizes,tab_mflops);
// regularizeing
regularize_curve(regularize_filename,tab_mflops,tab_sizes,start_cut_size,stop_cut_size);
}
//////////////////////////////////////////////////////////////////////////////////////
void regularize_curve(const string & filename,
const vector<double> & tab_mflops,
const vector<int> & tab_sizes,
int start_cut_size, int stop_cut_size)
{
int size=tab_mflops.size();
ofstream output_file (filename.c_str(),ios::out) ;
int i=0;
while(tab_sizes[i]<start_cut_size){
output_file << tab_sizes[i] << " " << tab_mflops[i] << endl ;
i++;
}
output_file << endl ;
while(tab_sizes[i]<stop_cut_size){
i++;
}
while(i<size){
output_file << tab_sizes[i] << " " << tab_mflops[i] << endl ;
i++;
}
output_file.close();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void read_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops){
ifstream input_file (filename.c_str(),ios::in) ;
if (!input_file){
INFOS("!!! Error opening "<<filename);
exit(0);
}
int nb_point=0;
int size=0;
double mflops=0;
while (input_file >> size >> mflops ){
nb_point++;
tab_sizes.push_back(size);
tab_mflops.push_back(mflops);
}
SCRUTE(nb_point);
input_file.close();
}

View File

@@ -0,0 +1,198 @@
//=====================================================
// File : smooth.cxx
// Author : L. Plagne <laurent.plagne@edf.fr)>
// Copyright (C) EDF R&D, lun sep 30 14:23:15 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 <vector>
#include <deque>
#include <string>
#include <iostream>
#include <fstream>
#include "bench_parameter.hh"
#include <set>
using namespace std;
void read_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops);
void write_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops);
void smooth_curve(const vector<double> & tab_mflops, vector<double> & smooth_tab_mflops,int window_half_width);
void centered_smooth_curve(const vector<double> & tab_mflops, vector<double> & smooth_tab_mflops,int window_half_width);
/////////////////////////////////////////////////////////////////////////////////////////////////
int main( int argc , char *argv[] )
{
// input data
if (argc<3){
INFOS("!!! Error ... usage : main filename window_half_width smooth_filename");
exit(0);
}
INFOS(argc);
int window_half_width=atoi(argv[2]);
string filename=argv[1];
string smooth_filename=argv[3];
INFOS(filename);
INFOS("window_half_width="<<window_half_width);
vector<int> tab_sizes;
vector<double> tab_mflops;
read_xy_file(filename,tab_sizes,tab_mflops);
// smoothing
vector<double> smooth_tab_mflops;
//smooth_curve(tab_mflops,smooth_tab_mflops,window_half_width);
centered_smooth_curve(tab_mflops,smooth_tab_mflops,window_half_width);
// output result
write_xy_file(smooth_filename,tab_sizes,smooth_tab_mflops);
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
template<class VECTOR>
double weighted_mean(const VECTOR & data)
{
double mean=0.0;
for (int i=0 ; i<data.size() ; i++){
mean+=data[i];
}
return mean/double(data.size()) ;
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void smooth_curve(const vector<double> & tab_mflops, vector<double> & smooth_tab_mflops,int window_half_width){
int window_width=2*window_half_width+1;
int size=tab_mflops.size();
vector<double> sample(window_width);
for (int i=0 ; i < size ; i++){
for ( int j=0 ; j < window_width ; j++ ){
int shifted_index=i+j-window_half_width;
if (shifted_index<0) shifted_index=0;
if (shifted_index>size-1) shifted_index=size-1;
sample[j]=tab_mflops[shifted_index];
}
smooth_tab_mflops.push_back(weighted_mean(sample));
}
}
void centered_smooth_curve(const vector<double> & tab_mflops, vector<double> & smooth_tab_mflops,int window_half_width){
int max_window_width=2*window_half_width+1;
int size=tab_mflops.size();
for (int i=0 ; i < size ; i++){
deque<double> sample;
sample.push_back(tab_mflops[i]);
for ( int j=1 ; j <= window_half_width ; j++ ){
int before=i-j;
int after=i+j;
if ((before>=0)&&(after<size)) // inside of the vector
{
sample.push_front(tab_mflops[before]);
sample.push_back(tab_mflops[after]);
}
}
smooth_tab_mflops.push_back(weighted_mean(sample));
}
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void write_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops){
ofstream output_file (filename.c_str(),ios::out) ;
for (int i=0 ; i < tab_sizes.size() ; i++)
{
output_file << tab_sizes[i] << " " << tab_mflops[i] << endl ;
}
output_file.close();
}
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void read_xy_file(const string & filename, vector<int> & tab_sizes, vector<double> & tab_mflops){
ifstream input_file (filename.c_str(),ios::in) ;
if (!input_file){
INFOS("!!! Error opening "<<filename);
exit(0);
}
int nb_point=0;
int size=0;
double mflops=0;
while (input_file >> size >> mflops ){
nb_point++;
tab_sizes.push_back(size);
tab_mflops.push_back(mflops);
}
SCRUTE(nb_point);
input_file.close();
}

View File

@@ -0,0 +1,68 @@
#! /bin/bash
ORIG_DIR=$1
SMOOTH_DIR=${ORIG_DIR}_smooth
mkdir ${SMOOTH_DIR}
AXPY_FILE=`find ${ORIG_DIR} -name "*.dat" | grep axpy`
for FILE in ${AXPY_FILE}
do
echo $FILE
BASE=${FILE##*/}
./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}_tmp
./regularize ${SMOOTH_DIR}/${BASE}_tmp 2500 15000 ${SMOOTH_DIR}/${BASE}
rm -f ${SMOOTH_DIR}/${BASE}_tmp
done
MATRIX_VECTOR_FILE=`find ${ORIG_DIR} -name "*.dat" | grep matrix_vector`
for FILE in ${MATRIX_VECTOR_FILE}
do
echo $FILE
BASE=${FILE##*/}
./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}_tmp
./regularize ${SMOOTH_DIR}/${BASE}_tmp 50 180 ${SMOOTH_DIR}/${BASE}
rm -f ${SMOOTH_DIR}/${BASE}_tmp
done
MATRIX_MATRIX_FILE=`find ${ORIG_DIR} -name "*.dat" | grep matrix_matrix`
for FILE in ${MATRIX_MATRIX_FILE}
do
echo $FILE
BASE=${FILE##*/}
./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}
done
AAT_FILE=`find ${ORIG_DIR} -name "*.dat" | grep _aat`
for FILE in ${AAT_FILE}
do
echo $FILE
BASE=${FILE##*/}
./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}
done
ATA_FILE=`find ${ORIG_DIR} -name "*.dat" | grep _ata`
for FILE in ${ATA_FILE}
do
echo $FILE
BASE=${FILE##*/}
./smooth ${ORIG_DIR}/${BASE} 4 ${SMOOTH_DIR}/${BASE}
done
### no smoothing for tinyvector and matrices libs
TINY_BLITZ_FILE=`find ${ORIG_DIR} -name "*.dat" | grep tiny_blitz`
for FILE in ${TINY_BLITZ_FILE}
do
echo $FILE
BASE=${FILE##*/}
cp ${ORIG_DIR}/${BASE} ${SMOOTH_DIR}/${BASE}
done
TVMET_FILE=`find ${ORIG_DIR} -name "*.dat" | grep tvmet`
for FILE in ${TVMET_FILE}
do
echo $FILE
BASE=${FILE##*/}
cp ${ORIG_DIR}/${BASE} ${SMOOTH_DIR}/${BASE}
done