trace-v3 #7

Open
rarias wants to merge 36 commits from trace-v3 into master
2 changed files with 53 additions and 0 deletions
Showing only changes of commit 24805f607b - Show all commits

View File

@ -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(merge-cpus-loom.c MP)
test_emu(version-good.c)
test_emu(version-bad.c SHOULD_FAIL REGEX "incompatible .* version")
test_emu(clockgate.c MP SHOULD_FAIL REGEX "detected large clock gate")

View File

@ -0,0 +1,52 @@
/* Copyright (c) 2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include <stdlib.h>
#include "compat.h"
#include "instr.h"
/* Ensure we can emit CPUs from multiple threads of the same loom */
static inline void
start(int rank, int nranks)
{
char hostname[OVNI_MAX_HOSTNAME];
if (gethostname(hostname, OVNI_MAX_HOSTNAME) != 0)
die("gethostname failed");
ovni_version_check();
/* Only one loom */
ovni_proc_init(1, hostname, getpid());
ovni_proc_set_rank(rank, nranks);
ovni_thread_init(get_tid());
/* Only emit a subset of CPUs up to the rank number */
for (int i = 0; i <= rank; i++)
ovni_add_cpu(i, i);
int curcpu = rank;
dbg("thread %d has cpu %d (ncpus=%d)",
get_tid(), curcpu, nranks);
instr_require("ovni");
instr_thread_execute(curcpu, -1, 0);
}
int
main(void)
{
int rank = atoi(getenv("OVNI_RANK"));
int nranks = atoi(getenv("OVNI_NRANKS"));
start(rank, nranks);
sleep_us(50 * 1000);
instr_end();
return 0;
}