<commit_before>#!/usr/bin/perl

use File::Basename;

$utildirname = dirname($0);

my $flag = $ARGV[0];

if ($flag eq "" || $flag eq "--host") {
    $preset_compiler=$ENV{'CHPL_HOST_COMPILER'};
} elsif ($flag eq "--target") {
    $preset_compiler=$ENV{'CHPL_TARGET_COMPILER'};
    if ($preset_compiler eq "") {
	if (`$utildirname/platform.pl --host` eq `$utildirname/platform.pl --target`) {
	    $preset_compiler=$ENV{'CHPL_HOST_COMPILER'};
	}
    }
}


if ($preset_compiler eq "") {
    $platform = `$utildirname/platform.pl $flag`;
    chomp($platform);
    if ($platform eq "mta" || $platform eq "xmt" || $platform eq "xmt-sim") {
	$compiler = "cray-mta";
    } elsif ($platform eq "x1" || $platform eq "x2") {
	$compiler = "cray-vec";
    } elsif ($platform eq "xt-cle") {
        if ($flag eq "--host") {
            $compiler = "gnu";
        } else {
            $subcompiler = "-$ENV{'PE_ENV'}";
            if ($subcompiler eq "-") {
                $subcompiler = "";
            } else {
                $subcompiler =~ tr/A-Z/a-z/;
            }
            $compiler = "cray-xt$subcompiler";
        }
    } else {
	$compiler = "gnu";
    }
} else {
    $compiler = $preset_compiler;
}


print "$compiler\n";
exit(0);
<commit_msg>Fixing a bug in compiler.pl for xt-cle cross-compilation<commit_after>#!/usr/bin/perl

use File::Basename;

$utildirname = dirname($0);
$platformscript = "$utildirname/platform.pl";

my $flag = $ARGV[0];

if ($flag eq "" || $flag eq "--host") {
    $preset_compiler=$ENV{'CHPL_HOST_COMPILER'};
} elsif ($flag eq "--target") {
    $preset_compiler=$ENV{'CHPL_TARGET_COMPILER'};
}

if ($preset_compiler eq "") {
    $platform = `$platformscript $flag`;
    chomp($platform);
    if ($platform eq "mta" || $platform eq "xmt" || $platform eq "xmt-sim") {
	$compiler = "cray-mta";
    } elsif ($platform eq "x1" || $platform eq "x2") {
	$compiler = "cray-vec";
    } elsif ($platform eq "xt-cle") {
        if ($flag eq "--host") {
            $compiler = "gnu";
        } else {
            $subcompiler = "-$ENV{'PE_ENV'}";
            if ($subcompiler eq "-") {
                $subcompiler = "";
            } else {
                $subcompiler =~ tr/A-Z/a-z/;
            }
            $compiler = "cray-xt$subcompiler";
        }
    } else {
	if (`$platformscript --host` eq `$platformscript --target`) {
	    $compiler=$ENV{'CHPL_HOST_COMPILER'};
	}
	if ($compiler eq "") {
	    $compiler = "gnu";
	}
    }
} else {
    $compiler = $preset_compiler;
}


print "$compiler\n";
exit(0);

{'fraction_non_alphanumeric': 0.19478467009087316, 'fraction_numerical': 0.0039510075069142635, 'mean_word_length': 2.4448979591836735, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7414462', 'n_tokens_mistral': 930, 'n_tokens_neox': 919, 'n_words': 187}