ovni/test/emu/nosv/mp-rank.c

36 lines
682 B
C
Raw Permalink Normal View History

/* Copyright (c) 2021-2024 Barcelona Supercomputing Center (BSC)
2022-09-19 12:39:02 +02:00
* SPDX-License-Identifier: GPL-3.0-or-later */
2021-12-10 18:23:47 +01:00
#include "compat.h"
#include "instr_nosv.h"
2022-06-02 15:46:22 +02:00
static void
task(uint32_t id, uint32_t typeid, int us)
2021-12-10 18:23:47 +01:00
{
instr_nosv_task_create(id, typeid);
instr_nosv_task_execute(id, 0);
sleep_us(us);
instr_nosv_task_end(id, 0);
2021-12-10 18:23:47 +01:00
}
int
main(void)
2021-12-10 18:23:47 +01:00
{
int rank = atoi(getenv("OVNI_RANK"));
int nranks = atoi(getenv("OVNI_NRANKS"));
2022-06-02 15:46:22 +02:00
uint32_t typeid = 1;
2021-12-10 18:23:47 +01:00
instr_start(rank, nranks);
instr_nosv_init();
2021-12-10 18:23:47 +01:00
instr_nosv_type_create((int32_t) typeid);
2022-06-02 15:46:22 +02:00
2021-12-10 18:23:47 +01:00
/* Create some fake nosv tasks */
for (int i = 0; i < 10; i++)
task((uint32_t) i + 1, typeid, 5000);
2021-12-10 18:23:47 +01:00
instr_end();
return 0;
}