1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-11-19 20:42:50 +01:00

Cleaned qmckl_dgemm integration

This commit is contained in:
Anthony Scemama 2022-09-22 16:43:57 +02:00
parent 8c388a93b7
commit 858bdbf7f4
2 changed files with 22 additions and 10 deletions

View File

@ -113,10 +113,13 @@ AC_FC_FREEFORM
AC_PROG_INSTALL AC_PROG_INSTALL
AC_PROG_LN_S AC_PROG_LN_S
PKG_PROG_PKG_CONFIG([]) PKG_PROG_PKG_CONFIG([])
PKG_LIBS=
PKG_CFLAGS=
# Checks for libraries. # Checks for libraries.
PKG_LIBS=""
PKG_CFLAGS=""
PKG_LIBS2=""
PKG_CFLAGS2=""
AC_FC_LIBRARY_LDFLAGS AC_FC_LIBRARY_LDFLAGS
AC_CHECK_LIB([m], [sqrt]) AC_CHECK_LIB([m], [sqrt])
AC_CHECK_HEADERS([assert.h errno.h math.h pthread.h stdbool.h stdint.h stdio.h stdlib.h string.h]) AC_CHECK_HEADERS([assert.h errno.h math.h pthread.h stdbool.h stdint.h stdio.h stdlib.h string.h])
@ -144,7 +147,7 @@ fi
# yes) # yes)
# PKG_CHECK_MODULES([LIBCHAMELEON],[chameleon >= 1.0.0], # PKG_CHECK_MODULES([LIBCHAMELEON],[chameleon >= 1.0.0],
# [PKG_CFLAGS="$PKG_CFLAGS $LIBCHAMELEON_CFLAGS" # [PKG_CFLAGS="$PKG_CFLAGS $LIBCHAMELEON_CFLAGS"
# PKG_LIBS="$PKG_LIBS $LIBCHAMELEON_LIBS"] # PKG_LIBS2="$PKG_LIBS2 $LIBCHAMELEON_LIBS"]
# ,[ # ,[
# #
# ## something went wrong. # ## something went wrong.
@ -197,14 +200,16 @@ AS_CASE([$with_trexio],
[AC_MSG_ERROR([--with-trexio=$withval: argument is not a directory])]) [AC_MSG_ERROR([--with-trexio=$withval: argument is not a directory])])
TREXIO_LIBS="-L$with_trexio/lib -ltrexio" TREXIO_LIBS="-L$with_trexio/lib -ltrexio"
TREXIO_CFLAGS="-I$with_trexio/include" TREXIO_CFLAGS="-I$with_trexio/include"
CFLAGS="$CFLAGS $TREXIO_CFLAGS"
LIBS="$LIBS $TREXIO_LIBS"
AC_CHECK_HEADERS([trexio.h], [], AC_CHECK_HEADERS([trexio.h], [],
[AC_MSG_ERROR("trexio.h not found")]) [AC_MSG_ERROR("trexio.h not found")])
AC_DEFINE([HAVE_TREXIO], [1], [Define if TREXIO support is available]) AC_DEFINE([HAVE_TREXIO], [1], [Define if TREXIO support is available])
ARGS="${ARGS} trexio" ARGS="${ARGS} trexio"
]) ])
PKG_CFLAGS="$PKG_CFLAGS $TREXIO_CFLAGS" PKG_CFLAGS2="$PKG_CFLAGS2 $TREXIO_CFLAGS"
PKG_LIBS="$PKG_LIBS $TREXIO_LIBS" PKG_LIBS2="$PKG_LIBS2 $TREXIO_LIBS"
# QMCKLDGEMM # QMCKLDGEMM
AC_ARG_WITH([qmckldgemm], AC_ARG_WITH([qmckldgemm],
@ -218,20 +223,25 @@ AS_CASE([$with_qmckldgemm],
[yes], [yes],
[AC_CHECK_LIB([qmckldgemm], [qmckl_packed_matrix_create], [], [AC_CHECK_LIB([qmckldgemm], [qmckl_packed_matrix_create], [],
[PKG_CHECK_MODULES([QMCKLDGEMM], [qmckldgemm]) ]) [PKG_CHECK_MODULES([QMCKLDGEMM], [qmckldgemm]) ])
# AC_CHECK_HEADERS([qmckldgemm.h], [], AC_CHECK_HEADERS([qmckl_dgemm.h], [],
# [AC_MSG_ERROR("qmckldgemm.h not found")]) [AC_MSG_ERROR("qmckl_dgemm.h not found")])
AC_DEFINE([HAVE_QMCKLDGEMM], [1], [Define if QMCKL DGEMM support is available]) AC_DEFINE([HAVE_QMCKLDGEMM], [1], [Define if QMCKL DGEMM support is available])
ARGS="${ARGS} qmckldgemm"], ARGS="${ARGS} qmckldgemm"],
[AS_IF([test ! -d "$withval"], [AS_IF([test ! -d "$withval"],
[AC_MSG_ERROR([--with-qmckldgemm=$withval: argument is not a directory])]) [AC_MSG_ERROR([--with-qmckldgemm=$withval: argument is not a directory])])
QMCKLDGEMM_LIBS="-L$with_qmckldgemm/lib -lqmckldgemm" QMCKLDGEMM_LIBS="-L$with_qmckldgemm/lib -lqmckldgemm"
QMCKLDGEMM_CFLAGS="-I$with_qmckldgemm/include" QMCKLDGEMM_CFLAGS="-I$with_qmckldgemm/include"
# AC_CHECK_HEADERS([qmckldgemm.h], [], CFLAGS="$CFLAGS $QMCKLDGEMM_CFLAGS"
# [AC_MSG_ERROR("qmckldgemm.h not found")]) LIBS="$LIBS $QMCKLDGEMM_LIBS"
echo $CFLAGS
AC_CHECK_HEADERS([qmckl_dgemm.h], [],
[AC_MSG_ERROR("qmckl_dgemm.h not found")])
AC_DEFINE([HAVE_QMCKLDGEMM], [1], [Define if QMCKL DGEMM support is available]) AC_DEFINE([HAVE_QMCKLDGEMM], [1], [Define if QMCKL DGEMM support is available])
ARGS="${ARGS} qmckldgemm" ARGS="${ARGS} qmckldgemm"
]) ])
PKG_CFLAGS2="$PKG_CFLAGS2 $QMCKLDGEMM_CFLAGS"
PKG_LIBS2="$PKG_LIBS2 $QMCKLDGEMM_LIBS"
## BLAS ## BLAS
AX_BLAS([], [AC_MSG_ERROR([BLAS was not found.])]) AX_BLAS([], [AC_MSG_ERROR([BLAS was not found.])])
@ -443,6 +453,8 @@ AS_IF([test "x${QMCKL_DEVEL}" != "x"], [
PKG_LIBS="$PKG_LIBS $LIBS" PKG_LIBS="$PKG_LIBS $LIBS"
LIBS="$BLAS_LIBS $LAPACK_LIBS $PKG_LIBS" LIBS="$BLAS_LIBS $LAPACK_LIBS $PKG_LIBS"
CFLAGS="$CFLAGS $PKG_CFLAGS" CFLAGS="$CFLAGS $PKG_CFLAGS"
PKG_LIBS="$PKG_LIBS $PKG_LIBS2"
PKG_CFLAGS="$PKG_CFLAGS $PKG_CFLAGS2"
AC_SUBST([PKG_LIBS]) AC_SUBST([PKG_LIBS])
AC_SUBST([PKG_CFLAGS]) AC_SUBST([PKG_CFLAGS])
AC_SUBST([HAS_CPPCHECK]) AC_SUBST([HAS_CPPCHECK])

View File

@ -8270,7 +8270,7 @@ rc = qmckl_get_jastrow_dtmp_c(context, &(dtmp_c[0][0][0][0][0][0]));
printf("%e\n%e\n", tmp_c[0][0][1][0][0], 2.7083473948352403); printf("%e\n%e\n", tmp_c[0][0][1][0][0], 2.7083473948352403);
assert(fabs(tmp_c[0][0][1][0][0] - 2.7083473948352403) < 1e-12); assert(fabs(tmp_c[0][0][1][0][0] - 2.7083473948352403) < 1e-12);
printf("%e\n%e\n", tmp_c[0][1][0][0][0],0.237440520852232); printf("%e\n%e\n", dtmp_c[0][1][0][0][0][0],0.237440520852232);
assert(fabs(dtmp_c[0][1][0][0][0][0] - 0.237440520852232) < 1e-12); assert(fabs(dtmp_c[0][1][0][0][0][0] - 0.237440520852232) < 1e-12);
#+end_src #+end_src