<commit_before>#!/usr/bin/perl

my $output_file = 'imb.dat';
my @btls = ("tcp" , "openib");
my @processes = (4 , 8, 12, 16);
my $imb_path = "/root/imb/3.2.4/src/IMB-MPI1";
my $msglog = 16;

open(OUT, ">$output_file") || die "Could not open $output_file\n";

for my $btl (@btls) {
  my $transport;
  if ( $btl eq "tcp" ) {
    $transport = "TCP";
  }
  else {
    $transport = "RoCE";
  }
  for my $np (@processes) {
    my $output = `mpirun -n $np -host xu0,xu1,xu2,xu3 --mca btl $btl,self,sm $imb_path -msglog $msglog -multi 1 pingpong`;
    my @lines = split("\n", $output);
    my $group = 0;
    my $group_max = $np/2-1;
    my $group_sum_lat = 0;
    my $group_sum_bw = 0;
    for (@lines) {
      if ( /bytes/ && /repetitions/ ) {
        print OUT "Transport\tProcesses\tMessage size (B)\tRepetitions\tLatency (microseconds)\tBandwidth (MB/s)\n";
      }
      if ( $_ !~ /^[ \t]*#/ && /[0-9]/ ) {
        s/^\s+//;
        my @numbers = split /\s+/;
        $group_sum_lat += $numbers[3];
        $group_sum_bw += $numbers[4];
        if ( ++$group >= $group_max ) {
          my $mean_lat = $group_sum_lat / $np;
          my $mean_bw = $group_sum_bw / $np;
          print OUT "$transport\t$np\t$numbers[1]\t$numbers[2]\t$mean_lat\t$mean_bw\n";
          $group_sum_lat = 0;
          $group_sum_bw = 0;
          $group = 0;
        }
      }
    }<commit_msg>Fixed bugs in IMB script<commit_after>#!/usr/bin/perl

my $output_file = 'imb.dat';
my @btls = ("tcp" , "openib");
my @processes = (4 , 8, 12, 16);
my $imb_path = "/root/imb/3.2.4/src/IMB-MPI1";
my $msglog = 16;

open(OUT, ">$output_file") || die "Could not open $output_file\n";

for my $btl (@btls) {
  my $transport;
  if ( $btl eq "tcp" ) {
    $transport = "TCP";
  }
  else {
    $transport = "RoCE";
  }
  for my $np (@processes) {
    my $output = `mpirun -n $np -host xu0,xu1,xu2,xu3 --mca btl $btl,self,sm $imb_path -msglog $msglog -multi 1 pingpong`;
    my @lines = split("\n", $output);
    my $group = 0;
    my $group_max = $np/2-1;
    my $group_sum_lat = 0;
    my $group_sum_bw = 0;
    for (@lines) {
      if ( /bytes/ && /repetitions/ ) {
        print OUT "Transport\tProcesses\tMessage size (B)\tRepetitions\tLatency (microseconds)\tBandwidth (MB/s)\n";
      }
      if ( $_ !~ /^[ \t]*#/ && /[0-9]/ ) {
        s/^\s+//;
        my @numbers = split /\s+/;
        $group_sum_lat += $numbers[3];
        $group_sum_bw += $numbers[4];
        if ( $group++ >= $group_max ) {
          my $mean_lat = $group_sum_lat / $np / 2;
          my $mean_bw = $group_sum_bw / $np / 2;
          print OUT "$transport\t$np\t$numbers[1]\t$numbers[2]\t$mean_lat\t$mean_bw\n";
          $group_sum_lat = 0;
          $group_sum_bw = 0;
          $group = 0;
        }
      }
    }
{'fraction_non_alphanumeric': 0.19558131111915972, 'fraction_numerical': 0.023180007243752264, 'mean_word_length': 2.2153667054714785, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1483651', 'n_tokens_mistral': 1200, 'n_tokens_neox': 1136, 'n_words': 250}