SLATE build updates

This commit is contained in:
Peter Boyle
2026-08-25 15:33:07 -04:00
parent 0a81a41729
commit d42d1855c2
2 changed files with 50 additions and 13 deletions
+44 -7
View File
@@ -80,12 +80,26 @@ AC_CHECK_DECLS([be64toh],[], [], [[#include <arpa/inet.h>]])
AC_CHECK_LIB([m],[cos]) AC_CHECK_LIB([m],[cos])
AC_CHECK_LIB([stdc++],[abort]) AC_CHECK_LIB([stdc++],[abort])
############## SLATE ############## SLATE (+ BLAS++ / LAPACK++, which SLATE's headers include)
# All three may live in different prefixes (e.g. Frontier: site blaspp under
# /sw, self-built lapackpp/slate under spack); blaspp/lapackpp default to the
# slate prefix. Both lib and lib64 are searched (spack uses lib on macOS,
# lib64 on Frontier).
AC_ARG_WITH([slate], AC_ARG_WITH([slate],
[AS_HELP_STRING([--with-slate=prefix], [AS_HELP_STRING([--with-slate=prefix],
[try this for a non-standard install prefix of the SLATE library])], [try this for a non-standard install prefix of the SLATE library])],
[AM_CXXFLAGS="-I$with_slate/include $AM_CXXFLAGS"] [AM_CXXFLAGS="-I$with_slate/include $AM_CXXFLAGS"]
[AM_LDFLAGS="-L$with_slate/lib64 $AM_LDFLAGS"]) [AM_LDFLAGS="-L$with_slate/lib -L$with_slate/lib64 $AM_LDFLAGS"])
AC_ARG_WITH([blaspp],
[AS_HELP_STRING([--with-blaspp=prefix],
[install prefix of BLAS++ (default: the SLATE prefix)])],
[AM_CXXFLAGS="-I$with_blaspp/include $AM_CXXFLAGS"]
[AM_LDFLAGS="-L$with_blaspp/lib -L$with_blaspp/lib64 $AM_LDFLAGS"])
AC_ARG_WITH([lapackpp],
[AS_HELP_STRING([--with-lapackpp=prefix],
[install prefix of LAPACK++ (default: the SLATE prefix)])],
[AM_CXXFLAGS="-I$with_lapackpp/include $AM_CXXFLAGS"]
[AM_LDFLAGS="-L$with_lapackpp/lib -L$with_lapackpp/lib64 $AM_LDFLAGS"])
############### GMP and MPFR ############### GMP and MPFR
AC_ARG_WITH([gmp], AC_ARG_WITH([gmp],
@@ -415,11 +429,33 @@ AC_SEARCH_LIBS([fftw_execute], [fftw3],
[AC_DEFINE([HAVE_FFTW], [1], [Define to 1 if you have the `FFTW' library])] [AC_DEFINE([HAVE_FFTW], [1], [Define to 1 if you have the `FFTW' library])]
[have_fftw=true]) [have_fftw=true])
AC_SEARCH_LIBS([slate_init], [slate], ############### SLATE
[AC_SEARCH_LIBS([slate_init], [slate], [], # libslate exports no C-linkage symbols (all mangled C++), so AC_SEARCH_LIBS
[AC_MSG_ERROR("SLATE library not found")])] # cannot probe it. Link a real C++ call, slate::version(), with the full
[AC_DEFINE([HAVE_SLATE], [1], [Define to 1 if you have the `SLATE' library])] # -lslate -llapackpp -lblaspp chain; MPI comes from CXX=mpicxx.
[have_slate=true]) # Only attempted when --with-slate is given: SLATE is optional and heavy.
have_slate=false
if test "x$with_slate" != "x"; then
AC_MSG_CHECKING([for SLATE (slate::version)])
ac_save_LIBS="$LIBS"
ac_save_CXXFLAGS="$CXXFLAGS"
ac_save_LDFLAGS="$LDFLAGS"
LIBS="-lslate -llapackpp -lblaspp $LIBS"
CXXFLAGS="$AM_CXXFLAGS $CXXFLAGS"
LDFLAGS="$AM_LDFLAGS $LDFLAGS"
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <slate/slate.hh>]],
[[return slate::version() > 0 ? 0 : 1;]])],
[have_slate=true
AC_DEFINE([HAVE_SLATE], [1], [Define to 1 if you have the SLATE library])
AC_MSG_RESULT([yes])],
[LIBS="$ac_save_LIBS"
AC_MSG_RESULT([no])
AC_MSG_ERROR([--with-slate given but SLATE (with BLAS++/LAPACK++) failed to link; check --with-blaspp/--with-lapackpp])])
CXXFLAGS="$ac_save_CXXFLAGS"
LDFLAGS="$ac_save_LDFLAGS"
fi
AM_CONDITIONAL(BUILD_SLATE, [ test "${have_slate}X" == "trueX" ])
AC_SEARCH_LIBS([limeCreateReader], [lime], AC_SEARCH_LIBS([limeCreateReader], [lime],
[AC_DEFINE([HAVE_LIME], [1], [Define to 1 if you have the `LIME' library])] [AC_DEFINE([HAVE_LIME], [1], [Define to 1 if you have the `LIME' library])]
@@ -899,6 +935,7 @@ GMP : `if test "x$have_gmp" = xtrue; then echo yes; else
LAPACK : ${ac_LAPACK} LAPACK : ${ac_LAPACK}
FFTW : `if test "x$have_fftw" = xtrue; then echo yes; else echo no; fi` FFTW : `if test "x$have_fftw" = xtrue; then echo yes; else echo no; fi`
LIME (ILDG support) : `if test "x$have_lime" = xtrue; then echo yes; else echo no; fi` LIME (ILDG support) : `if test "x$have_lime" = xtrue; then echo yes; else echo no; fi`
SLATE : `if test "x$have_slate" = xtrue; then echo yes; else echo no; fi`
HDF5 : `if test "x$have_hdf5" = xtrue; then echo yes; else echo no; fi` HDF5 : `if test "x$have_hdf5" = xtrue; then echo yes; else echo no; fi`
build DOXYGEN documentation : `if test "$DX_FLAG_doc" = '1'; then echo yes; else echo no; fi` build DOXYGEN documentation : `if test "$DX_FLAG_doc" = '1'; then echo yes; else echo no; fi`
Sp2n : ${ac_ENABLE_SP} Sp2n : ${ac_ENABLE_SP}
+6 -6
View File
@@ -40,9 +40,9 @@ Author: Peter Boyle <pboyle@bnl.gov>
// LU with partial pivoting then getri; Grid is pivot-free recursive Schur. // LU with partial pivoting then getri; Grid is pivot-free recursive Schur.
// //
// Build: needs SLATE (spack load slate) and // Build: needs SLATE (spack load slate) and
// CXXFLAGS += -DGRID_HAVE_SLATE -I$SLATE_ROOT/include // CXXFLAGS += -DHAVE_SLATE -I$SLATE_ROOT/include
// LDFLAGS += -L$SLATE_ROOT/lib -lslate -lblaspp -llapackpp // LDFLAGS += -L$SLATE_ROOT/lib -lslate -lblaspp -llapackpp
// Without GRID_HAVE_SLATE the SLATE leg reports itself as not built and the // Without HAVE_SLATE the SLATE leg reports itself as not built and the
// Grid leg still runs, so the binary is always usable. // Grid leg still runs, so the binary is always usable.
// //
// MPI threading: the SLATE build initialises MPI at MPI_THREAD_MULTIPLE before // MPI threading: the SLATE build initialises MPI at MPI_THREAD_MULTIPLE before
@@ -61,7 +61,7 @@ Author: Peter Boyle <pboyle@bnl.gov>
#include <Grid/Grid.h> #include <Grid/Grid.h>
#include <Grid/algorithms/multigrid/BlockCyclicSchurInverse.h> #include <Grid/algorithms/multigrid/BlockCyclicSchurInverse.h>
#include <Grid/algorithms/multigrid/BlockCyclicRedistribute.h> #include <Grid/algorithms/multigrid/BlockCyclicRedistribute.h>
#ifdef GRID_HAVE_SLATE #ifdef HAVE_SLATE
#include <slate/slate.hh> #include <slate/slate.hh>
#endif #endif
@@ -104,7 +104,7 @@ static double Certify(GridBase *grid, BlockCyclicMatrix &A0, BlockCyclicMatrix &
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
#ifdef GRID_HAVE_SLATE #ifdef HAVE_SLATE
// SLATE issues MPI calls from concurrent OpenMP tasks and needs // SLATE issues MPI calls from concurrent OpenMP tasks and needs
// MPI_THREAD_MULTIPLE. Grid (GridStd.h #undef GRID_COMMS_THREADS) only asks // MPI_THREAD_MULTIPLE. Grid (GridStd.h #undef GRID_COMMS_THREADS) only asks
// for MPI_THREAD_SERIALIZED, which reproducibly gives Bus errors inside // for MPI_THREAD_SERIALIZED, which reproducibly gives Bus errors inside
@@ -170,7 +170,7 @@ int main(int argc, char **argv)
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// LEG 2: SLATE, every layout step timed and charged. // LEG 2: SLATE, every layout step timed and charged.
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
#ifdef GRID_HAVE_SLATE #ifdef HAVE_SLATE
{ {
typedef std::complex<double> scalar_t; typedef std::complex<double> scalar_t;
acceleratorCopyToDevice(&h[0], &rows1d[0], h.size()*sizeof(ComplexD)); acceleratorCopyToDevice(&h[0], &rows1d[0], h.size()*sizeof(ComplexD));
@@ -233,7 +233,7 @@ int main(int argc, char **argv)
<< " certificate " << cert << std::endl; << " certificate " << cert << std::endl;
} }
#else #else
std::cout << GridLogMessage << "SLATE : leg not built (compile with -DGRID_HAVE_SLATE and link -lslate -lblaspp -llapackpp)" << std::endl; std::cout << GridLogMessage << "SLATE : leg not built (compile with -DHAVE_SLATE and link -lslate -lblaspp -llapackpp)" << std::endl;
#endif #endif
Grid_finalize(); Grid_finalize();