android_mt6572_jiabo/ndk/tests/device/test-openmp/jni/openmp.c
2025-09-05 16:56:03 +08:00

22 lines
445 B
C

#include <stdio.h>
#include <stdlib.h>
#include <omp.h>
int main(int argc, char *argv[])
{
int iam = 0, np = 1;
if (!getenv("OMP_NUM_THREADS"))
omp_set_num_threads(4);
#pragma omp parallel default(shared) private(iam, np)
{
#if defined(_OPENMP)
np = omp_get_num_threads();
iam = omp_get_thread_num();
#endif
printf("Hello from thread %d out of %d\n", iam, np);
}
return 0;
}