vinix-ports / tests / toolchain / parallel.c
17 lines · 16 sloc · 416 bytes · ba8d03ddc14310e0c3928665434a6d89258b90b6
Raw
1#include <omp.h>
2#include <stdio.h>
3
4int main(void)
5{
6 unsigned __int128 total = 0;
7 int threads = 0;
8 #pragma omp parallel num_threads(2) reduction(+:threads)
9 {
10 ++threads;
11 __atomic_fetch_add(&total, 1, __ATOMIC_SEQ_CST);
12 }
13 if (threads != 2 || __atomic_load_n(&total, __ATOMIC_SEQ_CST) != 2)
14 return 1;
15 puts("Vinix OpenMP and 128-bit atomics passed");
16 return 0;
17}
18