Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable OpenMP support on Linux. #3

Closed
GoogleCodeExporter opened this issue Aug 16, 2015 · 6 comments
Closed

Enable OpenMP support on Linux. #3

GoogleCodeExporter opened this issue Aug 16, 2015 · 6 comments
Labels

Comments

@GoogleCodeExporter
Copy link

Hello,

OpenTURNS, an open-source lib dedicated to the treatment of uncertainties, use 
MuParser for some study. By the way, thanks for your work! 
So, for some large study we would like to speed up a little bit the 
computation. So we would like to enable OpenMP inside muParser. 
We know that using a just in time parser would be much faster, but it would 
involve much more work. OpenMP in muParser is the first easy step to speed up 
our code.

I tried to enable OpenMP support on Linux (using autoconf). 
But using the revision 10 of http://muparser.googlecode.com/svn/trunk source, 
if I uncomment the line "#define MUP_USE_OPENMP" it does not enable OpenMP 
compilation  switch and the compilation fails.

I made a patch and the compilation using autoconf runs fine now.
The patch add an --enable-openmp feature (openmp is disabled by default).

  ./configure --enable-openmp
  make
  ...

My system is running on ubuntu 12.04 64bits.

Do you think the patch is good enough? I do not know if it will break 
compilation on other systems (windows ...) as I know only autoconf and cmake.
Could you consider merging this patch to muParser source code?

Beset regards,
Mathieu Souchaud

Original issue reported on code.google.com by mattieu....@free.fr on 21 Dec 2013 at 5:41

Attachments:

@GoogleCodeExporter
Copy link
Author

Sorry for not following up in time. This looks like it would work. Most files 
of the build system are auto generated and i can't use patches for those files. 
I'll check it before the next service release.

Original comment by ib...@gmx.info on 27 Jan 2014 at 8:33

@GoogleCodeExporter
Copy link
Author

Ok, thanks.

Original comment by mattieu....@free.fr on 27 Jan 2014 at 9:55

@giraldeau
Copy link
Collaborator

I enabled the OpenMP and added the example1 in a test, but the program gets stuck here:

(gdb) bt
#0  0x00007ffff7b75bb6 in mu::ParserBase::ParseCmdCodeBulk(int, int) const () from /home/francisg/muparser/temp/libmuparser.so.2
#1  0x00007ffff7b79762 in mu::ParserBase::Eval(double*, int) [clone ._omp_fn.0] () from /home/francisg/muparser/temp/libmuparser.so.2
#2  0x00007ffff6ca7cbf in GOMP_parallel () from /usr/lib/x86_64-linux-gnu/libgomp.so.1
#3  0x00007ffff7b795ab in mu::ParserBase::Eval(double*, int) () from /home/francisg/muparser/temp/libmuparser.so.2
#4  0x00007ffff7baf41b in mu::Test::ParserTester::EqnTestBulk(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, double*, bool) ()
   from /home/francisg/muparser/temp/libmuparser.so.2
#5  0x00007ffff7b94f77 in mu::Test::ParserTester::TestBulkMode() () from /home/francisg/muparser/temp/libmuparser.so.2
#6  0x00007ffff7baaa86 in mu::Test::ParserTester::Run() () from /home/francisg/muparser/temp/libmuparser.so.2
#7  0x000000000040bac9 in SelfTest() ()
#8  0x000000000040dbfe in main ()

@beltoforion
Copy link
Owner

Can confirm that there seems to be an issue but not yet what kind of issue. Will investigate the issue.

@beltoforion
Copy link
Owner

The reason is that the bulk test code is using a sample size of 4. Nowadays most cpu's have more cors and due to an error in the chuck size computation for openmp. The parser is assigning a chunk size of 0.

A fix will be commited shortly.

beltoforion pushed a commit that referenced this issue Jun 2, 2020
OpenMP is no the default setting for cmake based builds
@beltoforion
Copy link
Owner

The issue is fixed; OpenMP is now the default setting for compiling muparser

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants