Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions config/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ m4_include([config/m4/iotk.m4])
m4_include([config/m4/etsf_io.m4])
m4_include([config/m4/scalapack.m4])
m4_include([config/m4/petsc_slepc.m4])
m4_include([config/m4/magma.m4])
#
AC_LANG_PUSH(Fortran)
# ============================================================================
Expand Down Expand Up @@ -279,6 +280,9 @@ ACX_LIBXC
# CUDA
AC_HAVE_CUDA
# ============================================================================
# MAGMA
AC_MAGMA_SETUP
# ============================================================================
# Prepare the REPORT file variables
ACX_REPORT()
# ============================================================================
Expand Down
9 changes: 9 additions & 0 deletions config/m4/acx_report.m4
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,14 @@ if test "$internal_libxc" = "yes" ; then
if test "$compile_libxc" = "no" ; then LIBXC_check="I"; fi
fi
#
MAGMA_check="-"
if test "$internal_magma" = "yes" ; then
if test "$compile_magma" = "yes" ; then SLEPC_check="C"; fi
if test "$compile_magma" = "no" ; then SLEPC_check="I"; fi
elif test "$enable_magma" = "yes" ; then
MAGMA_check="E"
fi
#
YDB_check="-";
if test "$enable_ydb" = "yes" ; then YDB_check="X"; fi
YPY_check="-";
Expand Down Expand Up @@ -224,6 +232,7 @@ AC_SUBST(YDB_check)
AC_SUBST(YPY_check)
#
AC_SUBST(LIBXC_check)
AC_SUBST(MAGMA_check)
AC_SUBST(MPI_check)
AC_SUBST(MPI_info)
#
Expand Down
164 changes: 164 additions & 0 deletions config/m4/magma.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
#
# Copyright (C) 2000-2022 the YAMBO team
# http://www.yambo-code.org
#
# Authors (see AUTHORS file for details): AM
#
# This file is distributed under the terms of the GNU
# General Public License. You can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation;
# either version 2, or (at your option) any later version.
#
# This program is distributed in the hope that it will
# be useful, but WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330,Boston,
# MA 02111-1307, USA or visit http://www.gnu.org/copyleft/gpl.txt.
#
AC_DEFUN([AC_MAGMA_SETUP],[
#
AC_ARG_ENABLE(magma_linalg, AS_HELP_STRING([--enable-magma-linalg],[Enable suport for the diagonalization of BSE using MAGMA. Default is no]))
#
AC_ARG_WITH(magma_libs,AS_HELP_STRING([--with-magma-libs=<libs>],[Use Magma libraries <libs>],[32]))
AC_ARG_WITH(magma_incs,AS_HELP_STRING([--with-magma-incs=<incs>],[Use Magma includes <incs>],[32]))
AC_ARG_WITH(magma_path, AS_HELP_STRING([--with-magma-path=<path>],[Path to the Magma install directory],[32]),[],[])
AC_ARG_WITH(magma_libdir,AS_HELP_STRING([--with-magma-libdir=<path>],[Path to the Magma lib directory],[32]))
AC_ARG_WITH(magma_includedir,AS_HELP_STRING([--with-magma-includedir=<path>],[Path to the Magma include directory],[32]))

#
def_magma=""
magma="no"
enable_magma="no"
internal_magma="no"
compile_magma="no"
#
if test x"$enable_magma_linalg" = "xyes"; then
enable_magma="yes";
fi
#
# MAGMA global options
#
if test x"$with_magma_libs" = "xyes" ; then
enable_magma="yes" ;
with_magma_libs="";
elif test x"$with_magma_libs" = "xno" ; then
enable_magma="no" ;
with_magma_libs="";
fi
#
if test x"$with_magma_libdir" != "x" ; then enable_magma="yes" ; fi
if test x"$with_magma_path" != "x" ; then enable_magma="yes" ; fi
if test x"$with_magma_libs" != "x" ; then enable_magma="yes" ; fi
#
# Set MAGMA LIBS and FLAGS from INPUT
#
if test -d "$with_magma_path" || test -d "$with_magma_libdir" || test x"$with_magma_libs" != "x" ; then
#
# external magma
#
if test x"$with_magma_libs" != "x" ; then AC_MSG_CHECKING([for Magma using $with_magma_libs]) ;
elif test -d "$with_magma_libdir" ; then AC_MSG_CHECKING([for Magma in $with_magma_libdir]) ;
elif test -d "$with_magma_path" ; then AC_MSG_CHECKING([for Magma in $with_magma_path]) ;
fi
#
if test -d "$with_magma_path" ; then
try_magma_libdir="$with_magma_path/lib" ;
try_magma_incdir="$with_magma_path/include" ;
fi
#
if test -d "$with_magma_libdir" ; then try_magma_libdir="$with_magma_libdir" ; fi
if test -d "$with_magma_includedir" ; then try_magma_incdir="$with_magma_includedir" ; fi
#
try_MAGMA_INCS="$IFLAG$try_magma_incdir" ;
try_MAGMA_LIBS="-L$try_magma_libdir -lmagma" ;
#
if test x"$with_magma_libs" != "x" ; then try_MAGMA_LIBS="$with_magma_libs" ; fi
if test x"$with_magma_incs" != "x" ; then try_MAGMA_INCS="$with_magma_incs" ; fi
#
if test -z "$try_MAGMA_LIBS" ; then AC_MSG_ERROR([No libs specified]) ; fi
if test -z "$try_MAGMA_INCS" ; then AC_MSG_ERROR([No include-dir specified]) ; fi
#
AC_LANG([Fortran])
#
save_fcflags="$FCFLAGS" ;
save_libs="$LIBS" ;
#
FCFLAGS="$try_MAGMA_INCS $save_fcflags";
LIBS="$try_MAGMA_LIBS $save_libs";
#
AC_COMPILE_IFELSE(AC_LANG_PROGRAM([], [
use magma
implicit none
integer :: lda
!magma_devptr_t :: dA]),
[magma=yes], [magma=no]);
#
if test "x$magma" = "xyes"; then
AC_MSG_RESULT([yes]) ;
MAGMA_INCS="$try_MAGMA_INCS" ;
MAGMA_LIBS="$try_MAGMA_LIBS" ;
compile_magma="no";
internal_magma="no";
def_magma="-D_MAGMA"
else
AC_MSG_RESULT([no]) ;
#
fi
#
FCFLAGS="$save_fcflags" ;
LIBS="$save_libs" ;
#
fi
#
# TO BE FIXED: needs internal compilation support and paths have to be corrected with GPU_SUPPORT folder
if test "x$enable_magma" = "xyes" && test "x$magma" = "xno" ; then
#
# internal magma
#
AC_MSG_CHECKING([for internal Magma library])
#
internal_magma="yes"
#
if test "x$lapack_shared" = "x1" ; then
#MAGMA_LIBS="${extlibs_path}/${FCKIND}/${FC}/lib/libmagma.so" ;
MAGMA_LIBS="" ;
else
#MAGMA_LIBS="${extlibs_path}/${FCKIND}/${FC}/lib/libmagma.a" ;
MAGMA_LIBS="" ;
fi
#MAGMA_INCS="${IFLAG}${extlibs_path}/${FCKIND}/${FC}/include" ;
MAGMA_INCS="" ;
#
magma=yes
def_magma="-D_MAGMA"
if test -e "${extlibs_path}/${FCKIND}/${FC}/lib/libmagma.a" ; then
compile_magma="no" ;
AC_MSG_RESULT([already compiled]) ;
elif test -e "${extlibs_path}/${FCKIND}/${FC}/lib/libmagma.so" ; then
compile_magma="no" ;
AC_MSG_RESULT([already compiled]) ;
else
#compile_magma="yes" ;
#AC_MSG_RESULT([to be compiled]) ;
AC_MSG_RESULT([Compatible external Magma not found/specified. Internal compilation not available yet.]) ;
compile_magma="no"
def_magma=""
enable_magma="no"
fi
#
fi
#
AC_SUBST(MAGMA_LIBS)
AC_SUBST(MAGMA_INCS)
AC_SUBST(def_magma)
AC_SUBST(enable_magma)
AC_SUBST(compile_magma)
AC_SUBST(internal_magma)
#
])
4 changes: 3 additions & 1 deletion config/mk/global/defs.mk.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ netcdf = @def_netcdf@
scalapack = @def_scalapack@
slepc = @def_slepc@
fft = @def_fft@
xcpp = @def_netcdf@ @def_mpi@ @def_fft@ @def_slepc@ @def_scalapack@ @def_compiler@ @def_dp@ @def_openmp@ @def_time_profile@ @def_memory_profile@ @def_uspp@ @def_cuda@ @def_yaml@
magma = @def_magma@
xcpp = @def_netcdf@ @def_mpi@ @def_fft@ @def_slepc@ @def_scalapack@ @def_compiler@ @def_dp@ @def_openmp@ @def_time_profile@ @def_memory_profile@ @def_uspp@ @def_cuda@ @def_yaml@ @def_magma@
p2ycpp = @PW_CPP@
keep_objs = @enable_keep_objects@
do_blacs = @compile_blacs@
Expand All @@ -33,6 +34,7 @@ do_e2y = @compile_e2y@
do_libxc = @compile_libxc@
do_petsc = @compile_petsc@
do_slepc = @compile_slepc@
do_magma = @compile_magma@
shell = @SHELL@
package_bugreport = @PACKAGE_BUGREPORT@
prefix = @prefix@
Expand Down
8 changes: 5 additions & 3 deletions config/report.in
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,10 @@
# @FFT_INCS_R@
# [@PETSC_check@] PETSC : @PETSC_LIBS_R@
# @PETSC_INCS_R@
# [@SLEPC_check@] SLEPC : @SLEPC_LIBS_R@
# [@SLEPC_check@] SLEPC : @SLEPC_LIBS_R@
# @SLEPC_INCS_R@
# [@MAGMA_check@] MAGMA : @MAGMA_LIBS@
# @MAGMA_INCS@
#
# > OTHERs
#
Expand All @@ -85,8 +87,8 @@
# FC kind = @FCKIND@ @FCVERSION@
# MPI kind= @MPIKIND@
#
# [ CPP ] @CPP@ @CPPFLAGS_yambo@ @def_netcdf@ @def_mpi@ @def_fft@ @def_slepc@ @def_scalapack@ @def_compiler@ @def_dp@ @def_openmp@ @def_time_profile@ @def_uspp@ @def_cuda@ @def_yaml@ @PW_CPP@
# [ FPP ] @FPP@ @def_netcdf@ @def_mpi@ @def_fft@ @def_slepc@ @def_scalapack@ @def_compiler@ @def_dp@ @def_openmp@ @def_time_profile@ @def_uspp@ @def_cuda@ @def_yaml@
# [ CPP ] @CPP@ @CPPFLAGS_yambo@ @def_netcdf@ @def_mpi@ @def_fft@ @def_slepc@ @def_scalapack@ @def_compiler@ @def_dp@ @def_openmp@ @def_time_profile@ @def_uspp@ @def_cuda@ @def_yaml@ @PW_CPP@ @def_magma@
# [ FPP ] @FPP@ @def_netcdf@ @def_mpi@ @def_fft@ @def_slepc@ @def_scalapack@ @def_compiler@ @def_dp@ @def_openmp@ @def_time_profile@ @def_uspp@ @def_cuda@ @def_yaml@ @def_magma@
# [ CC ] @CC@ @CFLAGS@
# [ FC ] @FC@ @FCFLAGS@ @OPENMPLIBS@ @CUDA_FLAGS@
# [ FCUF] @FCUFLAGS@ @CUDA_FLAGS@
Expand Down
2 changes: 2 additions & 0 deletions config/setup.in
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ lfutile = @FUTILE_LIBS@
ifutile = @FUTILE_INCS@
letsf = @ETSF_LIBS@
ietsf = @ETSF_INCS@
lmagma = @MAGMA_LIBS@
imagma = @MAGMA_INCS@
idriver = @DRIVER_INCS@
#
# VPATH
Expand Down
Loading