Skip to content

Online graph partitioning using Scotch #1339

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

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

abishekg7
Copy link
Collaborator

@abishekg7 abishekg7 commented Jun 24, 2025

This PR enables the use of MPAS atmosphere core without requiring any graph decomposition files specified as input, if the atmosphere core has been built with the Scotch graph partitioning library (built separately).

Building MPAS with Scotch

Instructions to build Scotch are provided later in the description. Once Scotch has been installed, the MPAS atmosphere core can be leveraged to use online graph partitioning by setting the path to Scotch prior to building MPAS.

export SCOTCH=/path/to/scotch/installation
make nvhpc CORE=atmosphere

If MPAS is built/linked with Scotch successfully, you should see a message stating that at the end of the build output.

Usage and run-time behavior

After building MPAS with Scotch, you can still choose whether or not to use online graph partitioning by setting appropriate values for the config_block_decomp_file_prefix namelist option.

  • If config_block_decomp_file_prefix+mpi_tasks points to a valid graph decomp file that already exists in the run directory, then it is used to proceed with the model run without invoking Scotch.

  • If config_block_decomp_file_prefix=='' or config_block_decomp_file_prefix+mpi_tasks does not match any valid graph decomp file in the run directory, then Scotch graph partitioning is invoked. During this process, the generated partition is saved as a graph decomp file to the run directory so that it may be reused in the following runs without needing to invoke Scotch again.

If MPAS has not been built with scotch, any code paths relating to Scotch will not be taken. And an incorrect specification of config_block_decomp_file_prefix+mpi_tasks should lead to the model halting.

Downloading and building Scotch

Scotch may be obtained from its gitlab repository or as tarballs from this link

git clone [email protected]:scotch/scotch.git && cd scotch 
git checkout v7.0.7

Build instructions are on this page

More details to follow..

@abishekg7 abishekg7 marked this pull request as ready for review June 30, 2025 15:31
@abishekg7 abishekg7 changed the title Draft: Online graph partitioning using Scotch Online graph partitioning using Scotch Jun 30, 2025

if (dminfo % my_proc_id == IO_NODE) then
useScotch = .false.
if ( trim(blockFilePrefix) == '' ) then
call mpas_log_write('Namelist option config_block_decomp_file_prefix is set to \'\' ', MPAS_LOG_ERR)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line gives a compilation error with the ifx compiler:

mpas_block_decomp.F(119): error #5078: Unrecognized token '\' skipped
            call mpas_log_write('Namelist option config_block_decomp_file_prefix is set to \'\' ', MPAS_LOG_ERR)
---------------------------------------------------------------------------------------------^

@@ -759,6 +759,15 @@ endif
LIBS += $(NCLIB)
endif

ifneq "$(SCOTCH)" ""
SCOTCH_FCINCLUDES += -I$(SCOTCH)/src/include
SCOTCH_LIBS += -L$(SCOTCH)/lib -lscotch -lscotcherr
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may depend on the version on Scotch, but when I installed v7.0.7, the header files are in .../include (rather than in .../src/include, and the libraries are in .../lib64 rather than in .../lib.

@#
@# Create a Fortran test program that will link against the SCOTCH library
@#
$(info Checking for a working MUSICA-Fortran library...)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should "MUSICA-Fortran" be "SCOTCH"?

end do

if (istatus /= 0) then
call mpas_log_write('Writing out Scotch Graph paritioning data to '//trim(filename))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is filename uninitialized here? Or an empty string?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants