Skip to content

Commit

Permalink
Merge pull request #14 from astromatic/icx
Browse files Browse the repository at this point in the history
Icx
  • Loading branch information
ebertin authored Apr 6, 2023
2 parents c9b0b10 + d94daa7 commit 540c398
Show file tree
Hide file tree
Showing 8 changed files with 142 additions and 116 deletions.
20 changes: 10 additions & 10 deletions INSTALL
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,19 @@ locations:
$ ./configure

Compared to "gcc" and the librairies above, the combination of the
Intel compiler ("icc") and the MKL (Math Kernel Library) libraries
can give the PSFEx executable a strong boost in performance,
thanks to better vectorized code. If "icc" and the MKL (Math Kernel
Library) are installed on your system [4] , you can take advantage of
those using instead
Intel compiler ("icc" or "icx") and the MKL (Math Kernel Library)
libraries can give the PSFEx executable a significant boost in
performance, thanks to better vectorized code, and reduced memory
usage. If "icc" (or "icx") and the MKL (Math Kernel Library) are
installed on your system [4], you can take advantage of those using
instead

$ ./configure --enable-mkl

Additionally, if the PSFEx binary is to be run on a different
machine that does not have "icc" and the MKL (Math Kernel Library)
installed (e.g., a cluster computing node), you must configure a
partially statically linked executable using
machine that does not have "icc" (or "icx") and the MKL installed
(e.g., a cluster computing node), you must configure a partially
statically linked executable using

$ ./configure --enable-mkl --enable-auto-flags --enable-best-link

Expand Down Expand Up @@ -126,6 +127,5 @@ path).
options "--enable-threads --enable-float".

[4] The Linux versions of the Intel compiler and MKL (Math
Kernel Library) are available for free to academic researchers,
students, educators and open source contributors.
Kernel Library) are now available for free on Intel's website.

62 changes: 36 additions & 26 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#
# This file part of: PSFEx
#
# Copyright: (C) 2002-2022 IAP/CNRS/SorbonneU/CFHT
# Copyright: (C) 2002-2023 IAP/CNRS/SorbonneU/CFHT
#
# License: GNU General Public License
#
Expand All @@ -22,7 +22,7 @@
# You should have received a copy of the GNU General Public License
# along with PSFEx. If not, see <http://www.gnu.org/licenses/>.
#
# Last modified: 12/01/2022
# Last modified: 05/04/2023
#
#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

Expand All @@ -31,7 +31,7 @@ define([AC_CACHE_LOAD],)
define([AC_CACHE_SAVE],)

# This is your standard AstrOmatic source code...
AC_INIT(PSFEx, 3.23.0, [[email protected]],
AC_INIT(PSFEx, 3.24.1, [[email protected]],
psfex, [http://astromatic.net/software/psfex])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_AUX_DIR(autoconf)
Expand All @@ -50,9 +50,9 @@ AC_SUBST(DATE3, "$date3")

# Include macros
sinclude(acx_atlas.m4)
sinclude(acx_openblas.m4)
sinclude(acx_fftw.m4)
sinclude(acx_mkl.m4)
sinclude(acx_openblas.m4)
sinclude(acx_plplot.m4)
sinclude(acx_prog_cc_optim.m4)
sinclude(acx_pthread.m4)
Expand Down Expand Up @@ -80,24 +80,38 @@ AC_ARG_ENABLE(auto-flags,
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]))

# Provide special option for the Linux Intel C compiler
AC_MSG_CHECKING([whether the INTEL compiler is enabled])
# Provide special option for the Linux Intel C "classic" compiler
AC_MSG_CHECKING([whether the classic INTEL compiler is enabled])
AC_ARG_ENABLE(icc,
[AS_HELP_STRING([--enable-icc],
[Use the Intel compiler (default = no)])],
CC="icc"
enable_iccx="yes"
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]))

# Provide special option for the Linux Intel OneAPI C compiler
AC_MSG_CHECKING([whether the INTEL compiler is enabled])
AC_ARG_ENABLE(icx,
[AS_HELP_STRING([--enable-icx],
[Use the Intel compiler (default = no)])],
CC="icx"
enable_iccx="yes"
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]))

# Provide special options for INTEL MKL
# We force the use of icc
# We use icc if available, if not Intel OneAPI's icx
# (we don't use AC_PROG_CC as it does not play nice
# in a conditional block)
AC_MSG_CHECKING([whether INTEL's MKL is enabled])
AC_ARG_ENABLE(mkl,
[AS_HELP_STRING([--enable-mkl],
[Use INTEL's MKL for solvers and FFTs (default = no)])],
enable_icc="yes"
CC="icc"
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([yes])
CC=""
[AC_CHECK_PROGS(CC, [icc icx cc])]
enable_iccx="yes",
AC_MSG_RESULT([no]))

# Checks for programs.
Expand All @@ -116,10 +130,10 @@ AC_PROG_INSTALL
AC_CHECK_LIB(m, sin)

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([dlfcn.h fcntl.h limits.h malloc.h stdlib.h string.h \
sys/mman.h sys/types.h unistd.h])
if test "$enable_icc" = "yes"; then
# Checks for INTEL math header files.
if test "$enable_iccx" = "yes"; then
AC_CHECK_HEADERS(mathimf.h)
fi

Expand Down Expand Up @@ -154,8 +168,8 @@ AC_ARG_WITH(atlas-libdir,
[AS_HELP_STRING([--with-atlas-libdir=<ATLAS library path>],
[Provide an alternative path to the ATLAS library])])
AC_ARG_WITH(atlas-incdir,
[AS_HELP_STRING([--with-atlas-incdir=<ATLAS header dir>],
[Provide an alternative path to the ATLAS header directory])])
[AS_HELP_STRING([--with-atlas-incdir=<ATLAS include dir>],
[Provide an alternative path to the ATLAS include directory])])

# Provide special options for FFTW
AC_ARG_WITH(fftw-libdir,
Expand Down Expand Up @@ -227,7 +241,7 @@ AC_ARG_ENABLE(threads,
AC_MSG_CHECKING([for profiler mode])
AC_ARG_ENABLE(profiling,
[AS_HELP_STRING([--enable-profiling],
[Enable special mode for profiling (default = no)])]
[Enable special mode for profiling (default = no)])],
AC_MSG_RESULT([yes]),
AC_MSG_RESULT([no]))

Expand All @@ -250,19 +264,15 @@ if test "$use_pthreads" = "yes"; then
ACX_PTHREAD
CC="$PTHREAD_CC"
[AM_CFLAGS="$AM_CFLAGS $PTHREAD_CFLAGS -D_REENTRANT"]
LIBS="$PTHREAD_LIBS $LIBS"
LIBS="$LIBS $PTHREAD_LIBS"
fi
AM_CONDITIONAL(USE_THREADS, test $use_pthreads = "yes")

############ handle the INTEL MKL library (FFTW + LAPACKe) ###########
if test "$enable_mkl" = "yes"; then
convlibs="${srcdir}/../src/wcs/libwcs_c.a,${srcdir}/../src/levmar/liblevmar.a"
ACX_MKL($with_mkl_dir,no,$enable_best_link,$convlibs)
AC_MSG_CHECKING([for the INTEL MKL])
if test "$MKL_WARN" == ""; then
AC_MSG_RESULT([yes])
else
AC_MSG_RESULT([no])
if test "$MKL_WARN" != ""; then
AC_MSG_WARN([$MKL_WARN])
fi
AM_CFLAGS="$AM_CFLAGS $MKL_CFLAGS "
Expand Down Expand Up @@ -323,7 +333,7 @@ AM_CONDITIONAL(USE_PLPLOT, test "$use_plplot" = "yes")

# Compile with profiling option
if test "$enable_profiling" = "yes"; then
if test "$enable_icc" = "yes"; then
if test "$enable_iccx" = "yes"; then
AM_CFLAGS="$AM_CFLAGS -pq"
else
AM_CFLAGS="$AM_CFLAGS -pg"
Expand All @@ -333,11 +343,11 @@ fi

# "Best" linking option
if test "$enable_best_link" = "yes"; then
if test "$enable_icc" = "yes"; then
AM_LDFLAGS="-static-intel -qopenmp-link static -shared-libgcc \
-static-libtool-libs -no-intel-extensions -avoid-version $AM_LDFLAGS"
if test "$enable_iccx" = "yes"; then
AM_LDFLAGS="-static-intel -qopenmp-link=static -shared-libgcc \
-avoid-version $AM_LDFLAGS"
else
AM_LDFLAGS="-shared-libgcc -static-libtool-libs -avoid-version $AM_LDFLAGS"
AM_LDFLAGS="-shared-libgcc -avoid-version $AM_LDFLAGS"
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion debian/rules
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ifeq ($(USE_BEST),1)
dh_auto_configure -- --host=$(DEB_HOST_GNU_TYPE) \
--build=$(DEB_BUILD_GNU_TYPE) \
--prefix=/usr --mandir=\$${prefix}/share/man \
--enable-icc --enable-mkl \
--enable-icx --enable-mkl \
--enable-auto-flags --enable-best-link \
--with-release=$(PACKAGE_RELEASE)
else
Expand Down
6 changes: 3 additions & 3 deletions doc/src/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@
# built documents.
#
# The short X.Y version.
version = '3.23.0'
version = '3.24.1'
# The full version, including alpha/beta/rc tags.
release = '3.23.0'
release = '3.24.1'

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
Expand All @@ -76,7 +76,7 @@

# There are two options for replacing |today|: either, you set today to some
# non-false value, then it is used:
today = 'Thu Jan 13 2022'
today = 'Wed Apr 05 2023'
# Else, today_fmt is used as the format for a strftime call.
#today_fmt = '%B %d, %Y'

Expand Down
10 changes: 5 additions & 5 deletions m4/acx_mkl.m4
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl
dnl This file part of: AstrOmatic software
dnl
dnl Copyright: (C) 2003-2016 IAP/CNRS/UPMC
dnl Copyright: (C) 2003-2022 IAP/CNRS/SorbonneU
dnl
dnl License: GNU General Public License
dnl
Expand All @@ -23,7 +23,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with AstrOmatic software.
dnl If not, see <http://www.gnu.org/licenses/>.
dnl
dnl Last modified: 16/03/2016
dnl Last modified: 15/09/2022
dnl
dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl
Expand Down Expand Up @@ -73,11 +73,11 @@ dnl Set architecture flags
dnl ----------------------
dnl check if INTEL compiler is present
icc -V 2>&1 | grep -i "Intel" > /dev/null 2>&1 && flagicc=yes
$CC -V 2>&1 | grep -i "Intel" > /dev/null 2>&1 && flagicc=yes
dnl check if INTEL compiler uses x86_64 architecture
icc -V 2>&1 | grep -i "Intel(R) 64" > /dev/null 2>&1 && flag64=yes
$CC -V 2>&1 | grep -i "Intel(R) 64" > /dev/null 2>&1 && flag64=yes
dnl check if the platform is OSX
icc -dumpmachine 2>&1 | grep -i "darwin" > /dev/null 2>&1 && flagosx=yes
$CC -dumpmachine 2>&1 | grep -i "darwin" > /dev/null 2>&1 && flagosx=yes
dnl ----------------------
dnl Exit if INTEL compiler is not found
Expand Down
8 changes: 4 additions & 4 deletions m4/acx_prog_cc_optim.m4
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl
dnl This file part of: AstrOmatic software
dnl
dnl Copyright: (C) 2002-2013 Emmanuel Bertin -- IAP/CNRS/UPMC
dnl Copyright: (C) 2002-2022 Emmanuel Bertin -- IAP/CNRS/SorbonneU
dnl (C) 2002 Ville Lauriki (original version)
dnl
dnl Licenses: GPL (this version)
Expand All @@ -25,7 +25,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with AstrOmatic software.
dnl If not, see <http://www.gnu.org/licenses/>.
dnl
dnl Last modified: 13/03/2013
dnl Last modified: 07/09/2022
dnl
dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl
Expand Down Expand Up @@ -60,14 +60,14 @@ EOF
if $CC -V 2>&1 | grep -i "Intel(R) 64" > /dev/null 2>&1 &&
$CC -c -O conftest.c > /dev/null 2>&1 &&
test -f conftest.o; then
prog_cc_optim_cv_flags="-O3 -axSSSE3,SSE4.1,SSE4.2,AVX,CORE-AVX2,CORE-AVX-I -no-prec-div -unroll"
prog_cc_optim_cv_flags="-O3 -axSSSE3,SSE4.1,SSE4.2,AVX,CORE-AVX2,CORE-AVX-I"
prog_ld_optim_cv_flags=""
dnl INTEL C 32bits compiler
elif $CC -V 2>&1 | grep -i "Intel(R)" > /dev/null 2>&1 &&
$CC -c -O conftest.c > /dev/null 2>&1 &&
test -f conftest.o; then
prog_cc_optim_cv_flags="-O3 -axSSE2,SSE3,SSE4.1,SSE4.2,AVX,CORE-AVX2,CORE-AVX-I -no-prec-div -unroll"
prog_cc_optim_cv_flags="-O3 -axSSE2,SSE3,SSE4.1,SSE4.2,AVX,CORE-AVX2,CORE-AVX-I"
prog_ld_optim_cv_flags=""
dnl GCC
Expand Down
18 changes: 9 additions & 9 deletions m4/acx_pthread.m4
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl
dnl This file part of: AstrOmatic software
dnl
dnl Copyright: (C) 2002-2010 Emmanuel Bertin -- IAP/CNRS/UPMC
dnl Copyright: (C) 2002-2022 Emmanuel Bertin -- IAP/CNRS/SorbonneU
dnl (C) 2001 Steven G. Johnson (original version)
dnl
dnl Licenses: GPL (this version)
Expand All @@ -25,7 +25,7 @@ dnl You should have received a copy of the GNU General Public License
dnl along with AstrOmatic software.
dnl If not, see <http://www.gnu.org/licenses/>.
dnl
dnl Last modified: 09/10/2010
dnl Last modified: 15/09/2022
dnl
dnl %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
dnl
Expand Down Expand Up @@ -88,7 +88,7 @@ if test x"$PTHREAD_LIBS$PTHREAD_CFLAGS" != x; then
save_LIBS="$LIBS"
LIBS="$PTHREAD_LIBS $LIBS"
AC_MSG_CHECKING([for pthread_join in LIBS=$PTHREAD_LIBS with CFLAGS=$PTHREAD_CFLAGS])
AC_TRY_LINK_FUNC(pthread_join, acx_pthread_ok=yes)
AC_LINK_IFELSE([AC_LANG_CALL([], pthread_join)], acx_pthread_ok=yes)
AC_MSG_RESULT($acx_pthread_ok)
if test x"$acx_pthread_ok" = xno; then
PTHREAD_LIBS=""
Expand Down Expand Up @@ -170,10 +170,10 @@ for flag in $acx_pthread_flags; do
# pthread_cleanup_push because it is one of the few pthread
# functions on Solaris that doesn't have a non-functional libc stub.
# We try pthread_create on general principles.
AC_TRY_LINK([#include <pthread.h>],
AC_LINK_IFELSE([AC_LANG_CALL([#include <pthread.h>],
[pthread_t th; pthread_join(th, 0);
pthread_attr_init(0); pthread_cleanup_push(0, 0);
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ],
pthread_create(0,0,0,0); pthread_cleanup_pop(0); ])],
[acx_pthread_ok=yes])
LIBS="$save_LIBS"
Expand All @@ -199,12 +199,12 @@ if test "x$acx_pthread_ok" = xyes; then
# Detect AIX lossage: threads are created detached by default
# and the JOINABLE attribute has a nonstandard name (UNDETACHED).
AC_MSG_CHECKING([for joinable pthread attribute])
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_JOINABLE;],
AC_LINK_IFELSE([AC_LANG_CALL([#include <pthread.h>],
[int attr=PTHREAD_CREATE_JOINABLE;])],
ok=PTHREAD_CREATE_JOINABLE, ok=unknown)
if test x"$ok" = xunknown; then
AC_TRY_LINK([#include <pthread.h>],
[int attr=PTHREAD_CREATE_UNDETACHED;],
AC_LINK_IFELSE([AC_LANG_CALL([#include <pthread.h>],
[int attr=PTHREAD_CREATE_UNDETACHED;])],
ok=PTHREAD_CREATE_UNDETACHED, ok=unknown)
fi
if test x"$ok" != xPTHREAD_CREATE_JOINABLE; then
Expand Down
Loading

0 comments on commit 540c398

Please sign in to comment.