Skip to content

Commit 090b5ae

Browse files
authored
Merge pull request #218 from Copper280z/feat/metis
Use METIS ordering for superlu
2 parents cf75fe2 + 59da5ae commit 090b5ae

1,908 files changed

Lines changed: 52112 additions & 51786 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitmodules

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,15 @@
1111
ignore = all
1212
update = checkout
1313
branch = master
14+
[submodule "metis/GKlib"]
15+
path = metis/GKlib
16+
url = https://github.com/KarypisLab/GKlib.git
17+
ignore = all
18+
update = checkout
19+
branch = master
20+
[submodule "metis/METIS"]
21+
path = metis/METIS
22+
url = https://github.com/KarypisLab/METIS.git
23+
ignore = all
24+
update = checkout
25+
branch = master

CMakeLists.txt

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ if(NOT DEFINED CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
4545
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE INTERNAL "No dev warnings")
4646
endif()
4747

48+
# build static libraries throughout this tree
49+
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libraries" FORCE)
50+
4851
# recommend the appropriate make command
4952
if(WIN32)
5053
set(RECOMMENDED_MAKE "mingw32-make")
@@ -76,8 +79,67 @@ if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
7679
endif()
7780

7881
set(SUPERLU_DIR "${PROJECT_SOURCE_DIR}/superlu")
82+
set(SUPERLU_PATCHES_DIR "${PROJECT_SOURCE_DIR}/superlu_patches")
7983
set(SUPERLU_MT_DIR "${PROJECT_SOURCE_DIR}/superlu_mt")
80-
set(SUPERLU_PATCHES_DIR "${PROJECT_SOURCE_DIR}/superlu_mt_patches")
84+
set(SUPERLU_MT_PATCHES_DIR "${PROJECT_SOURCE_DIR}/superlu_mt_patches")
85+
set(METIS_DIR "${PROJECT_SOURCE_DIR}/metis/METIS")
86+
set(GKLIB_DIR "${PROJECT_SOURCE_DIR}/metis/GKlib")
87+
set(METIS_PATCHES_DIR "${PROJECT_SOURCE_DIR}/metis/metis_patches")
88+
89+
if(NOT DEFINED TPL_ENABLE_METISLIB)
90+
set(TPL_ENABLE_METISLIB ON CACHE BOOL "Enable METIS for SuperLU")
91+
endif()
92+
if(TPL_ENABLE_METISLIB)
93+
if(NOT EXISTS "${GKLIB_DIR}/CMakeLists.txt")
94+
message(FATAL_ERROR "The GKlib submodule was not downloaded.")
95+
endif()
96+
if(NOT EXISTS "${METIS_DIR}/CMakeLists.txt")
97+
message(FATAL_ERROR "The METIS submodule was not downloaded.")
98+
endif()
99+
100+
message(STATUS "Applying patches to METIS...")
101+
file(GLOB_RECURSE METIS_PATCH_FILES RELATIVE "${METIS_PATCHES_DIR}" "${METIS_PATCHES_DIR}/*")
102+
103+
foreach(file IN LISTS METIS_PATCH_FILES)
104+
set(src "${METIS_PATCHES_DIR}/${file}")
105+
set(dst "${METIS_DIR}/${file}")
106+
107+
get_filename_component(dst_dir "${dst}" DIRECTORY)
108+
file(MAKE_DIRECTORY "${dst_dir}")
109+
110+
message(STATUS " Patching: ${file}")
111+
file(COPY "${src}" DESTINATION "${dst_dir}")
112+
endforeach()
113+
114+
message(STATUS "METIS patched.")
115+
116+
set(SHARED OFF CACHE BOOL "Build vendored GKlib/METIS as static libraries" FORCE)
117+
set(GKLIB_BUILD_APPS OFF CACHE BOOL "Build GKlib applications" FORCE)
118+
set(METIS_BUILD_PROGRAMS OFF CACHE BOOL "Build METIS command line programs" FORCE)
119+
set(GKLIB_PATH "${GKLIB_DIR}" CACHE PATH "GKlib source directory" FORCE)
120+
121+
add_subdirectory("${GKLIB_DIR}" "${CMAKE_BINARY_DIR}/metis/GKlib")
122+
add_subdirectory("${METIS_DIR}" "${CMAKE_BINARY_DIR}/metis/METIS")
123+
124+
set(TPL_METIS_LIBRARIES "${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libmetis.a;${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libGKlib.a" CACHE STRING "METIS static libraries" FORCE)
125+
set(TPL_METIS_INCLUDE_DIRS "${CMAKE_BINARY_DIR}/metis/METIS/include" CACHE PATH "METIS include directory" FORCE)
126+
127+
message(STATUS "Applying patches to SUPERLU...")
128+
file(GLOB_RECURSE SUPERLU_PATCH_FILES RELATIVE "${SUPERLU_PATCHES_DIR}" "${SUPERLU_PATCHES_DIR}/*")
129+
130+
foreach(file IN LISTS SUPERLU_PATCH_FILES)
131+
set(src "${SUPERLU_PATCHES_DIR}/${file}")
132+
set(dst "${SUPERLU_DIR}/${file}")
133+
134+
get_filename_component(dst_dir "${dst}" DIRECTORY)
135+
file(MAKE_DIRECTORY "${dst_dir}")
136+
137+
message(STATUS " Patching: ${file}")
138+
file(COPY "${src}" DESTINATION "${dst_dir}")
139+
endforeach()
140+
141+
message(STATUS "SUPERLU patched for METIS")
142+
endif()
81143

82144
set(enable_examples OFF FORCE)
83145
set(enable_tests OFF FORCE)
@@ -87,10 +149,10 @@ if(USE_SUPERLU_MT)
87149
message(STATUS "Will link against faster SuperLU_MT.")
88150
set(PLAT "_OPENMP" CACHE STRING "threading flavor _PTHREAD/_OPENMP" FORCE)
89151
message(STATUS "Applying patches to SuperLU_MT...")
90-
file(GLOB_RECURSE PATCH_FILES RELATIVE "${SUPERLU_PATCHES_DIR}" "${SUPERLU_PATCHES_DIR}/*")
152+
file(GLOB_RECURSE PATCH_FILES RELATIVE "${SUPERLU_MT_PATCHES_DIR}" "${SUPERLU_MT_PATCHES_DIR}/*")
91153

92154
foreach(file IN LISTS PATCH_FILES)
93-
set(src "${SUPERLU_PATCHES_DIR}/${file}")
155+
set(src "${SUPERLU_MT_PATCHES_DIR}/${file}")
94156
set(dst "${SUPERLU_MT_DIR}/${file}")
95157

96158
# ensure the destination directory exists
@@ -150,6 +212,9 @@ else()
150212

151213
include_directories("${SUPERLU_DIR}/SRC")
152214
add_subdirectory(${SUPERLU_DIR})
215+
if(TPL_ENABLE_METISLIB)
216+
add_dependencies(superlu metis GKlib)
217+
endif()
153218
set(SLU_DRIVER "${SUPERLU_DIR}/FORTRAN/c_fortran_dgssv.c")
154219
endif()
155220

Source/ARPACK/ARPACK_INFO_MSG.f90

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
! ##################################################################################################################################
2-
! Begin MIT license text.
2+
! Begin MIT license text.
33
! _______________________________________________________________________________________________________
4-
5-
! Copyright 2022 Dr William R Case, Jr (mystransolver@gmail.com)
6-
7-
! Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
4+
5+
! Copyright 2022 Dr William R Case, Jr (mystransolver@gmail.com)
6+
7+
! Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
88
! associated documentation files (the "Software"), to deal in the Software without restriction, including
99
! without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
! copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
11-
! the following conditions:
12-
13-
! The above copyright notice and this permission notice shall be included in all copies or substantial
14-
! portions of the Software and documentation.
15-
16-
! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17-
! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22-
! THE SOFTWARE.
10+
! copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
11+
! the following conditions:
12+
13+
! The above copyright notice and this permission notice shall be included in all copies or substantial
14+
! portions of the Software and documentation.
15+
16+
! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17+
! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
! THE SOFTWARE.
2323
! _______________________________________________________________________________________________________
24-
25-
! End MIT license text.
24+
25+
! End MIT license text.
2626

2727
SUBROUTINE ARPACK_INFO_MSG ( SUBNAME, INFO, IPARAM, LWORKL, NEV, NCV )
2828

@@ -84,7 +84,7 @@ SUBROUTINE ARPACK_INFO_MSG ( SUBNAME, INFO, IPARAM, LWORKL, NEV, NCV )
8484

8585

8686
IF ((SUBNAME == 'DSAUPD') .OR. (SUBNAME == 'dsaupd')) THEN
87-
87+
8888
IF (INFO == 1) THEN ! MSG( 2)
8989

9090
ERROR_NUM = ' 7101'
@@ -417,7 +417,7 @@ SUBROUTINE ARPACK_INFO_MSG ( SUBNAME, INFO, IPARAM, LWORKL, NEV, NCV )
417417
! **********************************************************************************************************************************
418418
100 FORMAT(' *INFORMATION: THE FOLLOWING MESSAGE WAS FOUND BY ARPACK SUBR ',A,' CALLED BY ARPACK DRIVER DSBAND IN ',A, &
419419
' SUBR EIG_LANCZOS.' &
420-
,/,14X,' IT RELATES TO AN ERROR, LISTED BELOW, FOR ARPACK "INFO" = ',I6,' IN THE LANCZOS EIGENVALUE METHOD:',/)
420+
,/,14X,' IT RELATES TO AN ERROR, LISTED BELOW, FOR ARPACK "INFO" = ',I6,' IN THE LANCZOS EIGENVALUE METHOD:',/)
421421

422422
710 FORMAT(' *ERROR ',A,': PROGRAMMING ERROR IN SUBROUTINE ',A &
423423
,/,14X,' FOR LANCZOS EIGENVALUE EXTRACTION WITH ARPACK "INFO" = ',I6,':' &

Source/EMG/EMG1/CHECK_TE_MATRIX.f90

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
! ##################################################################################################################################
2-
! Begin MIT license text.
2+
! Begin MIT license text.
33
! _______________________________________________________________________________________________________
4-
5-
! Copyright 2022 Dr William R Case, Jr (mystransolver@gmail.com)
6-
7-
! Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
4+
5+
! Copyright 2022 Dr William R Case, Jr (mystransolver@gmail.com)
6+
7+
! Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
88
! associated documentation files (the "Software"), to deal in the Software without restriction, including
99
! without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10-
! copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
11-
! the following conditions:
12-
13-
! The above copyright notice and this permission notice shall be included in all copies or substantial
14-
! portions of the Software and documentation.
15-
16-
! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17-
! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18-
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19-
! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20-
! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21-
! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22-
! THE SOFTWARE.
10+
! copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to
11+
! the following conditions:
12+
13+
! The above copyright notice and this permission notice shall be included in all copies or substantial
14+
! portions of the Software and documentation.
15+
16+
! THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17+
! OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
! FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
! AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
! LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
! OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
! THE SOFTWARE.
2323
! _______________________________________________________________________________________________________
24-
25-
! End MIT license text.
24+
25+
! End MIT license text.
2626

2727
SUBROUTINE CHECK_TE_MATRIX ( TE_IN, NAME_IN )
2828

0 commit comments

Comments
 (0)