https://github.com/epiqc/ScaffCC
Revision 69a4e5f33f23e533ba0bd05097ad590931c3194f authored by Yipeng Huang on 04 September 2018, 19:57:51 UTC, committed by Yipeng Huang on 04 September 2018, 19:57:51 UTC
1 parent e153ac1
Tip revision: 69a4e5f33f23e533ba0bd05097ad590931c3194f authored by Yipeng Huang on 04 September 2018, 19:57:51 UTC
Simple script for removing the global phase in the QX Simulator output.
Simple script for removing the global phase in the QX Simulator output.
Tip revision: 69a4e5f
comm_aware.pl
#!/usr/bin/perl
%last = ();
@keys = qw(Function SIMDs ts ots mts moves tgates mlist);
foreach $file ( @ARGV ) {
$name = '';
$size = '';
$th = '';
$ext = '';
$k = 0;
$d = 0;
if ( $file =~ /([a-zA-Z0-9_]+)\.(\w+)\.(\w+)\.simd\.(\d)\.(\d+)\.leaves\.(.*)/ ) {
$name = $1; $size = $2; $th = $3; $k = $4; $d = $5; $ext = $6;
$comm = "comm_aware_schedule.txt.$name\.$size\.$th\_K$k\_D$d\_$ext";
print "\t[comm_aware.pl] $file -> $comm\n";
open COM, ">$comm" or die "Unable to open $comm: $!\n";
open RES, $file or die "Unable to open $file: $!\n";
$last{Function} = "";
while (<RES>) {
chomp;
if ( /^Function: (\w+)/ ) {
if ( $last{Function} ) {
foreach $k ( @keys ) {
print COM "$last{$k} ";
}
print COM "\n";
}
$last{Function} = $1;
}
$last{$1} = $2 if ( /^((?:SIMDs|ts|ots|mts|moves|tgates|mlist)) = (.+)/ );
}
foreach $k ( @keys ) {
print COM "$last{$k} ";
}
print COM "\n";
close COM;
close RES;
}
}
Computing file changes ...