Add passive and active tests for OpenMP
Makes sure that we are no longer generating too many pause events.
This commit is contained in:
parent
120e69eeec
commit
5eec5a17f3
@ -1,4 +1,4 @@
|
||||
# Copyright (c) 2022-2024 Barcelona Supercomputing Center (BSC)
|
||||
# Copyright (c) 2022-2025 Barcelona Supercomputing Center (BSC)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
check_c_compiler_flag("-fopenmp=libompv" OPENMPV_COMPILER_FOUND)
|
||||
@ -37,6 +37,7 @@ function(openmp_rt_test)
|
||||
ENVIRONMENT "NOSV_CONFIG_OVERRIDE=instrumentation.version=ovni")
|
||||
endfunction()
|
||||
|
||||
openmp_rt_test(active.c DRIVER active.driver.sh)
|
||||
openmp_rt_test(barrier-explicit.c)
|
||||
openmp_rt_test(critical.c)
|
||||
openmp_rt_test(if0-nested-task.c)
|
||||
@ -46,6 +47,7 @@ openmp_rt_test(parallel-for.c)
|
||||
openmp_rt_test(parallel-loop.c)
|
||||
openmp_rt_test(parallel-nested.c)
|
||||
openmp_rt_test(parallel-task.c)
|
||||
openmp_rt_test(passive.c DRIVER passive.driver.sh)
|
||||
openmp_rt_test(sections.c)
|
||||
openmp_rt_test(simple-task.c)
|
||||
openmp_rt_test(task.c)
|
||||
|
||||
19
test/rt/openmp/active.c
Normal file
19
test/rt/openmp/active.c
Normal file
@ -0,0 +1,19 @@
|
||||
#include "compat.h"
|
||||
|
||||
/* This test tries to make threads generate as many nosv_pause() calls to try to
|
||||
* flood the trace as possible. */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
#pragma omp parallel
|
||||
#pragma omp single nowait
|
||||
{
|
||||
#pragma omp task
|
||||
{
|
||||
sleep_us(10000);
|
||||
}
|
||||
sleep_us(10000);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
24
test/rt/openmp/active.driver.sh
Normal file
24
test/rt/openmp/active.driver.sh
Normal file
@ -0,0 +1,24 @@
|
||||
target=$OVNI_TEST_BIN
|
||||
|
||||
export NOSV_APPID=1
|
||||
export OMP_OVNI=1
|
||||
export OMP_WAIT_POLICY=active
|
||||
export OMP_NUM_THREADS=4
|
||||
export NOSV_CONFIG_OVERRIDE="instrumentation.version=ovni,ovni.level=3"
|
||||
|
||||
# Repeat several times, as the test is not stable. We only want to be sure that
|
||||
# we never generate too many events.
|
||||
for i in $(seq 10); do
|
||||
rm -rf ovni
|
||||
|
||||
$target
|
||||
|
||||
ovnisort ovni
|
||||
# No need to emulate
|
||||
#ovniemu -l ovni
|
||||
|
||||
# Make sure that we only see a low number of threads being paused
|
||||
ovnitop ovni > top.txt
|
||||
cat top.txt
|
||||
awk -v n=500 '/^OHp/ && $2 > n { printf("too many OHp events: %d > %d", $2, n); exit 1 }' < top.txt
|
||||
done
|
||||
20
test/rt/openmp/passive.c
Normal file
20
test/rt/openmp/passive.c
Normal file
@ -0,0 +1,20 @@
|
||||
#include "compat.h"
|
||||
#include <omp.h>
|
||||
|
||||
/* This test tries to make threads generate as many nosv_pause() calls to try to
|
||||
* flood the trace as possible. This problem should be solved by the new passive
|
||||
* mechanism. */
|
||||
|
||||
int main(void)
|
||||
{
|
||||
#pragma omp parallel
|
||||
{
|
||||
if (omp_get_thread_num() == 1)
|
||||
#pragma omp task
|
||||
{
|
||||
sleep_us(10000);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
23
test/rt/openmp/passive.driver.sh
Normal file
23
test/rt/openmp/passive.driver.sh
Normal file
@ -0,0 +1,23 @@
|
||||
target=$OVNI_TEST_BIN
|
||||
|
||||
export NOSV_APPID=1
|
||||
export OMP_OVNI=1
|
||||
export OMP_WAIT_POLICY=passive
|
||||
export OMP_NUM_THREADS=4
|
||||
export NOSV_CONFIG_OVERRIDE="instrumentation.version=ovni,ovni.level=2"
|
||||
|
||||
# Repeat several times, as the test is not stable. We only want to be sure that
|
||||
# we never generate too many events.
|
||||
for i in $(seq 10); do
|
||||
rm -rf ovni
|
||||
|
||||
$target
|
||||
|
||||
ovnisort ovni
|
||||
ovniemu -l ovni
|
||||
|
||||
# Make sure that we only see a low number of threads being paused
|
||||
ovnitop ovni > top.txt
|
||||
cat top.txt
|
||||
awk -v n=500 '/^OHp/ && $2 > n { printf("too many OHp events: %d > %d", $2, n); exit 1 }' < top.txt
|
||||
done
|
||||
Loading…
x
Reference in New Issue
Block a user