Adding scripts to repository.

Matthias sent me these scripts by e-mail.
This first commit adds them as they are (without any change).
In the future we can use them to create a video based on the temperature maps generated by DRAMSys.
This commit is contained in:
Éder F. Zulian
2015-10-19 14:54:22 +02:00
parent 672f0abefe
commit bbcd7096b4
3 changed files with 211 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
all:
modulecmd bash load gnuplot/latest
modulecmd bash load image-magick/latest
./temperatur.pl
movie:
ffmpeg -start_number 00000000 -i ../out/%08d.jpg -vcodec mpeg4 ../out.avi
clean:
rm *.out *.err

View File

@@ -0,0 +1,135 @@
#!/usr/bin/perl -w
use warnings;
use strict;
use File::Copy;
my $file = shift;
my $id = shift;
my $samples = shift;
my $inputPath = "/gu2/jungma/thermal/in/out-backup";
my $extractPath = "/gu2/jungma/thermal/tmp/$id";
print "Create TMP path... ";
system("mkdir $extractPath");
print " done\n";
print "Extract... ";
system("tar -xf $inputPath/$file -C $extractPath");
print " done\n";
print "Preprocessing... ";
system("sed '1d' $extractPath/out/output_core_die_full.txt > $extractPath/die0.txt");
system("sed '1d' $extractPath/out/output_mem_die_1_full.txt > $extractPath/die1.txt");
system("sed '1d' $extractPath/out/output_mem_die_2_full.txt > $extractPath/die2.txt");
system("sed '1d' $extractPath/out/output_mem_die_3_full.txt > $extractPath/die3.txt");
system("sed '1d' $extractPath/out/output_mem_die_4_full.txt > $extractPath/die4.txt");
print " done\n";
print "Gnuplot...";
open( my $GP, '|-', 'gnuplot' );
print $GP "
reset
set terminal pngcairo size 500,500 enhanced font 'Verdana,10'
set border linewidth 0
unset key
unset colorbox
unset tics
set lmargin screen 0.0
set rmargin screen 1.0
set tmargin screen 1.0
set bmargin screen 0.0
set pm3d map
set pm3d interpolate 2,2
set cbrange [318.0:388.0]
#set palette rgbformulae 22,13,-31
set palette defined ( 0 \"blue\", 3 \"green\", 4 \"yellow\", 5 \"red\", 6 \"black\" )
set output '$extractPath/die0.png'
splot '$extractPath/die0.txt' matrix every ::1
set output '$extractPath/die1.png'
splot '$extractPath/die1.txt' matrix every ::1
set output '$extractPath/die2.png'
splot '$extractPath/die2.txt' matrix every ::1
set output '$extractPath/die3.png'
splot '$extractPath/die3.txt' matrix every ::1
set output '$extractPath/die4.png'
splot '$extractPath/die4.txt' matrix every ::1";
close($GP);
print " done\n";
print "Wait for files... ";
while (1) { last if -e "$extractPath/die0.png"; print "."; sleep 1;}
while (1) { last if -e "$extractPath/die1.png"; print "."; sleep 1;}
while (1) { last if -e "$extractPath/die2.png"; print "."; sleep 1;}
while (1) { last if -e "$extractPath/die3.png"; print "."; sleep 1;}
while (1) { last if -e "$extractPath/die4.png"; print "."; sleep 1;}
print " done\n";
print "Composite ...";
system("composite -gravity center constants/thermal_model_core.png $extractPath/die0.png $extractPath/die0b.png");
system("composite -gravity center constants/thermal_model_dram_0_1.png $extractPath/die1.png $extractPath/die1b.png");
system("composite -gravity center constants/thermal_model_dram_2_3.png $extractPath/die2.png $extractPath/die2b.png");
system("composite -gravity center constants/thermal_model_dram_4_5.png $extractPath/die3.png $extractPath/die3b.png");
system("composite -gravity center constants/thermal_model_dram_6_7.png $extractPath/die4.png $extractPath/die4b.png");
print " done\n";
print "Wait for files... ";
while (1) { last if -e "$extractPath/die0b.png"; print "."; sleep 1;}
while (1) { last if -e "$extractPath/die1b.png"; print "."; sleep 1;}
while (1) { last if -e "$extractPath/die2b.png"; print "."; sleep 1;}
while (1) { last if -e "$extractPath/die3b.png"; print "."; sleep 1;}
while (1) { last if -e "$extractPath/die4b.png"; print "."; sleep 1;}
print " done\n";
print "Convert ...";
system("convert $extractPath/die0b.png -alpha set -background none -shear 0x-40 -rotate 60 +repage -crop 1048x485+0+205 $extractPath/die0c.png");
system("convert $extractPath/die1b.png -alpha set -background none -shear 0x-40 -rotate 60 +repage -crop 1048x485+0+205 $extractPath/die1c.png");
system("convert $extractPath/die2b.png -alpha set -background none -shear 0x-40 -rotate 60 +repage -crop 1048x485+0+205 $extractPath/die2c.png");
system("convert $extractPath/die3b.png -alpha set -background none -shear 0x-40 -rotate 60 +repage -crop 1048x485+0+205 $extractPath/die3c.png");
system("convert $extractPath/die4b.png -alpha set -background none -shear 0x-40 -rotate 60 +repage -crop 1048x485+0+205 $extractPath/die4c.png");
print " done\n";
print "Wait for files... ";
while (1) { last if -e "$extractPath/die0c.png"; print "."; sleep 1;}
while (1) { last if -e "$extractPath/die1c.png"; print "."; sleep 1;}
while (1) { last if -e "$extractPath/die2c.png"; print "."; sleep 1;}
while (1) { last if -e "$extractPath/die3c.png"; print "."; sleep 1;}
while (1) { last if -e "$extractPath/die4c.png"; print "."; sleep 1;}
print " done\n";
my $outFileName = sprintf("%08d", $id);
print "Produce Output ...";
system("convert -size 1048x1680 xc:black $extractPath/die0c.png -geometry +0+1200 -composite $extractPath/die1c.png -geometry +0+900 -composite $extractPath/die2c.png -geometry +0+600 -composite $extractPath/die3c.png -geometry +0+300 -composite $extractPath/die4c.png -composite $extractPath/a$outFileName.jpg");
while (1) { last if -e "$extractPath/a$outFileName.jpg"; print "."; sleep 1;}
system("convert $extractPath/a$outFileName.jpg -pointsize 80 -fill white -gravity northeast -draw \"text 20,20 '".$samples."ms'\" $extractPath/b$outFileName.jpg");
while (1) { last if -e "$extractPath/b$outFileName.jpg"; print "."; sleep 1;}
system("convert $extractPath/b$outFileName.jpg constants/legend/legend4.png +append ../out/$outFileName.jpg");
print " done\n";
print "Produce Samples ...";
for(my $i = 0; $i < $samples-1; $i++)
{
$id++;
my $outFileNameCopy = sprintf("%08d", $id);
copy("../out/$outFileName.jpg","../out/$outFileNameCopy.jpg");
}
print " done\n";
# cleanup
print "Cleanup ... ";
while (1) { last if -e "/gu2/jungma/thermal/out/$outFileName.jpg"; print "."; sleep 1;}
system("rm -rf $extractPath");
print " done\n";
##ffmpeg -start_number 00000000 -i %08d.jpg -vcodec mpeg4 test.avi

View File

@@ -0,0 +1,67 @@
#!/usr/bin/perl -w
use warnings;
use strict;
use List::Util qw( min max );
#/Volumes/Etana_tmp2/tmp_sadri/backup/sep_16/log_smartbench_traces_50_cpu_1650_mhz_100_mhz_dram_100_mhz_sampling8X_bankwise_on_test/out-backup
my $inputPath = "../in/out-backup";
my $extractPath = "../tmp";
my $samplingFile = "../in/sampling";
# Read the input file names and store it in an array
opendir (DIR, $inputPath) or die $!;
my @files;
my @sortetFiles;
while (my $file = readdir(DIR))
{
push(@files, $file);
}
@sortetFiles = sort @files;
print "Cleanup\n";
system("rm -rf *.err *.out");
system("rm -rf ../tmp/*");
print "Load modules\n";
# Estimate sampeling numbers
open(SF,$samplingFile);
my @refreshRates;
while(<SF>)
{
$_ =~ /(\d+)\.0/;
my $rate = $1;
push(@refreshRates, $rate);
}
print "Max. Rate:".max(@refreshRates)."\n";
print "Min. Rate:".min(@refreshRates)."\n";
my $counter = 0;
my $i = 0;
# For each data package start one job!
foreach(@sortetFiles)
{
my $file = $_;
if($file =~ /(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)-(\d+)\.tgz/)
{
my $samples = $refreshRates[$i];
system("bsub -W 00:05 ./temperatur.job.pl $file $counter $samples");
$counter+=$samples;
$i++;
#if($i == 100)
#{
# last;
#}
}
}
##ffmpeg -start_number 00000000 -i %08d.jpg -vcodec mpeg4 test.avi