Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

strange error when run mex file using OpenMP

51 views
Skip to first unread message

Pinpress

unread,
Nov 8, 2008, 11:10:19 AM11/8/08
to
I was using gcc to compile a trivial C mex program using OpenMP to run in Matlab.

The source code is:

#include "mex.h"
#include <omp.h>


void mexFunction( int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[] )
{
printf("Num threads %d.\n", omp_get_num_threads());
}


//The compile line is:

gcc -fopenmp -fPIC -O3 -Wall -otest.mexa64 -shared -fexceptions -I/thayerfs/apps/matlabR2008b/extern/include -I./test.c -L/thayerfs/apps/matlabR2008b/bin/glnxa64 -lm

(Of course, the path names are system dependent.)

It compiles fine, but when I run it, it reports error:

>> test
??? Invalid MEX-file '/thayerfs/home/songbai_ji/itk/test.mexa64':
/usr/lib/libgomp.so.1: cannot allocate memory in static TLS block.


Could someone tell me what is going wrong?

Ashish Uthama

unread,
Nov 11, 2008, 10:01:14 AM11/11/08
to
0 new messages