Skip to content

Commit

Permalink
bugfix: GEMMT: was broken several months ago, now fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
scivision committed Mar 28, 2024
1 parent d878253 commit 9c448a1
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 78 deletions.
14 changes: 6 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ endif()

project(MUMPS
LANGUAGES C Fortran
VERSION 5.6.2.2
VERSION 5.6.2.3
DESCRIPTION "Sparse direct parallel solver"
HOMEPAGE_URL "http://mumps-solver.org/"
)
Expand Down Expand Up @@ -51,13 +51,6 @@ if(parallel)

set(NUMERIC_LIBS SCALAPACK::SCALAPACK LAPACK::LAPACK)

if(find_static AND NOT WIN32 AND
MKL IN_LIST LAPACK_VENDOR AND
CMAKE_VERSION VERSION_GREATER_EQUAL 3.24
)
set(NUMERIC_LIBS $<LINK_GROUP:RESCAN,${NUMERIC_LIBS}>)
endif()

# avoid MPICH -fallow flag leakage
set(NUMERIC_INC ${MPI_Fortran_INCLUDE_DIRS})
list(APPEND NUMERIC_LIBS ${MPI_Fortran_LIBRARIES} MPI::MPI_C)
Expand All @@ -70,6 +63,11 @@ else()
include(cmake/lapack.cmake)
endif()

# GEMMT is recommeded in MUMPS User Manual if available
if(gemmt)
include(cmake/gemmt.cmake)
endif()

# --- ordering libs

set(ORDERING_LIBS)
Expand Down
59 changes: 59 additions & 0 deletions cmake/gemmt.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
include(CheckSourceCompiles)

if(TARGET MKL::MKL)
set(CMAKE_REQUIRED_LIBRARIES MKL::MKL)
else()
set(CMAKE_REQUIRED_LIBRARIES LAPACK::LAPACK)
endif()

if(BUILD_DOUBLE)
check_source_compiles(Fortran
"program check
use, intrinsic :: iso_fortran_env, only : real64
implicit none
external :: dgemmt
real(real64), dimension(2,2) :: A, B, C
CALL DGEMMT( 'U', 'N', 'T', 2 , 1 , 1._real64 , A , 2 , B , 2 , 1._real64 , C , 2 )
end program"
BLAS_HAVE_dGEMMT
)
endif()

if(BUILD_SINGLE)
check_source_compiles(Fortran
"program check
use, intrinsic :: iso_fortran_env, only : real32
implicit none
external :: sgemmt
real(real32), dimension(2,2) :: A, B, C
CALL SGEMMT( 'U', 'N', 'T', 2 , 1 , 1._real32 , A , 2 , B , 2 , 1._real32 , C , 2 )
end program"
BLAS_HAVE_sGEMMT
)
endif()

if(BUILD_COMPLEX)
check_source_compiles(Fortran
"program check
use, intrinsic :: iso_fortran_env, only : real32
implicit none
external :: cgemmt
complex(real32), dimension(2,2) :: A, B, C
CALL CGEMMT( 'U', 'N', 'T', 2 , 1 , 1._real32 , A , 2 , B , 2 , 1._real32 , C , 2 )
end program"
BLAS_HAVE_cGEMMT
)
endif()

if(BUILD_COMPLEX16)
check_source_compiles(Fortran
"program check
use, intrinsic :: iso_fortran_env, only : real64
implicit none
external :: zgemmt
complex(real64), dimension(2,2) :: A, B, C
CALL ZGEMMT( 'U', 'N', 'T', 2 , 1 , 1._real64 , A , 2 , B , 2 , 1._real64 , C , 2 )
end program"
BLAS_HAVE_zGEMMT
)
endif()
70 changes: 0 additions & 70 deletions cmake/lapack.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Handle options for finding LAPACK

include(CheckSourceCompiles)

if(NOT DEFINED LAPACK_VENDOR AND DEFINED ENV{MKLROOT})
set(LAPACK_VENDOR MKL)
endif()
Expand All @@ -11,71 +9,3 @@ if(find_static)
endif()

find_package(LAPACK REQUIRED COMPONENTS ${LAPACK_VENDOR})

# GEMMT is recommeded in MUMPS User Manual if available
if(gemmt)

set(CMAKE_REQUIRED_INCLUDES ${LAPACK_INCLUDE_DIRS})

if(find_static AND NOT WIN32 AND
MKL IN_LIST LAPACK_VENDOR AND
CMAKE_VERSION VERSION_GREATER_EQUAL 3.24
)
set(CMAKE_REQUIRED_LIBRARIES $<LINK_GROUP:RESCAN,${LAPACK_LIBRARIES}>)
else()
set(CMAKE_REQUIRED_LIBRARIES ${LAPACK_LIBRARIES})
endif()

if(BUILD_DOUBLE)
check_source_compiles(Fortran
"program check
use, intrinsic :: iso_fortran_env, only : real64
implicit none
external :: dgemmt
real(real64), dimension(2,2) :: A, B, C
CALL DGEMMT( 'U', 'N', 'T', 2 , 1 , 1._real64 , A , 2 , B , 2 , 1._real64 , C , 2 )
end program"
BLAS_HAVE_dGEMMT
)
endif()

if(BUILD_SINGLE)
check_source_compiles(Fortran
"program check
use, intrinsic :: iso_fortran_env, only : real32
implicit none
external :: sgemmt
real(real32), dimension(2,2) :: A, B, C
CALL SGEMMT( 'U', 'N', 'T', 2 , 1 , 1._real32 , A , 2 , B , 2 , 1._real32 , C , 2 )
end program"
BLAS_HAVE_sGEMMT
)
endif()

if(BUILD_COMPLEX)
check_source_compiles(Fortran
"program check
use, intrinsic :: iso_fortran_env, only : real32
implicit none
external :: cgemmt
complex(real32), dimension(2,2) :: A, B, C
CALL CGEMMT( 'U', 'N', 'T', 2 , 1 , 1._real32 , A , 2 , B , 2 , 1._real32 , C , 2 )
end program"
BLAS_HAVE_cGEMMT
)
endif()

if(BUILD_COMPLEX16)
check_source_compiles(Fortran
"program check
use, intrinsic :: iso_fortran_env, only : real64
implicit none
external :: zgemmt
complex(real64), dimension(2,2) :: A, B, C
CALL ZGEMMT( 'U', 'N', 'T', 2 , 1 , 1._real64 , A , 2 , B , 2 , 1._real64 , C , 2 )
end program"
BLAS_HAVE_zGEMMT
)
endif()

endif(gemmt)

0 comments on commit 9c448a1

Please sign in to comment.