Add nanos6 rt tests and organize into folders

This commit is contained in:
Rodrigo Arias 2022-08-25 18:56:55 +02:00
parent 5970916c22
commit 7c6beb091a
29 changed files with 390 additions and 60 deletions

View File

@ -19,30 +19,8 @@ set(OVNI_TEST_BUILD_DIR "${CMAKE_BINARY_DIR}/test")
include(macros.cmake) include(macros.cmake)
# Only run performance sensitive tests on Release builds add_subdirectory(manual)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
ovni_test(NAME flush-overhead)
endif()
ovni_test(NAME flush) if(ENABLE_TEST_RT)
ovni_test(NAME mp-simple MP)
ovni_test(NAME mp-rank MP)
ovni_test(NAME nosv-nested-tasks)
ovni_test(NAME nosv-nested-tasks-bad SHOULD_FAIL
REGEX "fatal: cannot execute task 1: state is not created")
ovni_test(NAME nosv-task-types MP)
ovni_test(NAME nosv-pause MP)
ovni_test(NAME nanos6-nested-tasks)
ovni_test(NAME nanos6-nested-tasks-bad SHOULD_FAIL
REGEX "fatal: cannot execute task 1: state is not created")
ovni_test(NAME nanos6-task-types MP)
ovni_test(NAME nanos6-blocking MP)
ovni_test(NAME nanos6-subsystems MP)
ovni_test(NAME nanos6-ss-mismatch MP SHOULD_FAIL
REGEX "fatal: thread 0 has left 1 state(s) in the subsystem channel, top state=2")
if(BUILD_RT_TESTING)
add_subdirectory(rt) add_subdirectory(rt)
endif() endif()

View File

@ -0,0 +1,19 @@
#
# Copyright (c) 2022 Barcelona Supercomputing Center (BSC)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
add_subdirectory(ovni)
add_subdirectory(nosv)
add_subdirectory(nanos6)

View File

@ -15,8 +15,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef OVNI_TEST_INSTR_H #ifndef INSTR_H
#define OVNI_TEST_INSTR_H #define INSTR_H
#define _GNU_SOURCE /* For gethostname() */ #define _GNU_SOURCE /* For gethostname() */
@ -123,4 +123,4 @@ instr_end(void)
ovni_proc_fini(); ovni_proc_fini();
} }
#endif /* OVNI_TEST_INSTR_H */ #endif /* INSTR_H */

View File

@ -0,0 +1,24 @@
#
# Copyright (c) 2022 Barcelona Supercomputing Center (BSC)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
ovni_test(NAME nanos6-nested-tasks)
ovni_test(NAME nanos6-nested-tasks-bad SHOULD_FAIL
REGEX "fatal: cannot execute task 1: state is not created")
ovni_test(NAME nanos6-task-types MP)
ovni_test(NAME nanos6-blocking MP)
ovni_test(NAME nanos6-subsystems MP)
ovni_test(NAME nanos6-ss-mismatch SHOULD_FAIL
REGEX "thread [0-9]\\+ ended with 1 extra stacked nanos6 subsystems, top=ST_NANOS6_SCHED_HUNGRY")

View File

@ -15,10 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef OVNI_TEST_INSTR_NANOS6_H #ifndef INSTR_NANOS6_H
#define OVNI_TEST_INSTR_NANOS6_H #define INSTR_NANOS6_H
#include "test/instr.h" #include "../instr.h"
#include "compat.h" #include "compat.h"
static inline void static inline void
@ -114,4 +114,4 @@ INSTR_0ARG(instr_nanos6_exit_create_task, "6TC")
INSTR_0ARG(instr_nanos6_spawn_function_enter, "6Hs") INSTR_0ARG(instr_nanos6_spawn_function_enter, "6Hs")
INSTR_0ARG(instr_nanos6_spawn_function_exit, "6HS") INSTR_0ARG(instr_nanos6_spawn_function_exit, "6HS")
#endif /* OVNI_TEST_INSTR_NANOS6_H */ #endif /* INSTR_NANOS6_H */

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "test/instr_nanos6.h" #include "instr_nanos6.h"
int int
main(void) main(void)

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "test/instr_nanos6.h" #include "instr_nanos6.h"
int int
main(void) main(void)

View File

@ -15,7 +15,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#include "test/instr_nanos6.h" #include "instr_nanos6.h"
int int
main(void) main(void)

View File

@ -20,9 +20,7 @@
int int
main(void) main(void)
{ {
int rank = atoi(getenv("OVNI_RANK")); instr_start(0, 1);
int nranks = atoi(getenv("OVNI_NRANKS"));
instr_start(rank, nranks);
instr_nanos6_sched_hungry(); instr_nanos6_sched_hungry();
/* The thread is left in the hungry state (should fail) */ /* The thread is left in the hungry state (should fail) */

View File

@ -0,0 +1,21 @@
#
# Copyright (c) 2022 Barcelona Supercomputing Center (BSC)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
ovni_test(NAME nosv-nested-tasks)
ovni_test(NAME nosv-nested-tasks-bad SHOULD_FAIL
REGEX "fatal: cannot execute task 1: state is not created")
ovni_test(NAME nosv-task-types MP)
ovni_test(NAME nosv-pause MP)

View File

@ -15,10 +15,10 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
#ifndef OVNI_TEST_INSTR_NOSV_H #ifndef INSTR_NOSV_H
#define OVNI_TEST_INSTR_NOSV_H #define INSTR_NOSV_H
#include "test/instr.h" #include "../instr.h"
#include "compat.h" #include "compat.h"
static inline void static inline void
@ -49,4 +49,4 @@ INSTR_1ARG(instr_nosv_task_resume, "VTr", int32_t, id)
INSTR_1ARG(instr_nosv_task_end, "VTe", int32_t, id) INSTR_1ARG(instr_nosv_task_end, "VTe", int32_t, id)
#endif /* OVNI_TEST_INSTR_NOSV_H */ #endif /* INSTR_NOSV_H */

View File

@ -0,0 +1,24 @@
#
# Copyright (c) 2022 Barcelona Supercomputing Center (BSC)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
# Only run performance sensitive tests on Release builds
if(CMAKE_BUILD_TYPE STREQUAL "Release")
ovni_test(NAME flush-overhead)
endif()
ovni_test(NAME flush)
ovni_test(NAME mp-simple MP)
ovni_test(NAME mp-rank MP)

View File

@ -0,0 +1,23 @@
/*
* Copyright (c) 2022 Barcelona Supercomputing Center (BSC)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef INSTR_OVNI_H
#define INSTR_OVNI_H
#include "../instr.h"
#endif /* INSTR_OVNI_H */

View File

@ -35,15 +35,6 @@ static void fail(const char *msg)
abort(); abort();
} }
static inline void emit_ev(char *mcv)
{
struct ovni_ev ev = { 0 };
ovni_ev_set_mcv(&ev, mcv);
ovni_ev_set_clock(&ev, ovni_clock_now());
ovni_ev_emit(&ev);
}
#define INSTR_3ARG(name, mcv, ta, a, tb, b, tc, c) \ #define INSTR_3ARG(name, mcv, ta, a, tb, b, tc, c) \
static inline void name(ta a, tb b, tc c) \ static inline void name(ta a, tb b, tc c) \
{ \ { \

View File

@ -36,15 +36,6 @@ static void fail(const char *msg)
abort(); abort();
} }
static inline void emit_ev(char *mcv)
{
struct ovni_ev ev = { 0 };
ovni_ev_set_mcv(&ev, mcv);
ovni_ev_set_clock(&ev, ovni_clock_now());
ovni_ev_emit(&ev);
}
#define INSTR_3ARG(name, mcv, ta, a, tb, b, tc, c) \ #define INSTR_3ARG(name, mcv, ta, a, tb, b, tc, c) \
static inline void name(ta a, tb b, tc c) \ static inline void name(ta a, tb b, tc c) \
{ \ { \

View File

@ -24,7 +24,9 @@ function(nosv_test)
PUBLIC ${NOSV_INCLUDE_DIR}) PUBLIC ${NOSV_INCLUDE_DIR})
set_property(TEST "${OVNI_TEST_NAME}" APPEND set_property(TEST "${OVNI_TEST_NAME}" APPEND
PROPERTY PROPERTY
ENVIRONMENT "NOSV_CONFIG=${OVNI_TEST_SOURCE_DIR}/rt/nosv.toml") ENVIRONMENT "NOSV_CONFIG=${OVNI_TEST_SOURCE_DIR}/rt/nosv/nosv.toml")
endfunction() endfunction()
nosv_test(NAME nosv-attach SOURCE nosv/attach.c) nosv_test(NAME nosv-attach SOURCE nosv/attach.c)
add_subdirectory(nanos6)

View File

@ -0,0 +1,10 @@
function(nanos6_rt_test)
ovni_test(${ARGN})
target_compile_options("${OVNI_TEST_NAME}" PUBLIC "-fompss-2")
target_link_options("${OVNI_TEST_NAME}" PUBLIC "-fompss-2")
set_property(TEST "${OVNI_TEST_NAME}" APPEND PROPERTY
ENVIRONMENT "NANOS6_CONFIG=${OVNI_TEST_SOURCE_DIR}/rt/nanos6/nanos6.toml")
endfunction()
nanos6_rt_test(NAME rt-nanos6-simple-task SOURCE simple-task.c)
nanos6_rt_test(NAME rt-nanos6-nested-task SOURCE nested-task.c)

231
test/rt/nanos6/nanos6.toml Normal file
View File

@ -0,0 +1,231 @@
# This file is part of Nanos6 and is licensed under the terms contained in the COPYING file
#
# Copyright (C) 2020-2021 Barcelona Supercomputing Center (BSC)
# The Nanos6 default configuration file. More details about the configuration options and the possible
# values are available on the OmpSs-2 User Guide (https://pm.bsc.es/ftp/ompss-2/doc/user-guide/) or on
# the README.md in the Nanos6 repository (https://github.com/bsc-pm/nanos6)
[version]
# Choose whether the runtime runs with debug symbols and internal asserts. Enabling this option
# may produce significant overheads, so production or performance executions should disable this
# option. Default is false
debug = false
# Choose the dependency system implementation. Default is "discrete"
# Possible values: "discrete", "regions"
dependencies = "discrete"
# Choose the instrumentation variant to run. Default is "none"
# Possible values: "none", "ctf", "extrae", "graph", "lint", "stats", "verbose"
instrument = "ovni"
[turbo]
# Choose whether enabling floating-point unit optimizations in all Nanos6 threads. Enabling this
# option can speedup the floating-point computations in user tasks, but may produce imprecise
# results. It enables flush-to-zero (FZ) and denormals are zero (DAZ) optimizations in Intel®
# processors. Default is false
enabled = false
[scheduler]
# Choose the task scheduling policy. Default is "fifo"
# Possible values: "fifo", "lifo"
policy = "fifo"
# Enable the immediate successor feature to improve cache data reutilization between successor
# tasks. If enabled, when a CPU finishes a task it starts executing the successor task (computed
# through their data dependencies). Default is true
immediate_successor = true
# Indicate whether the scheduler should consider task priorities defined by the user in the
# task's priority clause. Default is true
priority = true
[cpumanager]
# The underlying policy of the CPU manager for the handling of CPUs. Default is "default", which
# corresponds to "hybrid"
# Possible values: "default", "idle", "busy", "hybrid", "lewi", "greedy"
policy = "default"
# The maximum number of iterations to busy wait for before idling. Default is "240000". Only
# works for the 'hybrid' policy. This number will be divided by the number of active CPUs to
# obtain a "busy_iters per CPU" metric for each individual CPU to busy-wait for
busy_iters = 240000
[taskfor]
# Choose the total number of CPU groups that will execute the worksharing tasks (taskfors). Default
# is none (not set), which means that the runtime will create one taskfor group per NUMA node
# groups = 1
# Indicate whether should print the taskfor groups information
report = false
[throttle]
# Enable throttle to stop creating tasks when certain conditions are met. Default is false
enabled = false
# Maximum number of child tasks that can be created before throttling. Default is 5000000
tasks = 5000000
# Maximum memory pressure (percent of max_memory) before throttling. Default is 70 (%)
pressure = 70 # %
# Maximum memory that can be used by the runtime. Default is "0", which equals half of system memory
max_memory = "0"
# Evaluation interval (us). Each time this amount of time is elapsed, the throttle system queries
# the memory allocator statistics and evaluates the current memory pressure. A higher interval
# results in less accurate pressure estimation, but a lower interval introduces noticeable overhead,
# as reading memory statistics requires a global lock on the allocator to aggregate per-thread
# statistics. Default is 1000
polling_period_us = 1000
[numa]
# Enable NUMA tracking of task data. NUMA tracking consists of annotating the NUMA location
# of data to be later scheduled based on this information. When using "auto" this feature is
# enabled in the first allocation done using the Nanos6 NUMA API. Default is "auto"
# Possible values: "auto", "on", "off"
tracking = "auto"
# Indicate whether should print the NUMA bitmask of each NUMA wildcards
report = false
# Use the page auto-discovery mechanism to detect the system's page size
# Default is true, which is useful in systems with THP enabled
# Set to false will use the default page size, which is arch-dependent
discover_pagesize = true
[hardware_counters]
# Enable the verbose mode of hardware counters, printing a small summary of metrics at the
# end of the execution. Default is false
verbose = false
# The verbose file's name. Default is "nanos6-output-hwcounters.txt"
verbose_file = "nanos6-output-hwcounters.txt"
[hardware_counters.papi]
# Enable the PAPI backend of the hardware counters module. Default is false
enabled = false
# The list of PAPI counters to read. Default is "PAPI_TOT_INS" and "PAPI_TOT_CYC"
counters = [
"PAPI_TOT_INS",
"PAPI_TOT_CYC"
]
[hardware_counters.rapl]
# Enable the RAPL backend of the hardware counters module for runtime-wise energy
# metrics. Default is false
enabled = false
[monitoring]
# Indicate whether enabling the Monitoring of tasks and CPUs, which allows the usage of
# prediction-based policies. Disabled by default
enabled = false
# Indicate whether enabling the "Wisdom" mechanism of Monitoring, saving normalized metrics for
# future executions and loading previously saved metrics when the runtime initializes. Default
# is false
wisdom = false
# Enable the verbose mode of Monitoring, which prints a detailed summary of task type metrics
# at the end of the execution. Default is true
verbose = true
# The verbose file's name. Default is "output-monitoring.txt"
verbose_file = "output-monitoring.txt"
# The prediction rate at which CPU usage predictions are infered. Default is once every 100µs
cpuusage_prediction_rate = 100 # µs
# The number of samples (window) of the normalized exponential moving average for predictions
# Default is 20
rolling_window = 20
[devices]
[instrument]
[instrument.ctf]
# Choose the temporary directory where to store intermediate CTF files. Default is none
# (not set), which means that $TMPDIR will be used if present, or /tmp otherwise
# tmpdir = "/tmp"
[instrument.ctf.converter]
# Indicate whether the trace converter should automatically generate the trace after
# executing a program with CTF instrumentation. Default is true
enabled = true
# Use the fast converter. This feature is experimental and generates a trace compatible
# with just a subset of Paraver cfgs. Default is false
fast = false
# Indicate the location of the ctf2prv converter script. Default is none (not set),
# which means that the $CTF2PRV will be used if present, or ctf2prv in $PATH
# otherwise
# location = "path/to/ctf2prv"
# Choose the events that will be traced
[instrument.ctf.events]
# Linux Kernel events options. Nanos6 can collect Linux kernel internal events using the
# perf_event_open system call. This requires to set /proc/sys/kernel/perf_event_paranoid
# to -1 and read permissions for either /sys/kernel/tracing or /sys/kernel/debug/tracing.
# Events can be selected individually and/or using Nanos6-defined presets
[instrument.ctf.events.kernel]
# Select one or more predefined sets of events. Available options are:
# - preemption: Trace context switches and interrupts
# - context_switch: Trace context switches
# - syscall: Trace all kernel syscalls entry and exit
# presets = [
# "preemption"
# ]
# Provide a file with a list of individual events to enable, one event per line.
# Lines starting with "#" are omitted.
# file = "./nanos6_kernel_events"
# Exclude selected events. Disable events even if enabled in a preset or the
# user provided file.
# exclude = [
# "sys_enter_gettimeofday",
# "sys_exit_gettimeofday"
# ]
[instrument.extrae]
# Indicate whether the trace should show the activity of the threads instead of the CPUs'
# activity. Default is false, which shows the activity of CPUs
as_threads = false
# Choose the detail level of the information generated in extrae traces. Default is 1
detail_level = 1
[instrument.graph]
# Indicate whether the resulting PDF should be opened automatically with the display
# command. Default is false
display = false
# Choose the command to be used to automatically display the resulting PDF
display_command = "xdg-open"
# Indicate whether the graph nodes should remove the directories from the source code
# file names. Default is false
shorten_filenames = false
# Indicate whether should show the internal data structures that determine when tasks
# are ready. Default is false
show_dependency_structures = false
# Include the information about the range of data or region that is covered when showing
# internal data structures. Default is false
show_regions = false
# Indicate whether should show the internal data structures that do not determine dependencies
# or that are redundant by transitivity. Default is false
show_spurious_dependency_structures = false
# Choose whether should force future and previous dependencies to be shown with different
# graphical attributes. Default is false
show_dead_dependencies = false
# Include the internal data structures after they are no longer relevant. Default is false
show_dead_dependency_structures = false
# Instead of trying to collapse in one step as many related changes as possible, show one
# at a time. Default is false
show_all_steps = false
# Show superaccess links. Default is true
show_superaccess_links = true
# Choose whether to emit a table next to the graph with a description of the changes in
# each frame. Default is false
show_log = false
[instrument.stats]
# The outfile file for emitting the statistics. Default is the standard error
output_file = "/dev/stderr"
[instrument.verbose]
# Output device or file for verbose log. Default is "/dev/stderr"
output_file = "/dev/stderr"
# Print timestamps on log. Default is true
timestamps = true
# Delay verbose output to prevent mixing with application output. Default is false
dump_only_on_exit = false
# Verbose log concepts to display. Possible values on README.md
areas = ["all", "!ComputePlaceManagement", "!DependenciesByAccess", "!DependenciesByAccessLinks",
"!DependenciesByGroup", "!LeaderThread", "!TaskStatus", "!ThreadManagement"]
[memory]
[misc]
# Stack size of threads created by the runtime. Default is 8M
stack_size = "8M"
[loader]
# Enable verbose output of the loader, to debug dynamic linking problems. Default is false
verbose = false
# Choose whether to print a warning when there is any invalid NANOS6 environment variables
# defined when running a program. Default is true
warn_envars = true
# Path to the nanos6 libraries. Default is none
# library_path = "path/to/nanos6/lib"
# Prefix for the report printing all the runtime variables. Default is none
# report_prefix = "#"

View File

@ -0,0 +1,11 @@
int main(void)
{
#pragma oss task
{
#pragma oss task
{
}
#pragma oss taskwait
}
return 0;
}

View File

@ -0,0 +1,7 @@
int main(void)
{
#pragma oss task
{
}
return 0;
}