how to use openMP in Matlab on Windows 7
3 views (last 30 days)
Show older comments
Dear All,
I am trying OpenMP by the following simple code
/*ompTest.c */
#include "mex.h"
#include "stdio.h"
#include "stdlib.h"
#include "omp.h"
void mexFunction(
int nargout,
mxArray *pargout [ ],
int nargin,
const mxArray *pargin [ ]
){
ptrdiff_t num_Thread = (ptrdiff_t) mxGetScalar(pargin[0]);
# pragma omp parallel num_threads(numThread){
int my_rank = omp_get_thread_num();
int thread_count = omp_get_num_threads();
printf("Hello from thread %d of %d\n",my_rank,thread_count);
}
return;
}
Then I compile it using
mex CC=gcc CFLAGS="\$CFLAGS -fopenmp" LDFLAGS="\$LDFLAGS -fopenmp" ompTest.c
and also
mex -v ompTest.c COMPFLAGS="$COMPFLAGS /openmp"
as suggested by some people.
However, it always reported
fatal error C1083: Cannot open include file: 'omp.h': No such file or directory
I don't find any people that has the same problem. Anybody can help me on this? I installed SDK 7.1 kit. Do I need to install some more file to have omp.h?
0 Comments
Answers (1)
See Also
Categories
Find more on Optimization Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!