Skip to content

Commit c5f0dcf

Browse files
committed
c_check: test for omp_pause_resource_all()
Assume that the ctest3.c program successfully compiling and linking means that the function is available.
1 parent eb84aac commit c5f0dcf

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

c_check

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,14 @@ fi
412412

413413
[ "$USE_OPENMP" != 1 ] && openmp=''
414414

415+
have_omp_pause_resource_all=0
416+
if [ "$USE_OPENMP" = 1 ]; then
417+
if $compiler_name $flags $openmp -o ctest3 ctest3.c; then
418+
have_omp_pause_resource_all=1
419+
fi
420+
rm -f ctest3.o ctest3 ctest3.exe
421+
fi
422+
415423
linker_L=""
416424
linker_l=""
417425
linker_a=""
@@ -501,6 +509,7 @@ done
501509
[ "$oldgcc" -eq 1 ] && printf "OLDGCC=1\n"
502510
[ "$no_lsx" -eq 1 ] && printf "NO_LSX=1\n"
503511
[ "$no_lasx" -eq 1 ] && printf "NO_LASX=1\n"
512+
[ "$have_omp_pause_resource_all" -eq 1 ] && printf "HAVE_OMP_PAUSE_RESOURCE_ALL=1\n"
504513
} >> "$makefile"
505514

506515
os=`echo "$os" | tr '[[:lower:]]' '[[:upper:]]'/ `
@@ -518,6 +527,7 @@ compiler=`echo "$compiler" | tr '[[:lower:]]' '[[:upper:]]' `
518527
[ "$c11_atomics" -eq 1 ] && printf "#define HAVE_C11\t1\n"
519528
[ "$no_lsx" -eq 1 ] && printf "#define NO_LSX\t1\n"
520529
[ "$no_lasx" -eq 1 ] && printf "#define NO_LASX\t1\n"
530+
[ "$have_omp_pause_resource_all" -eq 1 ] && printf "#define HAVE_OMP_PAUSE_RESOURCE_ALL\t1\n"
521531
} >> "$config"
522532

523533

c_check.pl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,14 @@
394394

395395
$openmp = "" if $ENV{USE_OPENMP} != 1;
396396

397+
$have_omp_pause_resource_all=0;
398+
if ($ENV{USE_OPENMP} == 1) {
399+
if (system("$compiler_name $flags $openmp -o ctest3 ctest3.c") == 0) {
400+
$have_omp_pause_resource_all=1;
401+
}
402+
unlink "ctest3.o", "ctest3", "ctest3.exe";
403+
}
404+
397405
$linker_L = "";
398406
$linker_l = "";
399407
$linker_a = "";
@@ -472,6 +480,7 @@
472480
print MAKEFILE "OLDGCC=1\n" if $oldgcc eq 1;
473481
print MAKEFILE "NO_LSX=1\n" if $no_lsx eq 1;
474482
print MAKEFILE "NO_LASX=1\n" if $no_lasx eq 1;
483+
print MAKEFILE "HAVE_OMP_PAUSE_RESOURCE_ALL=1\n" if $have_omp_pause_resource_all eq 1;
475484

476485
$os =~ tr/[a-z]/[A-Z]/;
477486
$architecture =~ tr/[a-z]/[A-Z]/;
@@ -487,6 +496,7 @@
487496
print CONFFILE "#define HAVE_C11\t1\n" if $c11_atomics eq 1;
488497
print CONFFILE "#define NO_LSX\t1\n" if $no_lsx eq 1;
489498
print CONFFILE "#define NO_LASX\t1\n" if $no_lasx eq 1;
499+
print CONFFILE "#define HAVE_OMP_PAUSE_RESOURCE_ALL\t1\n" if $have_omp_pause_resource_all eq 1;
490500

491501

492502
if ($os eq "LINUX") {

ctest3.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#include <omp.h>
2+
int main(void) { return omp_pause_resource_all(omp_pause_hard); }

0 commit comments

Comments
 (0)