#include #include #include void main(){ int data = 123; $omp_gteam gteam = $omp_gteam_create($here, 3); $omp_gshared gshared = $omp_gshared_create(gteam, &data); void thread(int tid) { int data_local; int data_status; int tmp = 456; $omp_team team = $omp_team_create($here, gteam, tid); $omp_shared shared = $omp_shared_create(team, gshared, &data_local, &data_status); printf("Hello from thread %d\n", tid); // data = 456; $omp_write(shared, &data_local, &tmp); $assert data_local == tmp; $omp_shared_destroy(shared); $omp_team_destroy(team); } $parfor (int i: ($domain){ 0 .. 2 }) { thread(i); } $assert data == 123; $omp_gshared_destroy(gshared); $omp_gteam_destroy(gteam); }