From fe860b2e388537b123d9976402c31fa00452642d Mon Sep 17 00:00:00 2001 From: Rodrigo Arias Date: Tue, 5 Nov 2024 10:56:29 +0100 Subject: [PATCH] Add partial-cpus test --- test/emu/ovni/CMakeLists.txt | 1 + test/emu/ovni/partial-cpus.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 test/emu/ovni/partial-cpus.c diff --git a/test/emu/ovni/CMakeLists.txt b/test/emu/ovni/CMakeLists.txt index 0bd5b7b..c43e3ad 100644 --- a/test/emu/ovni/CMakeLists.txt +++ b/test/emu/ovni/CMakeLists.txt @@ -11,6 +11,7 @@ test_emu(sort-first-and-full-ring.c SORT SHOULD_FAIL REGEX "cannot find a event previous to clock") test_emu(burst-stats.c REGEX "burst stats: median/avg/max = 33/ 33/ 33 ns") test_emu(mp-simple.c MP) +test_emu(partial-cpus.c MP) test_emu(merge-cpus-loom.c MP) test_emu(version-good.c) test_emu(version-bad.c SHOULD_FAIL REGEX "incompatible .* version") diff --git a/test/emu/ovni/partial-cpus.c b/test/emu/ovni/partial-cpus.c new file mode 100644 index 0000000..5bef674 --- /dev/null +++ b/test/emu/ovni/partial-cpus.c @@ -0,0 +1,34 @@ +/* Copyright (c) 2024 Barcelona Supercomputing Center (BSC) + * SPDX-License-Identifier: GPL-3.0-or-later */ + +#include +#include +#include +#include "common.h" +#include "compat.h" +#include "instr.h" +#include "ovni.h" + +/* Ensures that we can emit a partial list of CPUs. */ +int +main(void) +{ + int rank = atoi(getenv("OVNI_RANK")); + int nranks = atoi(getenv("OVNI_NRANKS")); + + if (nranks < 2) + die("needs at least 2 ranks"); + + ovni_proc_init(1, "loom0", getpid()); + ovni_thread_init(get_tid()); + + int i = rank; + + /* Only emit one CPU per thread */ + ovni_add_cpu(i, i); + + instr_thread_execute(i, -1, 0); + instr_end(); + + return 0; +}