2023-10-23 15:12:43 +02:00
|
|
|
/* 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
|
|
|
|
2023-03-22 16:01:55 +01:00
|
|
|
#include <stdint.h>
|
|
|
|
#include "compat.h"
|
|
|
|
#include "instr.h"
|
2022-08-23 16:40:44 +02:00
|
|
|
#include "instr_nosv.h"
|
2022-06-02 15:46:22 +02:00
|
|
|
|
2023-10-23 15:12:43 +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);
|
2023-11-10 12:34:57 +01:00
|
|
|
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;
|
|
|
|
|
2024-07-24 17:02:57 +02:00
|
|
|
instr_nosv_type_create((int32_t) typeid);
|
2022-05-31 11:16:10 +02:00
|
|
|
|
2023-10-23 15:12:43 +02:00
|
|
|
for (int id = 1; id <= ntasks; id++)
|
2024-07-24 17:02:57 +02:00
|
|
|
instr_nosv_task_create((uint32_t) id, typeid);
|
2023-10-23 15:12:43 +02:00
|
|
|
|
|
|
|
for (int id = 1; id <= ntasks; id++) {
|
2024-07-24 17:02:57 +02:00
|
|
|
instr_nosv_task_execute((uint32_t) id, 0);
|
|
|
|
instr_nosv_task_pause((uint32_t) id, 0);
|
2023-10-23 15:12:43 +02:00
|
|
|
instr_nosv_submit_enter();
|
|
|
|
}
|
2022-05-31 11:16:10 +02:00
|
|
|
|
2023-10-23 15:12:43 +02:00
|
|
|
for (int id = ntasks; id >= 1; id--) {
|
2023-02-16 16:07:19 +01:00
|
|
|
instr_nosv_submit_exit();
|
2024-07-24 17:02:57 +02:00
|
|
|
instr_nosv_task_resume((uint32_t) id, 0);
|
|
|
|
instr_nosv_task_end((uint32_t) id, 0);
|
2023-02-16 16:07:19 +01:00
|
|
|
}
|
2022-05-31 11:16:10 +02:00
|
|
|
|
|
|
|
instr_end();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|