ovni/test/emu/nosv/nested-tasks.c

41 lines
829 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 */
2022-05-31 11:16:10 +02:00
#include <stdint.h>
#include "compat.h"
#include "instr.h"
#include "instr_nosv.h"
2022-06-02 15:46:22 +02:00
/* Create and run tasks, one nested into another */
2022-05-31 11:16:10 +02:00
int
main(void)
{
instr_start(0, 1);
instr_nosv_init();
2022-05-31 11:16:10 +02:00
int ntasks = 100;
2022-06-02 15:46:22 +02:00
uint32_t typeid = 1;
instr_nosv_type_create((int32_t) typeid);
2022-05-31 11:16:10 +02:00
for (int id = 1; id <= ntasks; id++)
instr_nosv_task_create((uint32_t) id, typeid);
for (int id = 1; id <= ntasks; id++) {
instr_nosv_task_execute((uint32_t) id, 0);
instr_nosv_task_pause((uint32_t) id, 0);
instr_nosv_submit_enter();
}
2022-05-31 11:16:10 +02:00
for (int id = ntasks; id >= 1; id--) {
instr_nosv_submit_exit();
instr_nosv_task_resume((uint32_t) id, 0);
instr_nosv_task_end((uint32_t) id, 0);
}
2022-05-31 11:16:10 +02:00
instr_end();
return 0;
}