mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-11-03 12:43:55 +01:00
Rewrote HDF5 detection
This commit is contained in:
parent
e2d8cd1972
commit
9355609ced
144
configure.ac
144
configure.ac
@ -41,6 +41,25 @@ AC_SUBST([UNAME])
|
|||||||
## Checks for programs
|
## Checks for programs
|
||||||
## -------------------
|
## -------------------
|
||||||
|
|
||||||
|
# Fortran API [default: --with-fortran], do not disable in the dev mode
|
||||||
|
AC_PROG_FC
|
||||||
|
AC_ARG_WITH(fortran, [AS_HELP_STRING([--without-fortran],[do not test and install the Fortran API])], ok=$withval, ok=yes)
|
||||||
|
AS_IF([test "$ok" = "yes"],[
|
||||||
|
AC_FC_FREEFORM
|
||||||
|
AC_FC_SRCEXT([f90])
|
||||||
|
AC_PROG_FC_C_O
|
||||||
|
AC_FC_LIBRARY_LDFLAGS
|
||||||
|
|
||||||
|
# Specific options required with some compilers
|
||||||
|
AS_CASE([$FC],
|
||||||
|
[*gfortran*], [FCFLAGS="$FCFLAGS -fPIC"],
|
||||||
|
[*flang*], [FCFLAGS="$FCFLAGS -fPIC"],
|
||||||
|
[*ifort*], [FCFLAGS="$FCFLAGS -fPIC"],
|
||||||
|
[])
|
||||||
|
|
||||||
|
])
|
||||||
|
AM_CONDITIONAL([HAVE_FORTRAN],[test "$ok" = "yes"])
|
||||||
|
|
||||||
AC_LANG(C)
|
AC_LANG(C)
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
|
||||||
@ -52,51 +71,18 @@ AC_PROG_CC_C_O
|
|||||||
AM_PROG_CC_C_O
|
AM_PROG_CC_C_O
|
||||||
|
|
||||||
|
|
||||||
# Fortran API [default: --with-fortran], do not disable in the dev mode
|
|
||||||
AC_ARG_WITH(fortran, [AS_HELP_STRING([--without-fortran],[do not test and install the Fortran API])], ok=$withval, ok=yes)
|
|
||||||
if test "$ok" = "yes"; then
|
|
||||||
AC_PROG_FC
|
|
||||||
AC_FC_FREEFORM
|
|
||||||
AC_FC_SRCEXT([f90])
|
|
||||||
AC_PROG_FC_C_O
|
|
||||||
AC_FC_LIBRARY_LDFLAGS
|
|
||||||
fi
|
|
||||||
|
|
||||||
AM_CONDITIONAL([HAVE_FORTRAN],[test "$ok" = "yes"])
|
|
||||||
|
|
||||||
# pkg-config
|
# pkg-config
|
||||||
PKG_PROG_PKG_CONFIG()
|
PKG_PROG_PKG_CONFIG()
|
||||||
PKG_CFLAGS=""
|
|
||||||
PKG_LIBS=""
|
|
||||||
|
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
AC_PROG_GREP
|
AC_PROG_GREP
|
||||||
|
|
||||||
# Specific options required with some compilers
|
AS_CASE([$CC],
|
||||||
case $FC in
|
[*gcc*], [CFLAGS="$CFLAGS -fPIC"],
|
||||||
*gfortran*)
|
[*clang*], [CFLAGS="$CFLAGS -fPIC"],
|
||||||
FCFLAGS="$FCFLAGS -fPIC"
|
[*icc*], [CFLAGS="$CFLAGS -fPIC"],
|
||||||
;;
|
[])
|
||||||
*flang*)
|
|
||||||
FCFLAGS="$FCFLAGS -fPIC"
|
|
||||||
;;
|
|
||||||
*ifort*)
|
|
||||||
FCFLAGS="$FCFLAGS -fPIC"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
case $CC in
|
|
||||||
*gcc*)
|
|
||||||
CFLAGS="$CFLAGS -fPIC"
|
|
||||||
;;
|
|
||||||
*clang*)
|
|
||||||
CFLAGS="$CFLAGS -fPIC"
|
|
||||||
;;
|
|
||||||
*icc*)
|
|
||||||
CFLAGS="$CFLAGS -fPIC"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Check if `cp -r -n` works, otherwise use `cp -r`
|
# Check if `cp -r -n` works, otherwise use `cp -r`
|
||||||
AC_CHECK_PROGS(CP_PROG, [cp])
|
AC_CHECK_PROGS(CP_PROG, [cp])
|
||||||
@ -135,64 +121,46 @@ AC_CHECK_HEADERS([fcntl.h inttypes.h stdint.h stdbool.h stdlib.h string.h unistd
|
|||||||
### HDF5
|
### HDF5
|
||||||
### ----
|
### ----
|
||||||
|
|
||||||
# Configure with HDF5 (default: --with-hdf5 using pkg-config) [optional]:
|
HDF5_LIBS=""
|
||||||
# ./configure [--with-hdf5 or --with-hdf5=yes]
|
HDF5_CFLAGS=""
|
||||||
|
AC_ARG_WITH([hdf5],
|
||||||
|
AS_HELP_STRING([--with-hdf5=PATH], [Path to HDF5 library and headers]), [
|
||||||
|
with_hdf5="$withval"], [with_hdf5="yes"])
|
||||||
|
|
||||||
# Configure with user-provided path to HDF5:
|
AS_IF([test "x$with_hdf5" == "xno"], [
|
||||||
# ./configure --with-hdf5=/usr/lib/x86_64-linux-gnu/hdf5/serial
|
AC_DEFINE([HAVE_HDF5], 0, [Define to 1 if HDF5 is available]) ],
|
||||||
|
[test "x$with_hdf5" != "xyes"], [
|
||||||
|
HDF5_PATH="$with_hdf5"
|
||||||
|
HDF5_LIBS="-L$HDF5_PATH/lib -lhdf5 -lhdf5_hl"
|
||||||
|
HDF5_CFLAGS="-I$HDF5_PATH/include"
|
||||||
|
AC_DEFINE([HAVE_HDF5], 1, [Define to 1 if HDF5 is available]) ],
|
||||||
|
[
|
||||||
|
PKG_CHECK_MODULES([HDF5], [hdf5 >= 1.8])
|
||||||
|
AS_IF([ test "${HDF5_LIBS}" == "" ], [
|
||||||
|
AC_CHECK_LIB([hdf5], [H5Fcreate], [ HDF5_LIBS="-lhdf5" ])
|
||||||
|
AC_CHECK_HEADER([hdf5.h], [HDF5_CFLAGS=""], [AC_MSG_ERROR([HDF5 header not found]) ])
|
||||||
|
AC_CHECK_HEADER([hdf5_hl.h], [HDF5_CFLAGS=""], [AC_MSG_ERROR([HDF5 header not found]) ])
|
||||||
|
])
|
||||||
|
AC_DEFINE([HAVE_HDF5], 1, [Define to 1 if HDF5 is available])
|
||||||
|
HDF5_LIBS="$HDF5_LIBS -lhdf5_hl"
|
||||||
|
])
|
||||||
|
|
||||||
# Configure without HDF5:
|
AM_CONDITIONAL([HAVE_HDF5],[test "x$with_hdf5" != "xno"])
|
||||||
# ./configure --without-hdf5 [or --with-hdf5=no]
|
|
||||||
|
|
||||||
|
|
||||||
PKG_HDF5=""
|
|
||||||
AX_LIB_HDF5()
|
|
||||||
|
|
||||||
if test "x${with_hdf5}" = xno; then
|
|
||||||
AC_MSG_WARN([
|
|
||||||
------------------------------------------
|
|
||||||
Configuring with the HDF5 library is
|
|
||||||
recommended to build efficient TREXIO.
|
|
||||||
------------------------------------------])
|
|
||||||
else
|
|
||||||
AC_CHECK_LIB([hdf5_hl],[main],[],[AC_MSG_ERROR(
|
|
||||||
-----------------------------------
|
|
||||||
Error: hdf5_hl library is required
|
|
||||||
-----------------------------------
|
|
||||||
)],[])ac_cv_lib_hdf5_hl=ac_cv_lib_hdf5_hl_main
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
AC_SUBST([HDF5_LDFLAGS])
|
||||||
|
AC_SUBST([HDF5_CFLAGS])
|
||||||
|
AC_SUBST([HDF5_CPPFLAGS])
|
||||||
CFLAGS="${HDF5_CFLAGS} ${CFLAGS}"
|
CFLAGS="${HDF5_CFLAGS} ${CFLAGS}"
|
||||||
CPPFLAGS="${HDF5_CPPFLAGS} ${CPPFLAGS}"
|
|
||||||
LDFLAGS="${HDF5_LDFLAGS} ${LDFLAGS}"
|
|
||||||
LIBS="${HDF5_LIBS} ${LIBS}"
|
LIBS="${HDF5_LIBS} ${LIBS}"
|
||||||
|
|
||||||
# Check if HDF5 is available with pkg-config.
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES([HDF5], [hdf5 >= 1.8], [
|
|
||||||
PKG_HDF5="hdf5"
|
|
||||||
],[
|
|
||||||
PKG_HDF5=""
|
|
||||||
])
|
|
||||||
PKG_CFLAGS="${HDF5_CFLAGS}"
|
|
||||||
PKG_LIBS="${HDF5_LIBS}"
|
|
||||||
|
|
||||||
AC_SUBST([PKG_HDF5])
|
|
||||||
AC_SUBST([PKG_CFLAGS])
|
|
||||||
AC_SUBST([PKG_LIBS])
|
|
||||||
|
|
||||||
AM_CONDITIONAL([HAVE_HDF5],[test "$with_hdf5" = "yes"])
|
|
||||||
|
|
||||||
# The block below should only execute if the ax_lib_hdf5.m4 macro failed to find HDF5.
|
# The block below should only execute if the ax_lib_hdf5.m4 macro failed to find HDF5.
|
||||||
# It is only needed to manually build Python API because setup.py depends on HDF5.
|
# It is only needed to manually build Python API because setup.py depends on HDF5.
|
||||||
|
|
||||||
if test "$HDF5_LDFLAGS" = "" || "$HDF5_CFLAGS" = ""; then
|
#if test x"$HDF5_LDFLAGS" = "x" || x"$HDF5_CFLAGS" = "x"; then
|
||||||
HDF5_LDFLAGS="${PKG_LIBS}"
|
# AC_SUBST([HDF5_CFLAGS])
|
||||||
HDF5_CFLAGS="${PKG_CFLAGS}"
|
# AC_SUBST([HDF5_LDFLAGS])
|
||||||
AC_SUBST([HDF5_CFLAGS])
|
#fi
|
||||||
AC_SUBST([HDF5_LDFLAGS])
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Checks for typedefs, structures, and compiler characteristics.
|
# Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_TYPE_INT32_T
|
AC_TYPE_INT32_T
|
||||||
@ -286,7 +254,7 @@ AC_CONFIG_FILES([Makefile
|
|||||||
pkgconfig/trexio.pc])
|
pkgconfig/trexio.pc])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
echo \
|
AS_ECHO([ \
|
||||||
"-------------------------------------------------
|
"-------------------------------------------------
|
||||||
|
|
||||||
${PACKAGE_NAME} Version ${PACKAGE_VERSION} ${GIT_HASH} ${TREXIO_DEVEL}
|
${PACKAGE_NAME} Version ${PACKAGE_VERSION} ${GIT_HASH} ${TREXIO_DEVEL}
|
||||||
@ -309,4 +277,4 @@ where the optional <target> is:
|
|||||||
all - build C library and Fortran binding
|
all - build C library and Fortran binding
|
||||||
check - run unit tests
|
check - run unit tests
|
||||||
install - install the library
|
install - install the library
|
||||||
--------------------------------------------------"
|
--------------------------------------------------"])
|
||||||
|
@ -1,323 +0,0 @@
|
|||||||
# ===========================================================================
|
|
||||||
# https://www.gnu.org/software/autoconf-archive/ax_lib_hdf5.html
|
|
||||||
# ===========================================================================
|
|
||||||
#
|
|
||||||
# SYNOPSIS
|
|
||||||
#
|
|
||||||
# AX_LIB_HDF5([serial/parallel])
|
|
||||||
#
|
|
||||||
# DESCRIPTION
|
|
||||||
#
|
|
||||||
# This macro provides tests of the availability of HDF5 library.
|
|
||||||
#
|
|
||||||
# The optional macro argument should be either 'serial' or 'parallel'. The
|
|
||||||
# former only looks for serial HDF5 installations via h5cc. The latter
|
|
||||||
# only looks for parallel HDF5 installations via h5pcc. If the optional
|
|
||||||
# argument is omitted, serial installations will be preferred over
|
|
||||||
# parallel ones.
|
|
||||||
#
|
|
||||||
# The macro adds a --with-hdf5 option accepting one of three values:
|
|
||||||
#
|
|
||||||
# no - do not check for the HDF5 library.
|
|
||||||
# yes - do check for HDF5 library in standard locations.
|
|
||||||
# path - complete path to the HDF5 helper script h5cc or h5pcc.
|
|
||||||
#
|
|
||||||
# If HDF5 is successfully found, this macro calls
|
|
||||||
#
|
|
||||||
# AC_SUBST(HDF5_VERSION)
|
|
||||||
# AC_SUBST(HDF5_CC)
|
|
||||||
# AC_SUBST(HDF5_CFLAGS)
|
|
||||||
# AC_SUBST(HDF5_CPPFLAGS)
|
|
||||||
# AC_SUBST(HDF5_LDFLAGS)
|
|
||||||
# AC_SUBST(HDF5_LIBS)
|
|
||||||
# AC_SUBST(HDF5_FC)
|
|
||||||
# AC_SUBST(HDF5_FFLAGS)
|
|
||||||
# AC_SUBST(HDF5_FLIBS)
|
|
||||||
# AC_SUBST(HDF5_TYPE)
|
|
||||||
# AC_DEFINE(HAVE_HDF5)
|
|
||||||
#
|
|
||||||
# and sets with_hdf5="yes". Additionally, the macro sets
|
|
||||||
# with_hdf5_fortran="yes" if a matching Fortran wrapper script is found.
|
|
||||||
# Note that Autoconf's Fortran support is not used to perform this check.
|
|
||||||
# H5CC and H5FC will contain the appropriate serial or parallel HDF5
|
|
||||||
# wrapper script locations.
|
|
||||||
#
|
|
||||||
# If HDF5 is disabled or not found, this macros sets with_hdf5="no" and
|
|
||||||
# with_hdf5_fortran="no".
|
|
||||||
#
|
|
||||||
# Your configuration script can test $with_hdf to take any further
|
|
||||||
# actions. HDF5_{C,CPP,LD}FLAGS may be used when building with C or C++.
|
|
||||||
# HDF5_F{FLAGS,LIBS} should be used when building Fortran applications.
|
|
||||||
#
|
|
||||||
# To use the macro, one would code one of the following in "configure.ac"
|
|
||||||
# before AC_OUTPUT:
|
|
||||||
#
|
|
||||||
# 1) dnl Check for HDF5 support
|
|
||||||
# AX_LIB_HDF5()
|
|
||||||
#
|
|
||||||
# 2) dnl Check for serial HDF5 support
|
|
||||||
# AX_LIB_HDF5([serial])
|
|
||||||
#
|
|
||||||
# 3) dnl Check for parallel HDF5 support
|
|
||||||
# AX_LIB_HDF5([parallel])
|
|
||||||
#
|
|
||||||
# One could test $with_hdf5 for the outcome or display it as follows
|
|
||||||
#
|
|
||||||
# echo "HDF5 support: $with_hdf5"
|
|
||||||
#
|
|
||||||
# You could also for example, override the default CC in "configure.ac" to
|
|
||||||
# enforce compilation with the compiler that HDF5 uses:
|
|
||||||
#
|
|
||||||
# AX_LIB_HDF5([parallel])
|
|
||||||
# if test "$with_hdf5" = "yes"; then
|
|
||||||
# CC="$HDF5_CC"
|
|
||||||
# else
|
|
||||||
# AC_MSG_ERROR([Unable to find HDF5, we need parallel HDF5.])
|
|
||||||
# fi
|
|
||||||
#
|
|
||||||
# The HDF5_TYPE environment variable returns "parallel" or "serial",
|
|
||||||
# depending on which type of library is found.
|
|
||||||
#
|
|
||||||
# LICENSE
|
|
||||||
#
|
|
||||||
# Copyright (c) 2009 Timothy Brown <tbrown@freeshell.org>
|
|
||||||
# Copyright (c) 2010 Rhys Ulerich <rhys.ulerich@gmail.com>
|
|
||||||
#
|
|
||||||
# Copying and distribution of this file, with or without modification, are
|
|
||||||
# permitted in any medium without royalty provided the copyright notice
|
|
||||||
# and this notice are preserved. This file is offered as-is, without any
|
|
||||||
# warranty.
|
|
||||||
|
|
||||||
#serial 20
|
|
||||||
|
|
||||||
AC_DEFUN([AX_LIB_HDF5], [
|
|
||||||
|
|
||||||
AC_REQUIRE([AC_PROG_SED])
|
|
||||||
AC_REQUIRE([AC_PROG_AWK])
|
|
||||||
AC_REQUIRE([AC_PROG_GREP])
|
|
||||||
|
|
||||||
dnl Check first argument is one of the recognized values.
|
|
||||||
dnl Fail eagerly if is incorrect as this simplifies case statements below.
|
|
||||||
if test "m4_normalize(m4_default([$1],[]))" = "" ; then
|
|
||||||
: # Recognized value
|
|
||||||
elif test "m4_normalize(m4_default([$1],[]))" = "serial" ; then
|
|
||||||
: # Recognized value
|
|
||||||
elif test "m4_normalize(m4_default([$1],[]))" = "parallel"; then
|
|
||||||
: # Recognized value
|
|
||||||
else
|
|
||||||
AC_MSG_ERROR([
|
|
||||||
Unrecognized value for AX[]_LIB_HDF5 within configure.ac.
|
|
||||||
If supplied, argument 1 must be either 'serial' or 'parallel'.
|
|
||||||
])
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl Add a default --with-hdf5 configuration option.
|
|
||||||
AC_ARG_WITH([hdf5],
|
|
||||||
AS_HELP_STRING(
|
|
||||||
[--with-hdf5=[yes/no/PATH]],
|
|
||||||
m4_case(m4_normalize([$1]),
|
|
||||||
[serial], [location of h5cc for serial HDF5 configuration],
|
|
||||||
[parallel], [location of h5pcc for parallel HDF5 configuration],
|
|
||||||
[location of h5cc or h5pcc for HDF5 configuration])
|
|
||||||
),
|
|
||||||
[if test "$withval" = "no"; then
|
|
||||||
with_hdf5="no"
|
|
||||||
elif test "$withval" = "yes"; then
|
|
||||||
with_hdf5="yes"
|
|
||||||
else
|
|
||||||
with_hdf5="yes"
|
|
||||||
H5CC="$withval"
|
|
||||||
fi],
|
|
||||||
[with_hdf5="yes"]
|
|
||||||
)
|
|
||||||
|
|
||||||
dnl Set defaults to blank
|
|
||||||
HDF5_CC=""
|
|
||||||
HDF5_VERSION=""
|
|
||||||
HDF5_CFLAGS=""
|
|
||||||
HDF5_CPPFLAGS=""
|
|
||||||
HDF5_LDFLAGS=""
|
|
||||||
HDF5_LIBS=""
|
|
||||||
HDF5_FC=""
|
|
||||||
HDF5_FFLAGS=""
|
|
||||||
HDF5_FLIBS=""
|
|
||||||
HDF5_TYPE=""
|
|
||||||
|
|
||||||
dnl Try and find hdf5 compiler tools and options.
|
|
||||||
if test "$with_hdf5" = "yes"; then
|
|
||||||
if test -z "$H5CC"; then
|
|
||||||
dnl Check to see if H5CC is in the path.
|
|
||||||
AC_PATH_PROGS(
|
|
||||||
[H5CC],
|
|
||||||
m4_case(m4_normalize([$1]),
|
|
||||||
[serial], [h5cc],
|
|
||||||
[parallel], [h5pcc],
|
|
||||||
[h5cc h5pcc]),
|
|
||||||
[])
|
|
||||||
else
|
|
||||||
AC_MSG_CHECKING([Using provided HDF5 C wrapper])
|
|
||||||
AC_MSG_RESULT([$H5CC])
|
|
||||||
fi
|
|
||||||
AC_MSG_CHECKING([for HDF5 type])
|
|
||||||
AS_CASE([$H5CC],
|
|
||||||
[*h5pcc], [HDF5_TYPE=parallel],
|
|
||||||
[*h5cc], [HDF5_TYPE=serial],
|
|
||||||
[HDF5_TYPE=neither])
|
|
||||||
AC_MSG_RESULT([$HDF5_TYPE])
|
|
||||||
AC_MSG_CHECKING([for HDF5 libraries])
|
|
||||||
if test ! -f "$H5CC" || test ! -x "$H5CC"; then
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
AC_MSG_WARN(m4_case(m4_normalize([$1]),
|
|
||||||
[serial], [
|
|
||||||
Unable to locate serial HDF5 compilation helper script 'h5cc'.
|
|
||||||
Please specify --with-hdf5=<LOCATION> as the full path to h5cc.
|
|
||||||
HDF5 support is being disabled (equivalent to --with-hdf5=no).
|
|
||||||
], [parallel],[
|
|
||||||
Unable to locate parallel HDF5 compilation helper script 'h5pcc'.
|
|
||||||
Please specify --with-hdf5=<LOCATION> as the full path to h5pcc.
|
|
||||||
HDF5 support is being disabled (equivalent to --with-hdf5=no).
|
|
||||||
], [
|
|
||||||
Unable to locate HDF5 compilation helper scripts 'h5cc' or 'h5pcc'.
|
|
||||||
Please specify --with-hdf5=<LOCATION> as the full path to h5cc or h5pcc.
|
|
||||||
HDF5 support is being disabled (equivalent to --with-hdf5=no).
|
|
||||||
]))
|
|
||||||
with_hdf5="no"
|
|
||||||
with_hdf5_fortran="no"
|
|
||||||
else
|
|
||||||
dnl Get the h5cc output
|
|
||||||
HDF5_SHOW=$(eval $H5CC -show)
|
|
||||||
|
|
||||||
dnl Get the actual compiler used
|
|
||||||
HDF5_CC=$(eval $H5CC -show | head -n 1 | $AWK '{print $[]1}')
|
|
||||||
if test "$HDF5_CC" = "ccache"; then
|
|
||||||
HDF5_CC=$(eval $H5CC -show | head -n 1 | $AWK '{print $[]2}')
|
|
||||||
fi
|
|
||||||
|
|
||||||
dnl h5cc provides both AM_ and non-AM_ options
|
|
||||||
dnl depending on how it was compiled either one of
|
|
||||||
dnl these are empty. Lets roll them both into one.
|
|
||||||
|
|
||||||
dnl Look for "HDF5 Version: X.Y.Z"
|
|
||||||
HDF5_VERSION=$(eval $H5CC -showconfig | $GREP 'HDF5 Version:' \
|
|
||||||
| $AWK '{print $[]3}')
|
|
||||||
|
|
||||||
dnl A ideal situation would be where everything we needed was
|
|
||||||
dnl in the AM_* variables. However most systems are not like this
|
|
||||||
dnl and seem to have the values in the non-AM variables.
|
|
||||||
dnl
|
|
||||||
dnl We try the following to find the flags:
|
|
||||||
dnl (1) Look for "NAME:" tags
|
|
||||||
dnl (2) Look for "H5_NAME:" tags
|
|
||||||
dnl (3) Look for "AM_NAME:" tags
|
|
||||||
dnl
|
|
||||||
HDF5_tmp_flags=$(eval $H5CC -showconfig \
|
|
||||||
| $GREP 'FLAGS\|Extra libraries:' \
|
|
||||||
| $AWK -F: '{printf("%s "), $[]2}' )
|
|
||||||
|
|
||||||
dnl Find the installation directory and append include/
|
|
||||||
HDF5_tmp_inst=$(eval $H5CC -showconfig \
|
|
||||||
| $GREP 'Installation point:' \
|
|
||||||
| $AWK '{print $[]NF}' )
|
|
||||||
|
|
||||||
dnl Add this to the CPPFLAGS
|
|
||||||
HDF5_CPPFLAGS="-I${HDF5_tmp_inst}/include"
|
|
||||||
|
|
||||||
dnl Now sort the flags out based upon their prefixes
|
|
||||||
for arg in $HDF5_SHOW $HDF5_tmp_flags ; do
|
|
||||||
case "$arg" in
|
|
||||||
-I*) echo $HDF5_CPPFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \
|
|
||||||
|| HDF5_CPPFLAGS="$HDF5_CPPFLAGS $arg"
|
|
||||||
;;
|
|
||||||
-L*) echo $HDF5_LDFLAGS | $GREP -e "$arg" 2>&1 >/dev/null \
|
|
||||||
|| HDF5_LDFLAGS="$HDF5_LDFLAGS $arg"
|
|
||||||
;;
|
|
||||||
-l*) echo $HDF5_LIBS | $GREP -e "$arg" 2>&1 >/dev/null \
|
|
||||||
|| HDF5_LIBS="$HDF5_LIBS $arg"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
HDF5_LIBS="-lhdf5 $HDF5_LIBS"
|
|
||||||
AC_MSG_RESULT([yes (version $[HDF5_VERSION])])
|
|
||||||
|
|
||||||
dnl See if we can compile
|
|
||||||
AC_LANG_PUSH([C])
|
|
||||||
ax_lib_hdf5_save_CC=$CC
|
|
||||||
ax_lib_hdf5_save_CPPFLAGS=$CPPFLAGS
|
|
||||||
ax_lib_hdf5_save_LIBS=$LIBS
|
|
||||||
ax_lib_hdf5_save_LDFLAGS=$LDFLAGS
|
|
||||||
CC=$HDF5_CC
|
|
||||||
CPPFLAGS=$HDF5_CPPFLAGS
|
|
||||||
LIBS=$HDF5_LIBS
|
|
||||||
LDFLAGS=$HDF5_LDFLAGS
|
|
||||||
AC_CHECK_HEADER([hdf5.h], [ac_cv_hadf5_h=yes], [ac_cv_hadf5_h=no])
|
|
||||||
AC_CHECK_LIB([hdf5], [H5Fcreate], [ac_cv_libhdf5=yes],
|
|
||||||
[ac_cv_libhdf5=no])
|
|
||||||
if test "$ac_cv_hadf5_h" = "no" && test "$ac_cv_libhdf5" = "no" ; then
|
|
||||||
AC_MSG_WARN([Unable to compile HDF5 test program])
|
|
||||||
fi
|
|
||||||
dnl Look for HDF5's high level library
|
|
||||||
AC_CHECK_LIB([hdf5_hl], [main],[HDF5_LIBS="-lhdf5_hl $HDF5_LIBS"], [], [])
|
|
||||||
|
|
||||||
CC=$ax_lib_hdf5_save_CC
|
|
||||||
CPPFLAGS=$ax_lib_hdf5_save_CPPFLAGS
|
|
||||||
LIBS=$ax_lib_hdf5_save_LIBS
|
|
||||||
LDFLAGS=$ax_lib_hdf5_save_LDFLAGS
|
|
||||||
AC_LANG_POP([C])
|
|
||||||
|
|
||||||
AC_MSG_CHECKING([for matching HDF5 Fortran wrapper])
|
|
||||||
dnl Presume HDF5 Fortran wrapper is just a name variant from H5CC
|
|
||||||
H5FC=$(eval echo -n $H5CC | $SED -n 's/cc$/fc/p')
|
|
||||||
if test -x "$H5FC"; then
|
|
||||||
AC_MSG_RESULT([$H5FC])
|
|
||||||
with_hdf5_fortran="yes"
|
|
||||||
AC_SUBST([H5FC])
|
|
||||||
|
|
||||||
dnl Again, pry any remaining -Idir/-Ldir from compiler wrapper
|
|
||||||
for arg in `$H5FC -show`
|
|
||||||
do
|
|
||||||
case "$arg" in #(
|
|
||||||
-I*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \
|
|
||||||
|| HDF5_FFLAGS="$HDF5_FFLAGS $arg"
|
|
||||||
;;#(
|
|
||||||
-L*) echo $HDF5_FFLAGS | $GREP -e "$arg" >/dev/null \
|
|
||||||
|| HDF5_FFLAGS="$HDF5_FFLAGS $arg"
|
|
||||||
dnl HDF5 installs .mod files in with libraries,
|
|
||||||
dnl but some compilers need to find them with -I
|
|
||||||
echo $HDF5_FFLAGS | $GREP -e "-I${arg#-L}" >/dev/null \
|
|
||||||
|| HDF5_FFLAGS="$HDF5_FFLAGS -I${arg#-L}"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
dnl Make Fortran link line by inserting Fortran libraries
|
|
||||||
for arg in $HDF5_LIBS
|
|
||||||
do
|
|
||||||
case "$arg" in #(
|
|
||||||
-lhdf5_hl) HDF5_FLIBS="$HDF5_FLIBS -lhdf5hl_fortran $arg"
|
|
||||||
;; #(
|
|
||||||
-lhdf5) HDF5_FLIBS="$HDF5_FLIBS -lhdf5_fortran $arg"
|
|
||||||
;; #(
|
|
||||||
*) HDF5_FLIBS="$HDF5_FLIBS $arg"
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
else
|
|
||||||
AC_MSG_RESULT([no])
|
|
||||||
with_hdf5_fortran="no"
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_SUBST([HDF5_VERSION])
|
|
||||||
AC_SUBST([HDF5_CC])
|
|
||||||
AC_SUBST([HDF5_CFLAGS])
|
|
||||||
AC_SUBST([HDF5_CPPFLAGS])
|
|
||||||
AC_SUBST([HDF5_LDFLAGS])
|
|
||||||
AC_SUBST([HDF5_LIBS])
|
|
||||||
AC_SUBST([HDF5_FC])
|
|
||||||
AC_SUBST([HDF5_FFLAGS])
|
|
||||||
AC_SUBST([HDF5_FLIBS])
|
|
||||||
AC_SUBST([HDF5_TYPE])
|
|
||||||
AC_DEFINE([HAVE_HDF5], [1], [Defined if you have HDF5 support])
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
])
|
|
@ -1626,12 +1626,13 @@ trexio_cp(const char* source, const char* dest)
|
|||||||
|
|
||||||
back_end_t back_end_local = TREXIO_AUTO;
|
back_end_t back_end_local = TREXIO_AUTO;
|
||||||
/* Try to determine the applicable backend if the back_end argument is TREXIO_AUTO */
|
/* Try to determine the applicable backend if the back_end argument is TREXIO_AUTO */
|
||||||
#ifdef HAVE_HDF5
|
|
||||||
/* Check if the TREXIO file exists and if it is a directory */
|
/* Check if the TREXIO file exists and if it is a directory */
|
||||||
trexio_exit_code rc_text = trexio_text_inquire(source);
|
trexio_exit_code rc_text = trexio_text_inquire(source);
|
||||||
if (rc_text == TREXIO_SUCCESS) {
|
if (rc_text == TREXIO_SUCCESS) {
|
||||||
back_end_local = TREXIO_TEXT;
|
back_end_local = TREXIO_TEXT;
|
||||||
} else {
|
}
|
||||||
|
#ifdef HAVE_HDF5
|
||||||
|
else {
|
||||||
/* If not, check if it is an HDF5 file */
|
/* If not, check if it is an HDF5 file */
|
||||||
trexio_exit_code rc_hdf5 = trexio_hdf5_inquire(source);
|
trexio_exit_code rc_hdf5 = trexio_hdf5_inquire(source);
|
||||||
if (rc_hdf5 == TREXIO_SUCCESS) {
|
if (rc_hdf5 == TREXIO_SUCCESS) {
|
||||||
@ -1640,11 +1641,12 @@ trexio_cp(const char* source, const char* dest)
|
|||||||
/* File is neither a directory nor an HDF5 file -> return an error */
|
/* File is neither a directory nor an HDF5 file -> return an error */
|
||||||
return TREXIO_FILE_ERROR;
|
return TREXIO_FILE_ERROR;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
/* In the current implementation if HDF5 back end is not available - then there is only back end left */
|
|
||||||
back_end_local = TREXIO_TEXT;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
else {
|
||||||
|
return TREXIO_FILE_ERROR;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
assert (back_end_local != TREXIO_AUTO);
|
assert (back_end_local != TREXIO_AUTO);
|
||||||
|
|
||||||
if (trexio_inquire(dest) == TREXIO_SUCCESS) {
|
if (trexio_inquire(dest) == TREXIO_SUCCESS) {
|
||||||
|
34
trex.org
34
trex.org
@ -616,21 +616,21 @@ power = [
|
|||||||
AOs are defined as
|
AOs are defined as
|
||||||
|
|
||||||
\[
|
\[
|
||||||
\chi_i (\mathbf{r}) = \mathcal{N}_i\, P_{\eta(i)}(\mathbf{r})\, R_{\theta(i)} (\mathbf{r})
|
\chi_i (\mathbf{r}) = \mathcal{N}_i\, P_{\eta(i)}(\mathbf{r})\, R_{s(i)} (\mathbf{r})
|
||||||
\]
|
\]
|
||||||
|
|
||||||
where $i$ is the atomic orbital index,
|
where $i$ is the atomic orbital index,
|
||||||
$P$ encodes for either the
|
$P$ encodes for either the
|
||||||
polynomials or the spherical harmonics, $\theta(i)$ returns the
|
polynomials or the spherical harmonics, $s(i)$ returns the
|
||||||
shell on which the AO is expanded, and $\eta(i)$ denotes which
|
shell on which the AO is expanded, and $\eta(i)$ denotes which
|
||||||
angular function is chosen.
|
angular function is chosen.
|
||||||
$\mathcal{N}_i$ is a normalization factor that enables the
|
$\mathcal{N}_i$ is a normalization factor that enables the
|
||||||
possibility to have different normalization coefficients within a
|
possibility to have different normalization coefficients within a
|
||||||
shell, as in the GAMESS convention where
|
shell, as in the GAMESS convention where
|
||||||
$\mathcal{N}_{x^2} \ne \mathcal{N}_{xy}$ because
|
$\mathcal{N}_{x^2} \ne \mathcal{N}_{xy}$ because
|
||||||
\[ \left[ \iiint \left(x-X_A \right)^2 R_{\theta(i)}
|
\[ \left[ \iiint \left(x-X_A \right)^2 R_{s(i)}
|
||||||
(\mathbf{r}) dx\, dy\, dz \right]^{-1/2} \ne
|
(\mathbf{r}) dx\, dy\, dz \right]^{-1/2} \ne
|
||||||
\left[ \iiint \left( x-X_A \right) \left( y-Y_A \right) R_{\theta(i)}
|
\left[ \iiint \left( x-X_A \right) \left( y-Y_A \right) R_{s(i)}
|
||||||
(\mathbf{r}) dx\, dy\, dz \right]^{-1/2}. \]
|
(\mathbf{r}) dx\, dy\, dz \right]^{-1/2}. \]
|
||||||
|
|
||||||
In such a case, one should set the normalization of the shell (in
|
In such a case, one should set the normalization of the shell (in
|
||||||
@ -640,12 +640,12 @@ power = [
|
|||||||
introduced here should be $\frac{\mathcal{N}_{xy}}{\mathcal{N}_{z^2}}$.
|
introduced here should be $\frac{\mathcal{N}_{xy}}{\mathcal{N}_{z^2}}$.
|
||||||
|
|
||||||
#+NAME: ao
|
#+NAME: ao
|
||||||
| Variable | Type | Dimensions | Description |
|
| Variable | Type | Dimensions | Description |
|
||||||
|-----------------+---------+------------+---------------------------------|
|
|-----------------+---------+------------+--------------------------------------|
|
||||||
| ~cartesian~ | ~int~ | | ~1~: true, ~0~: false |
|
| ~cartesian~ | ~int~ | | ~1~: true, ~0~: false |
|
||||||
| ~num~ | ~dim~ | | Total number of atomic orbitals |
|
| ~num~ | ~dim~ | | Total number of atomic orbitals |
|
||||||
| ~shell~ | ~index~ | ~(ao.num)~ | basis set shell for each AO |
|
| ~shell~ | ~index~ | ~(ao.num)~ | Basis set shell for each AO |
|
||||||
| ~normalization~ | ~float~ | ~(ao.num)~ | Normalization factors |
|
| ~normalization~ | ~float~ | ~(ao.num)~ | Normalization factor $\mathcal{N}_i$ |
|
||||||
|
|
||||||
#+CALL: json(data=ao, title="ao")
|
#+CALL: json(data=ao, title="ao")
|
||||||
|
|
||||||
@ -741,7 +741,7 @@ power = [
|
|||||||
| Variable | Type | Dimensions | Description |
|
| Variable | Type | Dimensions | Description |
|
||||||
|-----------------------+----------------+---------------------------------------------------+-----------------------------------------------|
|
|-----------------------+----------------+---------------------------------------------------+-----------------------------------------------|
|
||||||
| ~eri~ | ~float sparse~ | ~(ao.num, ao.num, ao.num, ao.num)~ | Electron repulsion integrals |
|
| ~eri~ | ~float sparse~ | ~(ao.num, ao.num, ao.num, ao.num)~ | Electron repulsion integrals |
|
||||||
| ~eri_lr~ | ~float sparse~ | ~(ao.num, ao.num, ao.num, ao.num)~ | Long-range Electron repulsion integrals |
|
| ~eri_lr~ | ~float sparse~ | ~(ao.num, ao.num, ao.num, ao.num)~ | Long-range electron repulsion integrals |
|
||||||
| ~eri_cholesky_num~ | ~dim~ | | Number of Cholesky vectors for ERI |
|
| ~eri_cholesky_num~ | ~dim~ | | Number of Cholesky vectors for ERI |
|
||||||
| ~eri_cholesky~ | ~float sparse~ | ~(ao.num, ao.num, ao_2e_int.eri_cholesky_num)~ | Cholesky decomposition of the ERI |
|
| ~eri_cholesky~ | ~float sparse~ | ~(ao.num, ao.num, ao_2e_int.eri_cholesky_num)~ | Cholesky decomposition of the ERI |
|
||||||
| ~eri_lr_cholesky_num~ | ~dim~ | | Number of Cholesky vectors for long range ERI |
|
| ~eri_lr_cholesky_num~ | ~dim~ | | Number of Cholesky vectors for long range ERI |
|
||||||
@ -847,7 +847,7 @@ power = [
|
|||||||
| Variable | Type | Dimensions | Description |
|
| Variable | Type | Dimensions | Description |
|
||||||
|-----------------------+----------------+---------------------------------------------------+-----------------------------------------------|
|
|-----------------------+----------------+---------------------------------------------------+-----------------------------------------------|
|
||||||
| ~eri~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | Electron repulsion integrals |
|
| ~eri~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | Electron repulsion integrals |
|
||||||
| ~eri_lr~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | Long-range Electron repulsion integrals |
|
| ~eri_lr~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | Long-range electron repulsion integrals |
|
||||||
| ~eri_cholesky_num~ | ~dim~ | | Number of Cholesky vectors for ERI |
|
| ~eri_cholesky_num~ | ~dim~ | | Number of Cholesky vectors for ERI |
|
||||||
| ~eri_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, mo_2e_int.eri_cholesky_num)~ | Cholesky decomposition of the ERI |
|
| ~eri_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, mo_2e_int.eri_cholesky_num)~ | Cholesky decomposition of the ERI |
|
||||||
| ~eri_lr_cholesky_num~ | ~dim~ | | Number of Cholesky vectors for long range ERI |
|
| ~eri_lr_cholesky_num~ | ~dim~ | | Number of Cholesky vectors for long range ERI |
|
||||||
@ -1096,15 +1096,15 @@ power = [
|
|||||||
| ~2e_updn~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | \uparrow\downarrow component of the two-body reduced density matrix |
|
| ~2e_updn~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | \uparrow\downarrow component of the two-body reduced density matrix |
|
||||||
| ~2e_dnup~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | \downarrow\uparrow component of the two-body reduced density matrix |
|
| ~2e_dnup~ | ~float sparse~ | ~(mo.num, mo.num, mo.num, mo.num)~ | \downarrow\uparrow component of the two-body reduced density matrix |
|
||||||
| ~2e_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
|
| ~2e_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
|
||||||
| ~2e_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_cholesky_num)~ | Cholesky decomposition of the Two-body RDM (spin trace) |
|
| ~2e_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_cholesky_num)~ | Cholesky decomposition of the two-body RDM (spin trace) |
|
||||||
| ~2e_upup_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
|
| ~2e_upup_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
|
||||||
| ~2e_upup_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_upup_cholesky_num)~ | Cholesky decomposition of the Two-body RDM (\uparrow\uparrow) |
|
| ~2e_upup_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_upup_cholesky_num)~ | Cholesky decomposition of the two-body RDM (\uparrow\uparrow) |
|
||||||
| ~2e_dndn_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
|
| ~2e_dndn_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
|
||||||
| ~2e_dndn_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_dndn_cholesky_num)~ | Cholesky decomposition of the Two-body RDM (\downarrow\downarrow) |
|
| ~2e_dndn_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_dndn_cholesky_num)~ | Cholesky decomposition of the two-body RDM (\downarrow\downarrow) |
|
||||||
| ~2e_updn_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
|
| ~2e_updn_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
|
||||||
| ~2e_updn_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_updn_cholesky_num)~ | Cholesky decomposition of the Two-body RDM (\uparrow\downarrow) |
|
| ~2e_updn_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_updn_cholesky_num)~ | Cholesky decomposition of the two-body RDM (\uparrow\downarrow) |
|
||||||
| ~2e_dnup_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
|
| ~2e_dnup_cholesky_num~ | ~dim~ | | Number of Cholesky vectors |
|
||||||
| ~2e_dnup_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_dnup_cholesky_num)~ | Cholesky decomposition of the Two-body RDM (\downarrow\uparrow) |
|
| ~2e_dnup_cholesky~ | ~float sparse~ | ~(mo.num, mo.num, rdm.2e_dnup_cholesky_num)~ | Cholesky decomposition of the two-body RDM (\downarrow\uparrow) |
|
||||||
|
|
||||||
#+CALL: json(data=rdm, title="rdm")
|
#+CALL: json(data=rdm, title="rdm")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user