Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
809765e
Working with upto 24km global mesh
abishekg7 Apr 8, 2025
d46fceb
Now checking for zero connectivities. Works with limited area grid
abishekg7 Apr 9, 2025
86ecb30
Modifying the logic for when Scotch partitioning is active
abishekg7 Jun 24, 2025
2b6258c
WIP: Makefile changes to enable SCOTCH
abishekg7 Jun 24, 2025
d677fb4
Adding compile-time link test for the Scotch library
abishekg7 Jun 24, 2025
2176657
few fixes for GNU and Intel builds
abishekg7 Jul 2, 2025
d63accc
adding timers
abishekg7 Jul 3, 2025
ebbd919
PT-Scotch WIP
abishekg7 Jul 7, 2025
d8207e6
working pt-scotch
abishekg7 Jul 22, 2025
d4f3f2d
removing inq of unneeded vars
abishekg7 Jul 22, 2025
6d2d9fd
cleanup prior to adding MPAS_SCOTCH logic
abishekg7 Jul 22, 2025
fcd89ef
Scotch is selectively enabled when SCOTCH is set
abishekg7 Jul 22, 2025
52c7830
More cleanup and added comments
abishekg7 Jul 23, 2025
a073471
Writing out correct graph parition files from PT-Scotch
abishekg7 Jul 25, 2025
d04cbf8
WIP
abishekg7 Sep 18, 2025
4e105d4
Working interfaces
abishekg7 Sep 23, 2025
f721710
cleanup
abishekg7 Sep 24, 2025
d3f511c
mpas_block_decomp.o depends on mpas_ptscotch_interface.o
abishekg7 Oct 22, 2025
a8d1808
Using SCOTCH_Num as integer type
abishekg7 Oct 22, 2025
67c25ba
introducing some new variables
abishekg7 Oct 22, 2025
029d3e1
Using SCOTCH_STRATSCALABILITY to avoid crashes with large partition c…
abishekg7 Oct 22, 2025
103e8a5
Undoing changes to config_block_decomp_file_prefix defaults
abishekg7 Dec 6, 2025
0eee657
Make sure non-Scotch build still works
abishekg7 Dec 6, 2025
f4f14c4
Refactoring Scotch logic
abishekg7 Dec 6, 2025
7accc40
Removing timers from mpas_bootstrapping
abishekg7 Dec 6, 2025
697955f
Cleaning up whitespace
abishekg7 Dec 6, 2025
ff4e012
Apply a more consistent formatting
abishekg7 Dec 8, 2025
38d6a86
Adding comments and removing return for void calls
abishekg7 Dec 8, 2025
602c79a
Adding some documentation
abishekg7 Dec 11, 2025
2188fef
Fixes and cleanup
abishekg7 Dec 11, 2025
82450f2
Removing DGraph2 and using SCOTCH_dgraphData, SCOTCH_dgraphSize instead
abishekg7 Dec 11, 2025
f92997e
Fixes and cleanup
abishekg7 Dec 11, 2025
8849a0b
Cleaning up whitespace and variables in mpas_block_decomp_scotch
abishekg7 Dec 11, 2025
87c7358
Prevent scotch logic when config_number_of_blocks is not zero
abishekg7 Dec 11, 2025
be6cfa2
Cleanup and converting Scotch F interface functions to subroutines
abishekg7 Dec 11, 2025
7d370ad
Replace total_blocks with nProcs
abishekg7 Dec 11, 2025
79f759a
Some minor edits to address review comments
abishekg7 Dec 26, 2025
3150b1a
Replacing MPI_COMM_WORLD with dminfo%comm
abishekg7 Dec 26, 2025
ef465d4
Fix to non-Scotch code path
abishekg7 Dec 26, 2025
6cd6eb9
Updating Scotch build tests in Makefile. Now tries to build C and For…
abishekg7 Dec 27, 2025
0ef7da0
Updating copyright block
abishekg7 Dec 27, 2025
47d7701
Small fixes and cleanup for code path when config_block_decomp_file_p…
abishekg7 Dec 27, 2025
bc93fb0
Cleanup of print statements
abishekg7 Dec 27, 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
72 changes: 72 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,16 @@ endif
LIBS += $(NCLIB)
endif

ifneq "$(SCOTCH)" ""
SCOTCH_FCINCLUDES += -I$(SCOTCH)/include
SCOTCH_LIBS += -L$(SCOTCH)/lib64 -lptscotch -lscotch -lptscotcherr -lm
SCOTCH_FFLAGS = -DMPAS_SCOTCH

FCINCLUDES += $(SCOTCH_FCINCLUDES)
CPPINCLUDES += $(SCOTCH_FCINCLUDES)
LIBS += $(SCOTCH_LIBS)
override CPPFLAGS += $(SCOTCH_FFLAGS)
endif

ifneq "$(PNETCDF)" ""
ifneq ($(wildcard $(PNETCDF)/lib/libpnetcdf.*), )
Expand Down Expand Up @@ -1415,6 +1425,60 @@ musica_fortran_test:
$(eval MUSICA_FORTRAN_VERSION := $(shell pkg-config --modversion musica-fortran))
$(if $(findstring 1,$(MUSICA_FORTRAN_TEST)), $(info Built a simple test program with MUSICA-Fortran version $(MUSICA_FORTRAN_VERSION)), )

scotch_fortran_test:
@#
@# Create C and Fortran test programs and try to build against the PT-SCOTCH library
@#
$(info Checking for a working Scotch library...)
$(eval SCOTCH_C_TEST := $(shell $\
printf "#include <stdio.h>\n\
&#include \"mpi.h\"\n\
&#include \"ptscotch.h\"\n\
&int main(){\n\
& int err;\n\
& SCOTCH_Dgraph *dgraph;\n\
& err = SCOTCH_dgraphInit(dgraph, MPI_COMM_WORLD);\n\
& SCOTCH_dgraphExit(dgraph);\n\
& return err;\n\
&}\n" | sed 's/&/ /' > ptscotch_c_test.c; $\
$\
$(CC) $(CPPINCLUDES) $(CFLAGS) $(LDFLAGS) ptscotch_c_test.c -o ptscotch_c_test.x $(SCOTCH_LIBS) > ptscotch_c_test.log 2>&1; $\
scotch_c_status=$$?; $\
if [ $$scotch_c_status -eq 0 ]; then $\
printf "1"; $\
rm -f ptscotch_c_test.c ptscotch_c_test.x ptscotch_c_test.log; $\
else $\
printf "0"; $\
fi $\
))
$(if $(findstring 0,$(SCOTCH_C_TEST)), $(error Could not build a simple C program with Scotch. $\
Test program ptscotch_c_test.c and output ptscotch_c_test.log have been left $\
in the top-level MPAS directory for further debugging ))
$(if $(findstring 1,$(SCOTCH_C_TEST)), $(info Built a simple C program with Scotch ))
$(eval SCOTCH_FORTRAN_TEST := $(shell $\
printf "program test_scotch_fortran\n$\
& include \"ptscotchf.h\"\n$\
& doubleprecision :: scotchgraph (scotch_graphdim)\n$\
& integer :: ierr\n$\
& ierr = 0\n$\
& call scotchfgraphinit(scotchgraph (1), ierr)\n$\
& call scotchfgraphexit(scotchgraph(1))\n$\
end program test_scotch_fortran\n" | sed 's/&/ /' > ptscotch_f_test.f90; $\
$\
$(FC) $(SCOTCH_FCINCLUDES) $(SCOTCH_FFLAGS) ptscotch_f_test.f90 -o ptscotch_f_test.x $(SCOTCH_LIBS) > ptscotch_f_test.log 2>&1; $\
scotch_fortran_status=$$?; $\
if [ $$scotch_fortran_status -eq 0 ]; then $\
printf "1"; $\
rm -f ptscotch_f_test.f90 ptscotch_f_test.x ptscotch_f_test.log; $\
else $\
printf "0"; $\
fi $\
))
$(if $(findstring 0,$(SCOTCH_FORTRAN_TEST)), $(error Could not build a simple Fortran program with Scotch. $\
Test program ptscotch_f_test.f90 and output ptscotch_f_test.log have been left $\
in the top-level MPAS directory for further debugging ))
$(if $(findstring 1,$(SCOTCH_FORTRAN_TEST)), $(info Built a simple Fortran program with Scotch ))

pnetcdf_test:
@#
@# Create test C programs that look for PNetCDF header file and some symbols in it
Expand Down Expand Up @@ -1471,6 +1535,13 @@ else
MUSICA_MESSAGE = "MPAS was not linked with the MUSICA-Fortran library."
endif

ifneq "$(SCOTCH_FFLAGS)" ""
MAIN_DEPS += scotch_fortran_test
SCOTCH_MESSAGE = "MPAS has been linked with the Scotch graph partitioning library."
else
SCOTCH_MESSAGE = "MPAS was NOT linked with the Scotch graph partitioning library."
endif

mpas_main: $(MAIN_DEPS)
cd src; $(MAKE) FC="$(FC)" \
CC="$(CC)" \
Expand Down Expand Up @@ -1508,6 +1579,7 @@ mpas_main: $(MAIN_DEPS)
@echo $(OPENMP_OFFLOAD_MESSAGE)
@echo $(OPENACC_MESSAGE)
@echo $(MUSICA_MESSAGE)
@echo $(SCOTCH_MESSAGE)
@echo $(SHAREDLIB_MESSAGE)
ifeq "$(AUTOCLEAN)" "true"
@echo $(AUTOCLEAN_MESSAGE)
Expand Down
6 changes: 5 additions & 1 deletion src/framework/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ OBJS = mpas_kind_types.o \
mpas_log.o \
mpas_halo.o \
mpas_string_utils.o \
mpas_ptscotch_interface.o \
ptscotch_interface.o \
mpas_stream_inquiry.o \
stream_inquiry.o

Expand Down Expand Up @@ -85,7 +87,7 @@ mpas_timekeeping.o: mpas_string_utils.o mpas_kind_types.o mpas_derived_types.o m

mpas_timer.o: mpas_kind_types.o mpas_dmpar.o mpas_threading.o mpas_log.o

mpas_block_decomp.o: mpas_derived_types.o mpas_hash.o mpas_io_units.o mpas_dmpar.o
mpas_block_decomp.o: mpas_derived_types.o mpas_hash.o mpas_io_units.o mpas_dmpar.o mpas_ptscotch_interface.o

mpas_block_creator.o: mpas_dmpar.o mpas_hash.o mpas_sort.o mpas_io_units.o mpas_block_decomp.o mpas_stream_manager.o mpas_decomp.o mpas_abort.o $(DEPS)

Expand All @@ -112,6 +114,8 @@ xml_stream_parser.o: xml_stream_parser.c

mpas_halo.o: mpas_derived_types.o mpas_pool_routines.o mpas_log.o

mpas_ptscotch_interface.o : mpas_derived_types.o mpas_dmpar.o mpas_log.o ptscotch_interface.o

mpas_stream_inquiry.o : mpas_derived_types.o mpas_log.o mpas_c_interfacing.o

clean:
Expand Down
Loading