help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: OpenMP in oct files


From: Mike Puglia
Subject: Re: OpenMP in oct files
Date: Sun, 22 Sep 2013 20:01:05 -0700 (PDT)

Hi,

I don't remember that I had exactly the error you're having below, but I had a few problems getting OpenMP to work in oct files as well, even after trying some of the same posts.  I use the mingw build.  Ultimately I had to compile all the OpenMP functionality into a static library using gcc directly (with -fopenmp flag in the command line).  Then I wrote an octfile wrapper around the exposed library function, so that mkoctfile was more or less blind to the OpenMP functionality.  At the mkoctfile command line, I just included the static library and -lgomp during linking and everything worked fine from there.

Hope this helps.

MTP


From: Daniel Kraft <address@hidden>
To: address@hidden
Sent: Friday, September 20, 2013 8:15 PM
Subject: OpenMP in oct files

Hi,

I'm trying to use OpenMP from C++ which is compiled into an oct-file.  I use

  CXXFLAGS=-fopenmp mkoctfile ...

to compile with OpenMP enabled.  However, when I then try to run the
function, I get the error

  undefined symbol: GOMP_parallel_start

because libgomp is not loaded appropriately.  Is it possible to instruct
Octave or mkoctfile somehow to load this library, so that OpenMP can be
used from within oct-files?  I also tried linking statically by
specifying libgomp.a directly as object, but this complains that
libgomp.a (which is supplied by my GNU/Linux distro) is not compiled
with -fPIC.

Note that there are already some threads I found on the mailing list
archives ([1], [2] and [3]), but they don't solve my problem.  [1]
discusses only how to pass -fopenmp to the compiler (which works fine
with CXXFLAGS), [2] seems to get a different error, and while [3]
suggests that a solution may be found with the nurbs package, this also
doesn't solve my problem.  I looked at the code and while it uses OpenMP
pragmas, OpenMP is not enabled by the default Makefile.  If I change the
Makefile to actually enable OpenMP and then try to call bspeval, the
exactly same error occurrs that I'm getting.  (But note that I did
"make" from the src folder of the nurbs package file, which is probably
not exactly how those packages are meant to be installed.  If I did
something wrong here and in the correct version it uses OpenMP
successfully, please point me to what exactly needs to be done to do that.)

  [1]
http://octave.1599824.n4.nabble.com/mkoctfile-and-OpenMP-td4561550.html
  [2]
http://octave.1599824.n4.nabble.com/How-to-employ-openMP-in-octave-td1630427.html
  [3]
http://octave.1599824.n4.nabble.com/Using-OpenMP-in-oct-files-td4488760.html#a4489620

Thanks a lot!  BTW, I compiled Octave from source -- if it is not
possible to fix my problem in an easy way, would it help to specify
-lgomp or even -fopenmp when building Octave itself?

Yours,
Daniel

--
http://www.domob.eu/
--
Done:  Arc-Bar-Cav-Hea-Kni-Ran-Rog-Sam-Tou-Val-Wiz
To go: Mon-Pri
_______________________________________________
Help-octave mailing list
address@hidden
https://mailman.cae.wisc.edu/listinfo/help-octave



reply via email to

[Prev in Thread] Current Thread [Next in Thread]