ovni/test/rt/openmp/worksharing-and-tasks.c
Rodrigo Arias 55318d9da7 Update OpenMP emulation model
Add more tests, subsystem states and documentation.
2024-03-12 11:35:18 +01:00

35 lines
617 B
C

#include <stdio.h>
#include "compat.h"
int main(void)
{
#pragma omp parallel
{
//#pragma omp single nowait
for (int i = 0; i < 100; i++) {
#pragma omp task
sleep_us(10);
}
/* Wait a bit for task allocation */
sleep_us(1000);
/* Occupy 4 CPUs with sections */
#pragma omp sections nowait
{
#pragma omp section
{ sleep_us(1001); printf("1001\n"); }
#pragma omp section
{ sleep_us(1002); printf("1002\n"); }
#pragma omp section
{ sleep_us(1003); printf("1003\n"); }
#pragma omp section
{ sleep_us(1004); printf("1004\n"); }
}
#pragma omp taskwait
}
return 0;
}