The Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Inability to compile mex files with openMp and gfortran
Replies: 1   Last Post: Jan 31, 2013 4:49 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]

Posts: 2
Registered: 7/2/10
Re: Inability to compile mex files with openMp and gfortran
Posted: Jan 31, 2013 4:49 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

"Michele Catalano" <> wrote in message <hb7hjb$n3l$>...
> Dear All,
> I'm trying to compile a fortran source code with mex compiling options. I would introduce openMp statements to fasten the jobs. I'm using gfortran.
> While I can compile by shell, when I compile with option file I get errors such as:
> simulDSGEengProva.o: In function `MAIN__':
> simulDSGEengProva.F90:(.text+0x9222): undefined reference to `GOMP_parallel_start'
> simulDSGEengProva.F90:(.text+0x922f): undefined reference to `GOMP_parallel_end'
> simulDSGEengProva.o: In function `MAIN__.omp_fn.0':
> simulDSGEengProva.F90:(.text+0xa737): undefined reference to `omp_get_num_threads'
> simulDSGEengProva.F90:(.text+0xa73e): undefined reference to `omp_get_thread_num'
> collect2: ld returned 1 exit status
> mex: link of 'simulDSGEengProva' failed.
> I think it is due to compiler inability to link against some library, in particular that related with openMp i.e., libgomp.
> I attach the options in file:
> FC='/usr/bin/gfortran'
> FFLAGS="$MFLAGS -fopenmp -fexceptions "
> FLIBS="$RPATH $MLIBS -L/usr/lib/ -lm -lstdc++"
> #
> What could be the problem?
> thanks in advance

For others having this issue, try linking libgomp when compiling. In other words, use something like this:

mex myfile.cpp CXXFLAGS='\$CXXFLAGS -fopenmp' -lgomp

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.