use AC_OPENMP if available (autoconf >= 2.62)

Bug #984836 reported by su_v
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Wishlist
Alex Valavanis

Bug Description

Current situation:
Inkscape uses the external macro AX_OPENMP to detect whether the current compiler supports OpenMP.

While this macro seems to work as expected on Linux, it fails to detect OpenMP support of Apple's GCC-4.2 and llvm-gcc-4.2 [1].
Checking for OpenMP support succeeds (even on OS X) if using AC_OPENMP provided by current autoconf versions (>= 2.62) [2].

Proposed solution (patch):
Add test and use AC_OPENMP if available, else resort to external macro AX_OPENMP.

This allows to build Inkscape with OpenMP support (multi-threaded rendering of filter effects) on OS X systems using a current autoconf version and Apple's GCC 4.2 / llvm-gcc-4.2 compilers. The patch should not negatively affect older build systems which might still use autoconf < 2.62.

Patch tested with Inkscape 0.48+devel r11261 using
- autoconf 2.68, GCC 4.2 (Mac OS X 10.5.8, 32bit Intel)
- autoconf 2.68, llvm-gcc-4.2 (OS X 10.7.2, 64bit)

---
[1] <http://thread.gmane.org/gmane.comp.graphics.inkscape.devel/34490/focus=34491>
[2] <http://lists.gnu.org/archive/html/autotools-announce/2008-04/msg00002.html>

Tags: build
Revision history for this message
su_v (suv-lp) wrote :
Revision history for this message
Jon A. Cruz (jon-joncruz) wrote :

Patch seems to work on OS X 10.6.8, but when executing the filter code appears to go into an infinite loop. Autoconf detection was good, though.

Revision history for this message
su_v (suv-lp) wrote :

> but when executing the filter code appears to go into an infinite loop

Every time? I manage to produce such hangs (not consistently though) when e.g. quickly clicking on the canvas to select something while screen redrawing is still in process with a complex filter example, but basic rendering for example of the 'share/examples/filters.svg' file is ok, at whatever zoom level I choose.

Overall - in my tests on two different systems - rendering performance is noticeably better with OpenMP support enable (despte occasional hangs):

Tests with optimized (-O2) builds run on
- Mac OS X 10.5.8 i386 (Apple GCC 4.2.1)
- OS X 10.7.2 (Apple llvm-gcc-4.2)

I'd still vote for committing the change (unless it breaks linux builds) - we won't find out whether Inkscape can make use of the new multi-core features on OS X unless we enable it in trunk builds to allow testing.

Using autoconf's AC_OPENMP macro also allows to disable OpenMP support completely with './configure --disable-openmp' (which could be recommended for release builds on OS X if any version of Apple's gcc-4.2 turns out to be too unstable with openmp enabled):

$ ./configure --help | grep OpenMP
  --disable-openmp do not use OpenMP
$

Revision history for this message
Alex Valavanis (valavanisalex) wrote :

Updated patch committed in lp:inkscape r12157+12158. The new configure.ac specifies autoconf 2.64 as a prerequisite, so there's no longer any need for the fallback macro.

Changed in inkscape:
assignee: nobody → Alex Valavanis (valavanisalex)
milestone: none → 0.49
status: New → Fix Committed
Revision history for this message
su_v (suv-lp) wrote :

OpenMP disabled for regular OS X builds using 'packaging/macosx/osx-build.sh' in r12160 for now - anyone interested in testing can remove the configure option in the script to compile builds with multi-threading enabled, or build without the help of the packaging script.

Bryce Harrington (bryce)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.