Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tech magma #102

Open
wants to merge 38 commits into
base: tech-master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
55d2c93
added configure support for magma libraries. support for internal lib…
nicspalla Mar 22, 2023
b632ebb
Merge branch 'develop' into tech/magma
andrea-ferretti Apr 22, 2023
ffc7c5e
cuda compilation fixed
andrea-ferretti Apr 24, 2023
44a8287
Revert "cuda compilation fixed"
andrea-ferretti Apr 24, 2023
0c0b01e
Version 5.1.0, Revision 22124, Hash 407f3a474
andrea-ferretti Apr 24, 2023
71a1f06
tentative implementation of interface to magma_Xgeev_m (X=z,c)
andrea-ferretti Apr 24, 2023
6191ff3
compilation without magma fixed
andrea-ferretti Apr 24, 2023
31b3b05
thread safeness added to magma interfaces
andrea-ferretti Apr 24, 2023
c0c2016
Magma implementation for diagonalization (overwrites serial implement…
blmelp Jul 6, 2023
fa88a5d
Changed magma functions to multiple gpu version (with 2 gpus hardcoded)
blmelp Dec 4, 2023
7e29bf1
Merge remote-tracking branch 'yambo-devel/tech/magma' into tech/magma
andrea-ferretti Dec 4, 2023
20369f3
tentaitve fix to magma interfaces (see comments by blmelp,
andrea-ferretti Feb 6, 2024
b626a0b
Merge branch 'tech-master' into tech-magma
sangallidavide Jun 21, 2024
e37be73
Version 5.2.0, Revision 23239, Hash b626a0b2cb
sangallidavide Jun 21, 2024
51fa725
Merge branch 'tech-master' into tech-magma
sangallidavide Jun 25, 2024
8a9239a
Merge branch 'tech-master' into tech-magma
sangallidavide Jul 17, 2024
6b225c7
Version 5.2.0, Revision 23297, Hash 8a9239ac3d
sangallidavide Jul 18, 2024
9fb845e
Merge branch 'tech-master' into tech-magma
sangallidavide Jul 18, 2024
7175ddd
Merge branch 'tech-master' into tech-magma
sangallidavide Aug 1, 2024
2e17f6a
Version 5.2.0, Revision 23307, Hash 7175ddda6a
sangallidavide Aug 1, 2024
fdc73fc
Version 5.2.0, Revision 23308, Hash 2e17f6a970
sangallidavide Aug 1, 2024
385b494
Merge branch 'tech-master' into tech-magma
sangallidavide Sep 8, 2024
cbaae15
Merge branch 'tech-master' into tech-magma
sangallidavide Oct 11, 2024
5718781
Merge remote-tracking branch 'blmelp/valencia_magma' into tech-magma
sangallidavide Oct 11, 2024
f156c7a
Version 5.2.0, Revision 23323, Hash 57187815cf
sangallidavide Oct 14, 2024
fde0c4f
Merge branch 'tech-master' into tech-magma
sangallidavide Oct 14, 2024
cbf592b
Version 5.2.0, Revision 23469, Hash fde0c4f549
sangallidavide Oct 14, 2024
27b3538
Version 5.2.0, Revision 23470, Hash cbf592b6b7
sangallidavide Oct 14, 2024
5485636
Version 5.2.0, Revision 23471, Hash 27b3538f80
sangallidavide Oct 15, 2024
0d6c6f2
Version 5.2.0, Revision 23472, Hash 5485636137
sangallidavide Oct 15, 2024
51031ad
Merge branch 'tech-master' into tech-magma
sangallidavide Oct 23, 2024
51abc57
Merge branch 'tech-master' into tech-magma
sangallidavide Nov 21, 2024
16ce88f
Version 5.3.0, Revision 23898, Hash 54a4f5c593
sangallidavide Dec 20, 2024
955a380
Version 5.3.0, Revision 23899, Hash 16ce88f8e
attacc Jan 8, 2025
4ebc854
Version 5.3.0, Revision 23900, Hash 955a38080
attacc Jan 8, 2025
d12e5de
Version 5.3.0, Revision 23901, Hash 4ebc8546f
attacc Jan 8, 2025
cd9518e
Version 5.3.0, Revision 23900, Hash e51825f30d
sangallidavide Jan 13, 2025
c98b509
Merge branch 'master' into tech-magma
sangallidavide Jan 20, 2025
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 @@ -254,6 +254,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])
m4_include([config/m4/libcuda.m4])
m4_include([config/m4/device_xlib.m4])
#
Expand Down Expand Up @@ -305,6 +306,9 @@ AC_SET_GPU
# Device XLIB
ACX_DEVXLIB
# ============================================================================
# MAGMA
AC_MAGMA_SETUP
# ============================================================================
# Prepare the REPORT file variables
ACX_REPORT()
# ============================================================================
Expand Down
23 changes: 23 additions & 0 deletions config/m4/acx_report.m4
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,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 MAGMA_check="C"; fi
if test "$compile_magma" = "no" ; then MAGMA_check="I"; fi
elif test "$enable_magma" = "yes" ; then
MAGMA_check="E"
fi
#
DEVXLIB_check="E"
if test "$internal_devxlib" = "yes" ; then
if test "$compile_devxlib" = "yes"; then DEVXLIB_check="C"; fi
Expand Down Expand Up @@ -229,6 +237,7 @@ AC_SUBST(YDB_check)
AC_SUBST(YPY_check)
#
AC_SUBST(LIBXC_check)
AC_SUBST(MAGMA_check)
AC_SUBST(DEVXLIB_check)
AC_SUBST(LIBCUDA_check)
AC_SUBST(MPI_check)
Expand Down Expand Up @@ -313,6 +322,13 @@ SCALAPACK_INCS_R=$STRIPE
AC_SUBST(SCALAPACK_LIBS_R)
AC_SUBST(SCALAPACK_INCS_R)
#
ACX_STRIPE_SUBPATH($MAGMA_LIBS,"LIB")
MAGMA_LIBS_R=$STRIPE
ACX_STRIPE_SUBPATH($MAGMA_INCS,"INC")
MAGMA_INCS_R=$STRIPE
AC_SUBST(MAGMA_LIBS_R)
AC_SUBST(MAGMA_INCS_R)
#
ACX_STRIPE_SUBPATH($BLACS_LIBS,"LIB")
BLACS_LIBS_R=$STRIPE
ACX_STRIPE_SUBPATH($BLACS_INCS,"INC")
Expand All @@ -334,6 +350,13 @@ SLEPC_INCS_R=$STRIPE
AC_SUBST(SLEPC_LIBS_R)
AC_SUBST(SLEPC_INCS_R)
#
ACX_STRIPE_SUBPATH($MAGMA_LIBS,"LIB")
MAGMA_LIBS_R=$STRIPE
ACX_STRIPE_SUBPATH($MAGMA_INCS,"INC")
MAGMA_INCS_R=$STRIPE
AC_SUBST(MAGMA_LIBS_R)
AC_SUBST(MAGMA_INCS_R)
#
ACX_STRIPE_SUBPATH($LIBXC_LIBS,"LIB")
LIBXC_LIBS_R=$STRIPE
ACX_STRIPE_SUBPATH($LIBXC_INCS,"INC")
Expand Down
182 changes: 182 additions & 0 deletions config/m4/magma.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
#
# 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"
compile_magma_fmodules="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" ;
compile_magma_fmodules="yes" ;
with_magma_libs="";
elif test x"$with_magma_libs" = "xno" ; then
enable_magma="no" ;
compile_magma_fmodules="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" ;
#fi
MAGMA_INCS="${IFLAG}${extlibs_path}/${FCKIND}/${FC}/include" ;
#
magma=yes
def_magma="-D_MAGMA"
if test -e "${extlibs_path}/${FCKIND}/${FC}/lib/libmagma.a" ; then
compile_magma="no" ;
compile_magma_fmodules="no" ;
AC_MSG_RESULT([already compiled]) ;
elif test -e "${extlibs_path}/${FCKIND}/${FC}/lib/libmagma.so" ; then
compile_magma="no" ;
compile_magma_fmodules="no" ;
AC_MSG_RESULT([already compiled]) ;
else
compile_magma="yes" ;
compile_magma_fmodules="no" ;
AC_MSG_RESULT([Compatible external Magma not found/specified. To be compiled.]) ;
fi
#
fi
#
# Check if fortran modules are available
#
if test -e "$MAGMA_INCS/mod_magma2_common.F" ; then compile_magma_fmodules="no" ; fi
#
# switch off internal magma compilation
#
deactivate_internal=no
if test "x$compile_magma" = "xyes" && test "x$internal_magma" = "xyes" && test "x$deactivate_internal" = "xyes" ; then
AC_MSG_RESULT([Internal Magma compilation not available yet. Deactivating it.]) ;
compile_magma="no"
def_magma=""
enable_magma="no"
MAGMA_INCS="" ;
MAGMA_LIBS="" ;
fi
#
AC_SUBST(MAGMA_LIBS)
AC_SUBST(MAGMA_INCS)
AC_SUBST(def_magma)
AC_SUBST(enable_magma)
AC_SUBST(compile_magma)
AC_SUBST(compile_magma_fmodules)
AC_SUBST(internal_magma)
#
])
4 changes: 2 additions & 2 deletions config/m4/netcdf_f90.m4
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,9 @@ if test -d "$with_netcdf_path" || test -d "$with_netcdf_libdir" ; then
fi
#
try_NETCDF_LIBS="-L$try_netcdf_libdir -lnetcdf" ;
if test -r $try_netcdff_libdir/libnetcdff.a ; then
if test -r $try_netcdff_libdir/libnetcdff.a || test -r $try_netcdff_libdir/libnetcdff.so ; then
try_NETCDFF_LIBS="-L$try_netcdff_libdir -lnetcdff" ;
elif test -r $try_netcdf_libdir/libnetcdff.a ; then
elif test -r $try_netcdf_libdir/libnetcdff.a || test -r $try_netcdf_libdir/libnetcdff.so ; then
try_NETCDFF_LIBS="-L$try_netcdf_libdir -lnetcdff" ;
fi
#
Expand Down
2 changes: 2 additions & 0 deletions config/mk/global/actions/compile_external_libraries.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ blacs: scalapack
@if test "$(do_blacs)" = yes ; then LIBS="blacs" ; BASE="lib"; $(MAKE) $(MAKEFLAGS) blacs-dl; $(mk_external_lib); fi
scalapack: lapack
@if test "$(do_slk)" = yes ; then LIBS="scalapack" ; BASE="lib"; $(MAKE) $(MAKEFLAGS) scalapack-dl ; $(mk_external_lib); fi
magma: lapack
@if test "$(do_magma)" = yes ; then LIBS="magma" ; BASE="lib"; $(MAKE) $(MAKEFLAGS) magma-dl ; $(mk_external_lib); fi
petsc:
@if test "$(do_petsc)" = yes ; then LIBS="petsc" ; BASE="lib"; $(MAKE) $(MAKEFLAGS) petsc-dl; $(mk_external_lib); fi
slepc: petsc
Expand Down
4 changes: 3 additions & 1 deletion config/mk/global/actions/compile_internal_libraries.mk
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Copyright (C) 2020 The Yambo Team
#
# Authors (see AUTHORS file for details): AM
# Authors (see AUTHORS file for details): AM DS
#
qe_pseudo:
@+LIBS="qe_pseudo"; BASE="lib" ; ADF="$(STAMP_DBLE)"; LAB=""; $(todo_lib); $(mk_lib)
Expand All @@ -13,3 +13,5 @@ math77:
@+LIBS="math77"; BASE="lib" ; ADF="$(STAMP_DBLE)"; LAB=""; $(todo_lib); $(mk_lib)
local:
@+LIBS="local" ; BASE="lib" ; ADF="$(STAMP_DBLE)"; LAB=""; $(todo_lib); $(mk_lib)
magma_fmodules:
@+LIBS="magma_fmodules"; BASE="lib" ; ADF="$(STAMP_DBLE)"; LAB=""; $(todo_lib); $(mk_lib)
2 changes: 2 additions & 0 deletions config/mk/global/actions/download_external_libraries.mk
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ blacs-dl:
@LIB2DO="blacs"; $(get_external_libraries)
scalapack-dl:
@LIB2DO="scalapack"; $(get_external_libraries)
magma-dl:
@LIB2DO="magma"; $(get_external_libraries)
petsc-dl:
@LIB2DO="petsc"; $(get_external_libraries)
slepc-dl:
Expand Down
5 changes: 4 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_gpu@ @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_gpu@ @def_yaml@ @def_magma@
p2ycpp = @PW_CPP@
keep_objs = @enable_keep_objects@
do_blacs = @compile_blacs@
Expand All @@ -33,6 +34,8 @@ do_libxc = @compile_libxc@
do_devxlib = @compile_devxlib@
do_petsc = @compile_petsc@
do_slepc = @compile_slepc@
do_magma = @compile_magma@
do_magma_fmodules = @compile_magma_fmodules@
shell = @SHELL@
package_bugreport = @PACKAGE_BUGREPORT@
prefix = @prefix@
Expand Down
6 changes: 5 additions & 1 deletion config/mk/global/libraries.mk
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ ifeq ($(wildcard config/mk/global/defs.mk),config/mk/global/defs.mk)
endif
include lib/archive/package.list
#
INT_LIBS = qe_pseudo slatec math77 local
ifeq ($(do_magma_fmodules),yes)
INT_LIBS = qe_pseudo slatec math77 local magma_fmodules
else
INT_LIBS = qe_pseudo slatec math77 local
endif
YAMBO_INT_LIBS= Yio
YLIBIO = modules Yio
YLIBIO_LD = $(YLIBIO)
Expand Down
6 changes: 4 additions & 2 deletions config/report.in
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
# @PETSC_INCS_R@
# [@SLEPC_check@] SLEPC : @SLEPC_LIBS_R@
# @SLEPC_INCS_R@
# [@MAGMA_check@] MAGMA : @MAGMA_LIBS_R@
# @MAGMA_INCS_R@ (fortran modules to be compiled: @compile_magma_fmodules@)
#
# > OTHERs: @DEVXLIB_info@
#
Expand All @@ -82,8 +84,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_gpu@ @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_gpu@ @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_gpu@ @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_gpu@ @def_yaml@ @def_magma@
# [ CC ] @CC@ @CFLAGS@
# [ FC ] @FC@ @FCFLAGS@ @OPENMPLIBS@ @GPU_FLAGS@
# [ FCUF] @FCUFLAGS@ @GPU_FLAGS@
Expand Down
2 changes: 2 additions & 0 deletions config/setup.in
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ lfutile = @FUTILE_LIBS@
ifutile = @FUTILE_INCS@
letsf = @ETSF_LIBS@
ietsf = @ETSF_INCS@
lmagma = @MAGMA_LIBS@
imagma = @MAGMA_INCS@
mpipath = @MPI_PATH@
#
# VPATH
Expand Down
Loading