comparison configure.ac @ 21554:9f0088f3f335 stable

call openmp function at initialization (bug #47372) Calling an openmp function early in Octave's startup process ensures that the openmp library will be linked with Octave and that shared libraries that use openmp may be safely loaded and unloaded. * configure.ac: Check for omp.h and omp_get_num_threads. * sysdep.cc: Conditionally include <omp.h>. (sysdep_init) Call omp_get_num_threads if it is available.
author John W. Eaton <jwe@octave.org>
date Mon, 28 Mar 2016 22:00:43 -0400
parents 5162cdfb56d8
children 12f207a534aa 9860b8183202
comparison
equal deleted inserted replaced
21535:e09f4c9f800a 21554:9f0088f3f335
448 AC_LANG_POP(C) 448 AC_LANG_POP(C)
449 AC_LANG_PUSH(C++) 449 AC_LANG_PUSH(C++)
450 AX_OPENMP([XTRA_CXXFLAGS="$XTRA_CXXFLAGS $OPENMP_CXXFLAGS"; USE_OPENMP=yes], []) 450 AX_OPENMP([XTRA_CXXFLAGS="$XTRA_CXXFLAGS $OPENMP_CXXFLAGS"; USE_OPENMP=yes], [])
451 AC_LANG_POP(C++) 451 AC_LANG_POP(C++)
452 fi 452 fi
453 dnl Define here since it is skipped if the first argument to 453
454 dnl AX_OPENMP is not empty.
455 if test $USE_OPENMP = yes; then
456 AC_DEFINE(HAVE_OPENMP, 1, [Define if OpenMP is enabled])
457 fi
458 ## Set these for any other tests that may require them. They will be 454 ## Set these for any other tests that may require them. They will be
459 ## reset before output files are generated. 455 ## reset before output files are generated.
460 CFLAGS="$CFLAGS $OPENMP_CFLAGS" 456 CFLAGS="$CFLAGS $OPENMP_CFLAGS"
461 CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS" 457 CXXFLAGS="$CXXFLAGS $OPENMP_CXXFLAGS"
458
459 dnl Define here since it is skipped if the first argument to
460 dnl AX_OPENMP is not empty.
461 if test $USE_OPENMP = yes; then
462 AC_CHECK_HEADERS([omp.h])
463 AC_CHECK_FUNCS([omp_get_num_threads])
464 AC_DEFINE(HAVE_OPENMP, 1, [Define if OpenMP is enabled])
465 fi
462 466
463 ### When compiling math for x87, problems may arise in some code comparing 467 ### When compiling math for x87, problems may arise in some code comparing
464 ### floating-point intermediate results. The root cause is the extra precision 468 ### floating-point intermediate results. The root cause is the extra precision
465 ### (~80 bits) of x87 co-processor registers versus the IEEE standard 64 bits. 469 ### (~80 bits) of x87 co-processor registers versus the IEEE standard 64 bits.
466 ### Generally, storing the result in a local volatile variable forces a 470 ### Generally, storing the result in a local volatile variable forces a