Set SUFFIX in tempfile commands, fix bad architecture option for PGI compiler in...
authorMartin Kroeker <martin@ruby.chemie.uni-freiburg.de>
Fri, 7 Feb 2020 09:09:25 +0000 (10:09 +0100)
committerGitHub <noreply@github.com>
Fri, 7 Feb 2020 09:09:25 +0000 (10:09 +0100)
c_check

diff --git a/c_check b/c_check
index 3d82aa7..5437892 100644 (file)
--- a/c_check
+++ b/c_check
@@ -188,13 +188,13 @@ if (($architecture eq "mips") || ($architecture eq "mips64")) {
     if ($@){ 
        warn "could not load PERL module File::Temp, so could not check MSA capatibility";
     } else {
-       $tmpf = new File::Temp( UNLINK => 1 );
+       $tmpf = new File::Temp( SUFFIX => '.c' , UNLINK => 1 );
        $code = '"addvi.b $w0, $w1, 1"';
        $msa_flags = "-mmsa -mfp64 -msched-weight -mload-store-pairs";
        print $tmpf "#include <msa.h>\n\n";
        print $tmpf "void main(void){ __asm__ volatile($code); }\n";
 
-       $args = "$msa_flags -o $tmpf.o -x c $tmpf";
+       $args = "$msa_flags -o $tmpf.o $tmpf";
        my @cmd = ("$compiler_name $args");
        system(@cmd) == 0;
        if ($? != 0) {
@@ -229,10 +229,13 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) {
        $no_avx512 = 0;
     } else {
 #      $tmpf = new File::Temp( UNLINK => 1 );
-       ($fh,$tmpf) = tempfile( UNLINK => 1 );
+       ($fh,$tmpf) = tempfile( SUFFIX => '.c' , UNLINK => 1 );
        $code = '"vbroadcastss -4 * 4(%rsi), %zmm2"';
        print $tmpf "#include <immintrin.h>\n\nint main(void){ __asm__ volatile($code); }\n";
-       $args = " -march=skylake-avx512 -c -o $tmpf.o -x c $tmpf";
+       $args = " -march=skylake-avx512 -c -o $tmpf.o $tmpf";
+       if ($compiler eq "PGI") {
+           $args = " -tp skylake -c -o $tmpf.o $tmpf";
+       }
        my @cmd = ("$compiler_name $args >/dev/null 2>/dev/null");
        system(@cmd) == 0;
        if ($? != 0) {