Skip to content
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

UCL Scotch support for SWIFT #42

Open
wants to merge 69 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
856b033
feat: Read in the metis dump files and generate a scotch graph
Mar 15, 2023
386304b
outputting the graph structure
Apr 20, 2023
9aadb06
Merge branch 'master' of https://github.com/UCL/swiftsim
Apr 20, 2023
83533a0
feat: Building with Scotch
Apr 20, 2023
4783ed5
Updating Makefile and adding pick-scotch function
Apr 24, 2023
a361b6a
Merge branch 'ucl-scotch-build' of https://github.com/UCL/swiftsim in…
Apr 24, 2023
e157cca
Merge branch 'SWIFTSIM:master' into ucl-scotch-build
DanGiles May 23, 2023
4486162
fix: Builds on Myriad
May 24, 2023
efc7998
Merge branch 'ucl-scotch-build' of https://github.com/UCL/swiftsim in…
May 24, 2023
b0302b4
Update partition.c
DanGiles May 24, 2023
ae3533a
Correction to scotch functions
Jun 1, 2023
99582fd
Merge branch 'ucl-scotch-build' of https://github.com/UCL/swiftsim in…
Jun 1, 2023
89eb834
Adding test tgt file
Jun 5, 2023
dbd3f95
Addition of the .tgt which represents a Myriad node
Jun 5, 2023
1ee20ec
fix: comm matrix passed to scotch
Jun 7, 2023
6959b86
Merge branch 'SWIFTSIM:master' into ucl-scotch-build
DanGiles Jun 25, 2023
7654c83
fix: Correction to partition_repatition
Jun 26, 2023
c5a399d
Merge branch 'ucl-scotch-build' of https://github.com/UCL/swiftsim in…
Jun 26, 2023
c67ff38
fix: filling up the edge and vertex weights
Jul 5, 2023
6921ded
updating the target arch file for one cosma node (8 NUMA regions)
Jul 5, 2023
7e5898d
fix: Updating to read in target file
Jul 26, 2023
0bdf8f3
Adding a template multi cosma node job script
Jul 26, 2023
cc90448
Adding template target files
Jul 26, 2023
251c8f3
Merge branch 'SWIFTSIM:master' into ucl-scotch-build
DanGiles Jul 30, 2023
0144f84
Added scripts to create target file.
themkots Aug 4, 2023
dd440d0
Incremental edits.
themkots Aug 7, 2023
bb9e65d
Defining the mapping strategy
Aug 9, 2023
151a7e9
Added SCOTCH_LIBS, SCOTCH_INCS to src/Makefile.am for Scotch MPI comp…
Aug 11, 2023
b9e23d7
updated assignment of edges
Aug 11, 2023
2c704dc
Merge branch 'ucl-scotch-build' of https://github.com/UCL/swiftsim in…
Aug 11, 2023
52297ce
setting communication matrix to be symmetric
Aug 15, 2023
6c6f3ac
clean up, summed edge weight and balance strategy
Aug 18, 2023
7f901f4
fix typo in partition.c
DanGiles Aug 18, 2023
df7759b
Merge pull request #16 from UCL/ucl-scotch-build
DanGiles Aug 18, 2023
c481d54
docs: New documentation on the installation and running with SWIFT
Aug 18, 2023
b53abcd
fix: Typo in docs
Aug 18, 2023
7ac4395
fix: correcting the Markdown
Aug 18, 2023
7c06111
update to the docs
Aug 18, 2023
d4b7902
Documentation updates
Aug 18, 2023
1d4d464
fix: Typo value for the imbalance ratio in pick_scotch
DanGiles Aug 21, 2023
a3cf904
Merge pull request #18 from UCL/dg-imbalance-ratio
DanGiles Aug 21, 2023
88997dd
Updates
Aug 21, 2023
4d5119c
fix typo
DanGiles Aug 21, 2023
0f5c901
Merge pull request #17 from UCL/dg-cleanup-docs
DanGiles Aug 21, 2023
c33a912
Update README-Scotch.md
DanGiles Aug 21, 2023
5053cb6
Merge pull request #19 from UCL/DanGiles-docs-update
DanGiles Aug 21, 2023
e7c7479
Update README-Scotch.md
DanGiles Aug 21, 2023
016ec08
Merge pull request #20 from UCL/DanGiles-patch-1
DanGiles Aug 21, 2023
ca0f018
fix: Formatting according to clang-format.sh
Aug 21, 2023
9c16bb6
Merge pull request #21 from UCL/dg-formatting
DanGiles Aug 21, 2023
0a2e732
fix: Clean up of excess files
Aug 22, 2023
5cb01a5
Merge pull request #22 from UCL/dg-cleanup
DanGiles Aug 22, 2023
3ab621c
fix: Formatting scripts
Aug 22, 2023
1b9439b
Merge pull request #23 from UCL/dg-format-script
DanGiles Aug 22, 2023
ca9deed
fix: Revert whitespace
Aug 23, 2023
9175f7d
Merge pull request #24 from UCL/dg-revert-whitespace
DanGiles Aug 23, 2023
7c62a50
fix: Adding defs of idx_t
Aug 24, 2023
6621820
fix: Check for METIS and PARMETIS
Aug 24, 2023
54c5ac4
adding scotch repartition_name[]
Aug 24, 2023
cb06b0e
Merge pull request #25 from UCL/dg-type-def
DanGiles Aug 24, 2023
9766d6d
Merge branch 'SWIFTSIM:master' into master
DanGiles Oct 9, 2023
72ac2c9
Update README-Scotch.md (#28)
DanGiles Oct 9, 2023
f660b0a
fix: Passing architecture file as flag (#27)
DanGiles Nov 3, 2023
5d78376
Initialised return_edge variable (#31)
DanGiles Nov 6, 2023
f559337
Downsized IDX_MAX to INT_MAX, from SCOTCH_NUMMAX.
themkots Nov 9, 2023
0463253
Defined IDX_MAX explicitly, using 32-bit value, define IDX_MAX (21474…
themkots Nov 13, 2023
f656d4d
Addressing comments on `configure.ac` and removal on unused `refine` …
DanGiles Nov 15, 2023
7fed283
Update files - minor edits and SCOTCH mentions in comments etc. (#36)
themkots Nov 17, 2023
6e5131b
Update README-Scotch.md (#35)
DanGiles Nov 17, 2023
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
9 changes: 9 additions & 0 deletions INSTALL.swift
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,15 @@ before you can build it.
least "--with-metis". ParMETIS is preferred over METIS when there
is a choice.

- Scotch:
a build of the Scotch library should be used to
optimize the load between MPI nodes by mapping the decomposed domain
to the available compute. This should be found in the
standard installation directories, or pointed at using the
"--with-scotch" configuration options.
In this case the top-level installation directory of the build
should be given.

- libNUMA:
a build of the NUMA library can be used to pin the threads to
the physical core of the machine SWIFT is running on. This is
Expand Down
4 changes: 2 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ EXTRA_LIBS = $(GSL_LIBS) $(HDF5_LIBS) $(FFTW_LIBS) $(NUMA_LIBS) $(PROFILER_LIBS)
$(CHEALPIX_LIBS)

# MPI libraries.
MPI_LIBS = $(PARMETIS_LIBS) $(METIS_LIBS) $(MPI_THREAD_LIBS) $(FFTW_MPI_LIBS)
MPI_FLAGS = -DWITH_MPI $(PARMETIS_INCS) $(METIS_INCS) $(FFTW_MPI_INCS)
MPI_LIBS = $(SCOTCH_LIBS) $(PARMETIS_LIBS) $(METIS_LIBS) $(MPI_THREAD_LIBS) $(FFTW_MPI_LIBS)
MPI_FLAGS = -DWITH_MPI $(SCOTCH_INCS) $(PARMETIS_INCS) $(METIS_INCS) $(FFTW_MPI_INCS)

# Programs.
bin_PROGRAMS = swift
Expand Down
193 changes: 193 additions & 0 deletions README-Scotch.md

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -791,6 +791,41 @@ AC_CHECK_LIB(pthread, posix_fallocate,
AC_DEFINE([HAVE_POSIX_FALLOCATE], [1], [The posix library implements file allocation functions.]),
AC_MSG_WARN(POSIX implementation does not have file allocation functions.))

# Check for SCOTCH.
have_scotch="no"
AC_ARG_WITH([scotch],
[AS_HELP_STRING([--with-scotch=PATH],
[root directory where SCOTCH is installed @<:@yes/no@:>@]
)],
[with_scotch="$withval"],
[with_scotch="no"]
)

SCOTCH_LIBS=""
if test "x$with_scotch" != "xno"; then

# Check if we have SCOTCH.
if test "x$with_scotch" != "xyes" -a "x$with_scotch" != "x"; then
SCOTCH_LIBS="-L$with_scotch/lib -lscotch -lscotcherr"
SCOTCH_INCS="-I$with_scotch/include"
else
SCOTCH_LIBS="-lscotch -lscotcherr"
SCOTCH_INCS=""
fi
AC_CHECK_LIB([scotch],[SCOTCH_graphInit], [have_scotch="yes"],
[have_scotch="no"], $SCOTCH_LIBS)
if test "$have_scotch" = "yes"; then
AC_DEFINE([HAVE_SCOTCH],1,[The SCOTCH library is present.])
else
AC_MSG_ERROR("Failed to find a SCOTCH library")
fi
fi

AC_SUBST([SCOTCH_LIBS])
AC_SUBST([SCOTCH_INCS])
AM_CONDITIONAL([HAVESCOTCH],[test -n "$SCOTCH_LIBS"])


# Check for METIS.
have_metis="no"
AC_ARG_WITH([metis],
Expand Down Expand Up @@ -3051,6 +3086,7 @@ AC_MSG_RESULT([
HDF5 enabled : $with_hdf5
- parallel : $have_parallel_hdf5
METIS/ParMETIS : $have_metis / $have_parmetis
Scotch : $have_scotch
FFTW3 enabled : $have_fftw
- threaded/openmp : $have_threaded_fftw / $have_openmp_fftw
- MPI : $have_mpi_fftw
Expand Down
4 changes: 2 additions & 2 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ GIT_CMD = @GIT_CMD@
EXTRA_LIBS = $(GSL_LIBS) $(HDF5_LIBS) $(FFTW_LIBS) $(NUMA_LIBS) $(PROFILER_LIBS) $(TCMALLOC_LIBS) $(JEMALLOC_LIBS) $(TBBMALLOC_LIBS) $(GRACKLE_LIBS) $(SUNDIALS_LIBS) $(CHEALPIX_LIBS)

# MPI libraries.
MPI_LIBS = $(PARMETIS_LIBS) $(METIS_LIBS) $(MPI_THREAD_LIBS)
MPI_FLAGS = -DWITH_MPI $(PARMETIS_INCS) $(METIS_INCS)
MPI_LIBS = $(SCOTCH_LIBS) $(PARMETIS_LIBS) $(METIS_LIBS) $(MPI_THREAD_LIBS)
MPI_FLAGS = -DWITH_MPI $(SCOTCH_INCS) $(PARMETIS_INCS) $(METIS_INCS)

# Build the libswiftsim library and a convenience library just for the gravity tasks
lib_LTLIBRARIES = libswiftsim.la
Expand Down
6 changes: 3 additions & 3 deletions src/debug.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,8 @@ void dumpCells(const char *prefix, int super, int active, int mpiactive,
fclose(file);
}

#if defined(WITH_MPI) && (defined(HAVE_METIS) || defined(HAVE_PARMETIS))
#if defined(WITH_MPI) && (defined(HAVE_METIS) || defined(HAVE_PARMETIS)) \
&& !defined(HAVE_SCOTCH)

/**
* @brief Dump a graph in METIS standard format, simple format and weights
Expand All @@ -650,8 +651,7 @@ void dumpCells(const char *prefix, int super, int active, int mpiactive,
*
* The output filenames are generated from the prefix and the sequence number
* of calls. So the first is called {prefix}_std_001.dat,
*{prefix}_simple_001.dat,
* {prefix}_weights_001.dat, etc.
* {prefix}_simple_001.dat, {prefix}_weights_001.dat, etc.
*
* @param prefix base output filename
* @param nvertices the number of vertices
Expand Down
5 changes: 3 additions & 2 deletions src/debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@ int checkCellhdxmax(const struct cell *c, int *depth);
void dumpCells(const char *prefix, int super, int active, int mpiactive,
int pactive, struct space *s, int rank, int step);

#if defined(WITH_MPI) && (defined(HAVE_METIS) || defined(HAVE_PARMETIS))
#include "metis.h"
#if defined(WITH_MPI) && (defined(HAVE_METIS) || defined(HAVE_PARMETIS)) \
&& !defined(HAVE_SCOTCH)
#include <metis.h>
void dumpMETISGraph(const char *prefix, idx_t nvtxs, idx_t ncon, idx_t *xadj,
idx_t *adjncy, idx_t *vwgt, idx_t *vsize, idx_t *adjwgt);
#endif
Expand Down
5 changes: 3 additions & 2 deletions src/engine.c
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ void engine_addlink(struct engine *e, struct link **l, struct task *t) {
*/
void engine_repartition(struct engine *e) {

#if defined(WITH_MPI) && (defined(HAVE_PARMETIS) || defined(HAVE_METIS))
#if defined(WITH_MPI) && \
(defined(HAVE_PARMETIS) || defined(HAVE_METIS) || defined(HAVE_SCOTCH))

ticks tic = getticks();

Expand Down Expand Up @@ -254,7 +255,7 @@ void engine_repartition(struct engine *e) {
clocks_getunit());
#else
if (e->reparttype->type != REPART_NONE)
error("SWIFT was not compiled with MPI and METIS or ParMETIS support.");
error("SWIFT was not compiled with MPI and METIS, ParMETIS or SCOTCH support.");

/* Clear the repartition flag. */
e->forcerepart = 0;
Expand Down
Loading