Add partial-cpus test

This commit is contained in:
Rodrigo Arias 2024-11-05 10:56:29 +01:00
parent 60b575c8f8
commit fe860b2e38
2 changed files with 35 additions and 0 deletions

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(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")

View File

@ -0,0 +1,34 @@
/* Copyright (c) 2024 Barcelona Supercomputing Center (BSC)
* SPDX-License-Identifier: GPL-3.0-or-later */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#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;
}