# How to run Acovea???

## maglomanic

Guys i have just emerged Acovea benchmarking utility.

it is installed in :/usr/share/acovea   folder

inside this folder there two folders benchmarks and config

how do i run acovea??? any ideas?

i tried compiling one of the files in benchmarks but gcc gave an error???

any ideas ..

thanks in advance.  :Very Happy: 

----------

## John5788

```

#!/bin/sh

 

BENCHES="alma evo fft huff lin mat1 tree"

 

for bench in $BENCHES; do

        echo ""

        echo "*** $bench ***"

        time runacovea -config gcc33_pentium4.acovea -bench ${bench}bench.c\

                1> ${bench}.run 2> ${bench}.err

done 
```

use this script to output logs. change the arguments to suit your computer.

then use this perl script to analyze the logs

```
#!/usr/bin/env perl

#----------------------------------------------------------------------------

#

# Settings

#

# Names of benchmarks run by Acovea

@benches = ("alma", "evo", "fft", "huff", "lin", "mat1", "tree");

# Number of populations evolved per benchmark by Acovea

$pops = 5;

# Population size

$popsize = 40;

# Number of generations of evolution by Acovea

$gens = 20;

# Suppress output of statistical mumbo-jumbo?

$suppress = "1";

#----------------------------------------------------------------------------

#

# Digest data from *.run files

#

@switches = ();

$listflag = "";

foreach $bench (@benches) {

   open(BENCHRUN, "$bench.run");

   $genflag = "";

   $countflag = "";

   $blankflag = "";

   $linecount = 0;

   while (<BENCHRUN>) {

      # Look for final iteration

      if(/^iteration $gens/) {$genflag = "1"; next;}

      # Look for start of option counts table

      if($genflag && /^Option counts:/) {$countflag = "1"; next;}

      # Look for end of option counts table (blank line)

      if($genflag && $countflag && /^$/) {$blankflag = "1"; next;}

      # Parse counts lines

      if($genflag && $countflag && (! $blankflag)) {

         # first bench

         s/\n$//;

         if($listflag) {

            s/(^\s*?-\S+?\s+?)(\S)/$2/;

            s/\s+/ /g;

            s/\s$//;

            my @line2 = split(/\s/);

            $ref2 = $switches[$linecount];

            push @$ref2, @line2;

         }

         # subsequent benches

         else {

            s/^\s*?-/-/;

            s/\s+/ /g;

            s/\s$//;

            my @line = split(/\s/);

            $ref= \@line;

            @switches = (@switches, $ref);

         }

         $linecount += 1;

      }

   }

   $listflag = "1";

}

#----------------------------------------------------------------------------

#

# Calculate mean (total/bench), standard deviation, confidence interval,

# and score for each switch across all the benchmarks

#

#

# Implementation of erf()

# (continuing fraction by Laplace, Legendre, Ramanujan)

#

$pi = 3.14159;

sub erffrac {

   my($x, $count, $max) = @_;

   if ($count > $max) {1;}

   else{

      if ($count % 2 == 0) {$a = 2;}

      else {$a = 1;}

      $a*$x+$count/&erffrac($x, $count + 1, $max);

   };

}

sub erf {

   my($x) = @_ ;

   1-exp(-$x**2)/sqrt($pi)/&erffrac($x, 1, 10.*(1 + 1/$x));

}

#

# End implementation of erf()

#

@tswitches = ();

foreach $line (@switches) {

   # Mean

   $col = 1 + $pops;

   $total = 0;

   @line2 = @$line;

   while ($col < $#line2 + 1) {

      $total += $line2[$col];

      $col += 1 + $pops ;

   }

   $mean = $total/$#benches;

   # Standard deviation

   $col = 1 + $pops;

   $total = 0;

   while ($col < $#line2 + 1) {

      $total += ($line2[$col] - $mean)**2;

      $col += 1 + $pops ;

   }

   $stddev = sqrt($total)/$pops/$popsize;

   $mean = $mean/$pops/$popsize;  # renormalize

   # Confidence interval

   $x=$mean/$stddev/sqrt(2); # cum. prob. = erf(n/sqrt(2))

   # Gaussian approximation to Poisson distribution only works

   # for counts >= 5 (or so)

   if ($mean < 5/$popsize) {$confidence = 0.;}

   else {$confidence = &erf($x);}

   # score

   $score = $mean * $confidence * 100;

   # Store data

   my @foo = ($line2[0], $mean, $stddev, $confidence, $score);

   push @tswitches, \@foo;

}

#----------------------------------------------------------------------------

#

# Sort by score

#

sub byScore {

   $b2 = $b; $a2 = $a;

   @b3 = @$b2; @a3 = @$a2;

   $b4 = @b3[4]; $a4 = @a3[4];

   $b4 <=> $a4;

}

@sswitches = sort byScore @tswitches;

#----------------------------------------------------------------------------

#

# Set up annotation hash (GCC 3.3.x)

#

%annhash = ("-fno-merge-constants", "! -O1", "-fno-defer-pop", "! -O1", "-fno-thread-jumps", "! -O1", "-fno-omit-frame-pointer", "! -O1", "-fno-guess-branch-probability", "! -O1", "-fno-cprop-registers", "! -O1", "-fno-if-conversion", "! -O1", "-fno-if-conversion2", "! -O1", "-fno-delayed-branch", "! -O1", "-fno-loop-optimize", "! -O1", "-fno-crossjumping", "! -O1", "-foptimize-sibling-calls", "-O2", "-fcse-follow-jumps", "-O2", "-fcse-skip-blocks", "-O2", "-fgcse", "-O2", "-fexpensive-optimizations", "-O2", "-fstrength-reduce", "-O2", "-frerun-cse-after-loop", "-O2", "-frerun-loop-opt", "-O2", "-fcaller-saves", "-O2", "-fforce-mem", "-O2", "-fpeephole2", "-O2", "-fschedule-insns", "-O2", "-fschedule-insns2", "-O2", "-fregmove", "-O2", "-fstrict-aliasing", "-O2", "-fdelete-null-pointer-checks", "-O2", "-freorder-blocks", "-O2", "-fsched-interblock", "-O2 GCC 3.3", "-fsched-spec", "-O2 GCC 3.3", "-freorder-functions", "-O2 GCC 3.3", "-falign-loops", "-O2 GCC 3.3", "-falign-jumps", "-O2 GCC 3.3", "-falign-labels", "-O2 GCC 3.3", "-finline-functions", "-O3", "-frename-registers", "-O3", "-ffloat-store", "", "-fprefetch-loop-arrays", "", "-fmove-all-movables", "", "-freduce-all-givs", "", "-fno-inline", "", "-ftracer", "", "-fnew-ra", "",  "-funroll-loops", "", "-funroll-all-loops", "",  "-mieee-fp", "", "-malign-double", "", "-mno-push-args", "", "-maccumulate-outgoing-args", "", "-mno-align-stringops", "", "-minline-all-stringops", "", "-mfpmath=387", "", "-mfpmath=sse", "",  "-mfpmath=sse,387", "", "-fomit-frame-pointer", "", "-momit-leaf-frame-pointer", "", "-fno-math-errno", "fast math", "-funsafe-math-optimizations", "fast math", "-fno-trapping-math", "fast math",  "-ffinite-math-only", "fast math", "-fno-signaling-nans", "fast math", "-finline-limit", "" );

#----------------------------------------------------------------------------

#

# Display results

#

sub printbar {

   print "------------------------------------------------------------------------------\n";

}

if (not $suppress) {print "  Mean  | Std. Dev. | Conf. |";}

print " Score |  So?  | Switch (annotation)\n";

&printbar;

foreach $line (@sswitches) {

   if (not $suppress) {

      print sprintf("  %5.3f",@$line[1]);

      print " | ";

      print sprintf("  %5.3f  ",@$line[2]);

      print " | ";

      print sprintf("%5.3f", @$line[3]);

      print " |";

   }

   print " ";

   print sprintf(" %4.1f", @$line[4]);

   print " | ";

   # Recommend based on confidence

   if (@$line[3] < 0.683) {print "  No ";}

      elsif (@$line[3] < 0.866) {print "Maybe";}

         else {print " Yes ";}

   print " | ";

   print @$line[0];

   if ($annhash{@$line[0]}) {print " (".$annhash{@$line[0]}.")";}

   print "\n";

} 
```

----------

## maglomanic

Thank you for the prompt reply.but i m still not sure about the scripts.how do i run these scripts.is there any guide for these scripts???

Also i have a celeron 1 ghz(996.9 mhz) coppermine..which is the correct argument for my computer??? and how do i use it?

i ll appreciate any help

----------

## John5788

copy paste it, save it, chmod it 777, then run it

----------

## mrfree

I've executed your script to collect cflags perrformance info, but I've a question about result analyzer:

```

Score | So? | Switch (annotation)

--------------------------------------

8.4     |  No  |  -fno-math-errno (fast math)

```

What do you mean with So? = No?

```

Score | So? | Switch (annotation)

--------------------------------------

6.4     |  No  |  -fno-cprop-registers (! -O1)

```

In the annotation (! -O1) means that the cflag isn't in O1 set?

Finally, I need to add all the cflags with a score > 0.0 to my make.conf??? Or what?

----------

## Chaosite

Just all the flags with "So? Yes".

----------

## MrApples

the  ! -O1 just means that the flag overrides something from -O1

----------

## mrfree

Ok thanks for the answers  :Wink: 

Finally... I need to set my CFLAGS to some default optimization level in particular and then add the flags reported by acovea or I need to set my CFLAGS var with only the flags returned by acovea benchmark (So? = Yes)?

----------

