I followed the instructions from this answer in clang-omp in Xcode under El Capitan
I was able to run openmp programs on xcode. But there was only 1 thread.
Also, I am able to run from terminal, refer to my answer for this Installing OpenMP on Mac OS X 10.11
how to increase no. of threads in xcode?
I am running sample program:
#include <omp.h>
#include <stdio.h>
int main() {
#pragma omp parallel
printf("Hello from thread %d, nthreads %d\n", omp_get_thread_num(), omp_get_num_threads());
}
I get only one thread in output in xcode.
I have tried Xcode->Edit Schemes-> Arguments-> Env variables-> OMP_NUM_THREADS with value 4
I have also tried omp_set_num_threads(4)
I am sure this answer is coming way too late. But hopefully might help someone else. I was struggling with the same issue and solved it by : Adding -fopenmp to Other C++ flags as well as C flags.
Hope this helps someone.