Mex OpenMP C code
조회 수: 6(최근 30일)
I tried to use OpenMP in Matlab 2018a. My code is very simple, called testOpenMP.c.
I successfully compiled the code by mex -v testOpenMP.c CFLAGS="$CFLAGS -fopenmp" LDFLAGS="$LDFLAGS -fopenmp"
However, we I run the compile mex extension by just typing testOpenMP in Matlab's command window. It always crashed.
Do you know how to correctly compile such an openmp c code and run it?
mxArray *pargout [ ],
const mxArray *pargin [ ]
int thread_count = 32;
#pragma omp parallel for default(none)
for(int i = 0; i < 32; i++)
printf("Hello from %d\n",i);