Skip to content

Commit

Permalink
Correct ScaLAPACK naming convention for generalised eigenvalue solver (
Browse files Browse the repository at this point in the history
…#16)

Co-authored-by: Mikael Simberg <mikael.simberg@iki.fi>
  • Loading branch information
RMeli and msimberg authored Jun 26, 2024
1 parent 985487d commit 73a28ec
Show file tree
Hide file tree
Showing 12 changed files with 59 additions and 54 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## DLA-Future-Fortran X.Y.Z

### Changed

* Name of the generalized eigenvalue solver from `*gvx` to `*gvd` [PR #16]

### Fixed

* Spack installation with `+test` variant by setting `-DMPIEXEC_MAX_NUMPROCS=6` [PR #10]
Expand Down
2 changes: 1 addition & 1 deletion ci/ci-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ stages:
reports:
dotenv: build.env
variables:
SPACK_SHA: develop-2024-06-02
SPACK_SHA: 05c7ff4595a4e574cbcf45475c626b9b94c22af1
SPACK_BUILDCACHE: develop-2024-06-02
SPACK_DLAF_FORTRAN_REPO: ./spack
DOCKER_BUILD_ARGS: '[
Expand Down
2 changes: 1 addition & 1 deletion ci/docker/build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ RUN spack external find \
# Enable Spack build cache
ARG SPACK_BUILDCACHE
RUN spack mirror add ${SPACK_BUILDCACHE} https://binaries.spack.io/${SPACK_BUILDCACHE}
RUN spack buildcache keys --install --trust
RUN spack buildcache keys --install --trust --force

# Add custom Spack repo
ARG SPACK_DLAF_FORTRAN_REPO
Expand Down
3 changes: 2 additions & 1 deletion spack/packages/dla-future-fortran/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ class DlaFutureFortran(CMakePackage):
generator("ninja")
depends_on("cmake@3.22:", type="build")

depends_on("dla-future@0.4.1: +scalapack")
depends_on("dla-future@0.4.1:0.5 +scalapack", when="@0.1.0")
depends_on("dla-future@0.6.0: +scalapack", when="@0.2.0:")
depends_on("dla-future +shared", when="+shared")

depends_on("mpi", when="+test")
Expand Down
50 changes: 25 additions & 25 deletions src/dlaf_fortran.f90
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module dlaf_fortran
public :: dlaf_create_grid_from_blacs, dlaf_free_grid
public :: dlaf_pspotrf, dlaf_pdpotrf, dlaf_pcpotrf, dlaf_pzpotrf
public :: dlaf_pssyevd, dlaf_pdsyevd, dlaf_pcheevd, dlaf_pzheevd
public :: dlaf_pssygvx, dlaf_pdsygvx, dlaf_pchegvx, dlaf_pzhegvx
public :: dlaf_pssygvd, dlaf_pdsygvd, dlaf_pchegvd, dlaf_pzhegvd

contains

Expand Down Expand Up @@ -337,7 +337,7 @@ end subroutine dlaf_pzheevd_c

end subroutine dlaf_pzheevd

subroutine dlaf_pssygvx(uplo, n, a, ia, ja, desca, b, ib, jb, descb, w, z, iz, jz, descz, info)
subroutine dlaf_pssygvd(uplo, n, a, ia, ja, desca, b, ib, jb, descb, w, z, iz, jz, descz, info)
character, intent(in) :: uplo
integer, intent(in) :: n, ia, ja, ib, jb, iz, jz
integer, dimension(9), intent(in) :: desca, descb, descz
Expand All @@ -346,8 +346,8 @@ subroutine dlaf_pssygvx(uplo, n, a, ia, ja, desca, b, ib, jb, descb, w, z, iz, j
real(kind=sp), dimension(:), target, intent(out) :: w

interface
subroutine dlaf_pssygvx_c(uplo_, n_, a_, ia_, ja_, desca_, b_, ib_, jb_, descb_, w_, z_, iz_, jz_, descz_, info_) &
bind(C, name='dlaf_pssygvx')
subroutine dlaf_pssygvd_c(uplo_, n_, a_, ia_, ja_, desca_, b_, ib_, jb_, descb_, w_, z_, iz_, jz_, descz_, info_) &
bind(C, name='dlaf_pssygvd')

import :: c_int, c_ptr, c_signed_char

Expand All @@ -356,22 +356,22 @@ subroutine dlaf_pssygvx_c(uplo_, n_, a_, ia_, ja_, desca_, b_, ib_, jb_, descb_,
type(c_ptr), value :: a_, b_, w_, z_
integer(kind=c_int), dimension(9) :: desca_, descb_, descz_
type(c_ptr), value :: info_
end subroutine dlaf_pssygvx_c
end subroutine dlaf_pssygvd_c
end interface

info = -1

call dlaf_pssygvx_c(iachar(uplo, c_signed_char), n, &
call dlaf_pssygvd_c(iachar(uplo, c_signed_char), n, &
c_loc(a(1, 1)), ia, ja, desca, &
c_loc(b(1, 1)), ib, jb, descb, &
c_loc(w(1)), &
c_loc(z(1, 1)), iz, jz, descz, &
c_loc(info) &
)

end subroutine dlaf_pssygvx
end subroutine dlaf_pssygvd

subroutine dlaf_pdsygvx(uplo, n, a, ia, ja, desca, b, ib, jb, descb, w, z, iz, jz, descz, info)
subroutine dlaf_pdsygvd(uplo, n, a, ia, ja, desca, b, ib, jb, descb, w, z, iz, jz, descz, info)
character, intent(in) :: uplo
integer, intent(in) :: n, ia, ja, ib, jb, iz, jz
integer, dimension(9), intent(in) :: desca, descb, descz
Expand All @@ -380,8 +380,8 @@ subroutine dlaf_pdsygvx(uplo, n, a, ia, ja, desca, b, ib, jb, descb, w, z, iz, j
real(kind=dp), dimension(:), target, intent(out) :: w

interface
subroutine dlaf_pdsygvx_c(uplo_, n_, a_, ia_, ja_, desca_, b_, ib_, jb_, descb_, w_, z_, iz_, jz_, descz_, info_) &
bind(C, name='dlaf_pdsygvx')
subroutine dlaf_pdsygvd_c(uplo_, n_, a_, ia_, ja_, desca_, b_, ib_, jb_, descb_, w_, z_, iz_, jz_, descz_, info_) &
bind(C, name='dlaf_pdsygvd')

import :: c_int, c_ptr, c_signed_char

Expand All @@ -390,22 +390,22 @@ subroutine dlaf_pdsygvx_c(uplo_, n_, a_, ia_, ja_, desca_, b_, ib_, jb_, descb_,
type(c_ptr), value :: a_, b_, w_, z_
integer(kind=c_int), dimension(9) :: desca_, descb_, descz_
type(c_ptr), value :: info_
end subroutine dlaf_pdsygvx_c
end subroutine dlaf_pdsygvd_c
end interface

info = -1

call dlaf_pdsygvx_c(iachar(uplo, c_signed_char), n, &
call dlaf_pdsygvd_c(iachar(uplo, c_signed_char), n, &
c_loc(a(1, 1)), ia, ja, desca, &
c_loc(b(1, 1)), ib, jb, descb, &
c_loc(w(1)), &
c_loc(z(1, 1)), iz, jz, descz, &
c_loc(info) &
)

end subroutine dlaf_pdsygvx
end subroutine dlaf_pdsygvd

subroutine dlaf_pchegvx(uplo, n, a, ia, ja, desca, b, ib, jb, descb, w, z, iz, jz, descz, info)
subroutine dlaf_pchegvd(uplo, n, a, ia, ja, desca, b, ib, jb, descb, w, z, iz, jz, descz, info)
character, intent(in) :: uplo
integer, intent(in) :: n, ia, ja, ib, jb, iz, jz
integer, dimension(9), intent(in) :: desca, descb, descz
Expand All @@ -414,8 +414,8 @@ subroutine dlaf_pchegvx(uplo, n, a, ia, ja, desca, b, ib, jb, descb, w, z, iz, j
real(kind=sp), dimension(:), target, intent(out) :: w

interface
subroutine dlaf_pchegvx_c(uplo_, n_, a_, ia_, ja_, desca_, b_, ib_, jb_, descb_, w_, z_, iz_, jz_, descz_, info_) &
bind(C, name='dlaf_pchegvx')
subroutine dlaf_pchegvd_c(uplo_, n_, a_, ia_, ja_, desca_, b_, ib_, jb_, descb_, w_, z_, iz_, jz_, descz_, info_) &
bind(C, name='dlaf_pchegvd')

import :: c_int, c_ptr, c_signed_char

Expand All @@ -424,22 +424,22 @@ subroutine dlaf_pchegvx_c(uplo_, n_, a_, ia_, ja_, desca_, b_, ib_, jb_, descb_,
type(c_ptr), value :: a_, b_, w_, z_
integer(kind=c_int), dimension(9) :: desca_, descb_, descz_
type(c_ptr), value :: info_
end subroutine dlaf_pchegvx_c
end subroutine dlaf_pchegvd_c
end interface

info = -1

call dlaf_pchegvx_c(iachar(uplo, c_signed_char), n, &
call dlaf_pchegvd_c(iachar(uplo, c_signed_char), n, &
c_loc(a(1, 1)), ia, ja, desca, &
c_loc(b(1, 1)), ib, jb, descb, &
c_loc(w(1)), &
c_loc(z(1, 1)), iz, jz, descz, &
c_loc(info) &
)

end subroutine dlaf_pchegvx
end subroutine dlaf_pchegvd

subroutine dlaf_pzhegvx(uplo, n, a, ia, ja, desca, b, ib, jb, descb, w, z, iz, jz, descz, info)
subroutine dlaf_pzhegvd(uplo, n, a, ia, ja, desca, b, ib, jb, descb, w, z, iz, jz, descz, info)
character, intent(in) :: uplo
integer, intent(in) :: n, ia, ja, ib, jb, iz, jz
integer, dimension(9), intent(in) :: desca, descb, descz
Expand All @@ -448,8 +448,8 @@ subroutine dlaf_pzhegvx(uplo, n, a, ia, ja, desca, b, ib, jb, descb, w, z, iz, j
real(kind=dp), dimension(:), target, intent(out) :: w

interface
subroutine dlaf_pzhegvx_c(uplo_, n_, a_, ia_, ja_, desca_, b_, ib_, jb_, descb_, w_, z_, iz_, jz_, descz_, info_) &
bind(C, name='dlaf_pzhegvx')
subroutine dlaf_pzhegvd_c(uplo_, n_, a_, ia_, ja_, desca_, b_, ib_, jb_, descb_, w_, z_, iz_, jz_, descz_, info_) &
bind(C, name='dlaf_pzhegvd')

import :: c_int, c_ptr, c_signed_char

Expand All @@ -458,19 +458,19 @@ subroutine dlaf_pzhegvx_c(uplo_, n_, a_, ia_, ja_, desca_, b_, ib_, jb_, descb_,
type(c_ptr), value :: a_, b_, w_, z_
integer(kind=c_int), dimension(9) :: desca_, descb_, descz_
type(c_ptr), value :: info_
end subroutine dlaf_pzhegvx_c
end subroutine dlaf_pzhegvd_c
end interface

info = -1

call dlaf_pzhegvx_c(iachar(uplo, c_signed_char), n, &
call dlaf_pzhegvd_c(iachar(uplo, c_signed_char), n, &
c_loc(a(1, 1)), ia, ja, desca, &
c_loc(b(1, 1)), ib, jb, descb, &
c_loc(w(1)), &
c_loc(z(1, 1)), iz, jz, descz, &
c_loc(info) &
)

end subroutine dlaf_pzhegvx
end subroutine dlaf_pzhegvd

end module dlaf_fortran
4 changes: 2 additions & 2 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
set(INIT_TEST_EXECUTABLES init)
set(PXPOTRF_TEST_EXECUTABLES pspotrf pdpotrf pcpotrf pzpotrf)
set(PXHEEVD_TEST_EXECUTABLES pssyevd pdsyevd pcheevd pzheevd)
set(PXHEGVX_TEST_EXECUTABLES pssygvx pdsygvx pchegvx pzhegvx)
set(PXHEGVX_TEST_EXECUTABLES pssygvd pdsygvd pchegvd pzhegvd)


find_program(FYPP_PROGRAM fypp)
Expand Down Expand Up @@ -60,4 +60,4 @@ endfunction()
add_tests("${INIT_TEST_EXECUTABLES}" "")
add_tests("${PXPOTRF_TEST_EXECUTABLES}" pxpotrf)
add_tests("${PXHEEVD_TEST_EXECUTABLES}" pxheevd)
add_tests("${PXHEGVX_TEST_EXECUTABLES}" pxhegvx)
add_tests("${PXHEGVX_TEST_EXECUTABLES}" pxhegvd)
2 changes: 1 addition & 1 deletion test/helpers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# SPDX-License-Identifier: BSD-3-Clause
#

set(fyppFiles pxpotrf.fypp pxheevd.fypp pxhegvx.fypp)
set(fyppFiles pxpotrf.fypp pxheevd.fypp pxhegvd.fypp)

foreach(infileName IN LISTS fyppFiles)

Expand Down
14 changes: 7 additions & 7 deletions test/helpers/pxhegvx.fypp → test/helpers/pxhegvd.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
#:set types = ['real', 'complex']
#:set names = {('sp', 'real'): 'ssy', ('sp', 'complex'): 'che', ('dp', 'real'): 'dsy', ('dp', 'complex'): 'zhe'}
#:set symbols = {('sp', 'real'): 's', ('sp', 'complex'): 'c', ('dp', 'real'): 'd', ('dp', 'complex'): 'z'}
module pxhegvx_tests
module pxhegvd_tests
use iso_fortran_env, only: error_unit, sp => real32, dp => real64
use dlaf_fortran, only: dlaf_initialize, dlaf_finalize, dlaf_create_grid_from_blacs, dlaf_free_grid
#:for dtype in precision
#:for type in types
#:set name = names[(dtype, type)]
use dlaf_fortran, only: dlaf_p${name}$gvx
use dlaf_fortran, only: dlaf_p${name}$gvd
#:endfor
#:endfor

Expand All @@ -39,7 +39,7 @@ module pxhegvx_tests
#:for dtype in precision
#:for type in types
#:set name = names[(dtype, type)]
public :: p${name}$gvx_test
public :: p${name}$gvd_test
#:endfor
#:endfor

Expand All @@ -49,7 +49,7 @@ contains
#:for type in types
#:set name = names[(dtype, type)]
#:set symbol = symbols[(dtype, type)]
subroutine p${name}$gvx_test
subroutine p${name}$gvd_test

integer, parameter :: n = 4

Expand Down Expand Up @@ -142,7 +142,7 @@ contains
! Solve with DLAF
call dlaf_initialize()
call dlaf_create_grid_from_blacs(ictxt)
call dlaf_p${name}$gvx( &
call dlaf_p${name}$gvd( &
'L', &
n, A_local_dlaf, 1, 1, desca_local_dlaf, &
B_local_dlaf, 1, 1, descb_local_dlaf, &
Expand Down Expand Up @@ -246,8 +246,8 @@ contains
call blacs_gridexit(ictxt)
call blacs_exit(1)
call teardown_mpi()
end subroutine p${name}$gvx_test
end subroutine p${name}$gvd_test

#:endfor
#:endfor
end module pxhegvx_tests
end module pxhegvd_tests
8 changes: 4 additions & 4 deletions test/pzhegvx.f90 → test/pchegvd.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
! SPDX-License-Identifier: BSD-3-Clause
!

program test_pzhegvx
use pxhegvx_tests, only: pzhegvx_test
program test_pchegvd
use pxhegvd_tests, only: pchegvd_test

implicit none

call pzhegvx_test()
call pchegvd_test()

end program test_pzhegvx
end program test_pchegvd
8 changes: 4 additions & 4 deletions test/pchegvx.f90 → test/pdsygvd.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
! SPDX-License-Identifier: BSD-3-Clause
!

program test_pchegvx
use pxhegvx_tests, only: pchegvx_test
program test_pdsygvd
use pxhegvd_tests, only: pdsygvd_test

implicit none

call pchegvx_test()
call pdsygvd_test()

end program test_pchegvx
end program test_pdsygvd
8 changes: 4 additions & 4 deletions test/pdsygvx.f90 → test/pssygvd.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
! SPDX-License-Identifier: BSD-3-Clause
!

program test_pdsygvx
use pxhegvx_tests, only: pdsygvx_test
program test_pssygvd
use pxhegvd_tests, only: pssygvd_test

implicit none

call pdsygvx_test()
call pssygvd_test()

end program test_pdsygvx
end program test_pssygvd
8 changes: 4 additions & 4 deletions test/pssygvx.f90 → test/pzhegvd.f90
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
! SPDX-License-Identifier: BSD-3-Clause
!

program test_pssygvx
use pxhegvx_tests, only: pssygvx_test
program test_pzhegvd
use pxhegvd_tests, only: pzhegvd_test

implicit none

call pssygvx_test()
call pzhegvd_test()

end program test_pssygvx
end program test_pzhegvd

0 comments on commit 73a28ec

Please sign in to comment.