diff --git a/test/emu/common/instr.h b/test/emu/common/instr.h index 37c05c8..f5c0d52 100644 --- a/test/emu/common/instr.h +++ b/test/emu/common/instr.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2021-2023 Barcelona Supercomputing Center (BSC) +/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC) * SPDX-License-Identifier: GPL-3.0-or-later */ #ifndef INSTR_H @@ -62,6 +62,7 @@ int64_t get_delta(void); } INSTR_3ARG(instr_thread_execute, "OHx", int32_t, cpu, int32_t, creator_tid, uint64_t, tag) +INSTR_1ARG(instr_thread_affinity_set, "OAs", int32_t, cpu) static inline void instr_thread_end(void) diff --git a/test/emu/nanos6/CMakeLists.txt b/test/emu/nanos6/CMakeLists.txt index d8fec56..11b58f4 100644 --- a/test/emu/nanos6/CMakeLists.txt +++ b/test/emu/nanos6/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (c) 2022-2023 Barcelona Supercomputing Center (BSC) +# Copyright (c) 2022-2024 Barcelona Supercomputing Center (BSC) # SPDX-License-Identifier: GPL-3.0-or-later test_emu(nested-tasks.c) @@ -14,5 +14,6 @@ test_emu(switch-same-type.c) test_emu(sponge.c) test_emu(sponge-breakdown.c BREAKDOWN) test_emu(breakdown-no-black.c BREAKDOWN) +test_emu(breakdown-write-zero.c MP BREAKDOWN) test_emu(rerun-task-bad.c SHOULD_FAIL REGEX "body_execute: body(id=1,taskid=1) is not allowed to run again") diff --git a/test/emu/nanos6/breakdown-write-zero.c b/test/emu/nanos6/breakdown-write-zero.c new file mode 100644 index 0000000..c67a552 --- /dev/null +++ b/test/emu/nanos6/breakdown-write-zero.c @@ -0,0 +1,35 @@ +/* Copyright (c) 2024 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +#include +#include +#include "compat.h" +#include "instr.h" +#include "instr_nanos6.h" + +/* Cause the sort module to write zeros in some rows when the breakdown model is + * enabled, which shouldn't cause a panic. */ +int +main(void) +{ + int rank = atoi(getenv("OVNI_RANK")); + int nranks = atoi(getenv("OVNI_NRANKS")); + + if (nranks < 2) + die("need at least two ranks"); + + instr_start(rank, nranks); + instr_nanos6_init(); + + /* Change the subsystem in a single thread, while the rest remain NULL. + * This shouldn't cause a panic, as writting zero is ok for the other + * sort outputs. */ + if (rank == 0) { + instr_nanos6_worker_loop_enter(); + instr_nanos6_worker_loop_exit(); + } + + instr_end(); + + return 0; +}