Skip to content

Commit e9ef5bd

Browse files
Merge pull request #1112 from eve-le-guillou/mpi_DMS_pr
[MPI] Distributed Discrete Morse Sandwich: Hybrid MPI+thread Persistence Diagram Computation
2 parents a5e2fbb + 5d0c2ed commit e9ef5bd

File tree

33 files changed

+7785
-264
lines changed

33 files changed

+7785
-264
lines changed

.github/workflows/package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ jobs:
164164
rm python/nestedTrackingFromOverlap.py
165165
# remove examples which fill up the memory
166166
rm python/topologicalOptimization_darkSky.py
167-
python3 -u python/run.py
167+
pvpython -u python/run.py
168168
169169
- name: Test ttk-data Python scripts results [NOT ENFORCED]
170170
continue-on-error: true

.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ jobs:
247247
rm python/mpiExample.py
248248
# remove examples which fill up the memory
249249
rm python/topologicalOptimization_darkSky.py
250-
python3 -u python/run.py
250+
pvpython -u python/run.py
251251
252252
- name: Test ttk-data Python scripts results [NOT ENFORCED]
253253
if: matrix.testSet == 'pyTests'
@@ -398,6 +398,7 @@ jobs:
398398
rm python/nestedTrackingFromOverlap.py
399399
# tmp removal of mpi example
400400
rm python/mpiExample.py
401+
rm python/distributedPersistenceDiagram.py
401402
# remove examples which fill up the memory
402403
rm python/topologicalOptimization_darkSky.py
403404
# remove sklearn examples -- buggy on MacOS since sklearn-1.7

CMake/config.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ if (TTK_ENABLE_MPI)
4646
option(TTK_ENABLE_MPI_TIME "Enable time measuring for MPI computation" FALSE)
4747
mark_as_advanced(TTK_ENABLE_MPI_TIME)
4848
option(TTK_ENABLE_MPI_RANK_ID_INT "Enable rank ids of type int (default char) for distributed sort" FALSE)
49-
mark_as_advanced(TTK_ENABLE_MPI_RANK_ID_TIME)
49+
mark_as_advanced(TTK_ENABLE_MPI_RANK_ID_INT)
5050

5151
endif()
5252

ChangeLog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
## TTK - ChangeLog
22
=
33
### dev
4+
- Distributed computation of persistent homology!
45
- New backend for TrackingFromFields (critical point based)
6+
- Fast planar Rips filtration persistence computation
57

68
### 1.3.0
79
- Wasserstein Auto-Encoders of Merge Trees / Pers. Diagrams (IEEE TVCG 2024)

core/base/abstractTriangulation/AbstractTriangulation.h

Lines changed: 96 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2828,6 +2828,23 @@ namespace ttk {
28282828
return -1;
28292829
}
28302830

2831+
inline ttk::SimplexId getSimplexLocalId(const SimplexId gsid,
2832+
const int type) const {
2833+
if(!ttk::isRunningWithMPI()) {
2834+
return gsid;
2835+
}
2836+
switch(type) {
2837+
case 0:
2838+
return this->getVertexLocalId(gsid);
2839+
case 1:
2840+
return this->getEdgeLocalId(gsid);
2841+
case 2:
2842+
return this->getTriangleLocalId(gsid);
2843+
default:
2844+
return this->getCellLocalId(gsid);
2845+
}
2846+
}
2847+
28312848
virtual inline int getVertexRank(const SimplexId lvid) const {
28322849

28332850
if(!ttk::isRunningWithMPI()) {
@@ -2852,6 +2869,54 @@ namespace ttk {
28522869
return this->getVertexRankInternal(lvid);
28532870
}
28542871

2872+
virtual inline int getEdgeRank(const SimplexId lvid) const {
2873+
2874+
if(!ttk::isRunningWithMPI()) {
2875+
return 0;
2876+
}
2877+
#ifndef TTK_ENABLE_KAMIKAZE
2878+
if(this->getDimensionality() != 1 && this->getDimensionality() != 2
2879+
&& this->getDimensionality() != 3) {
2880+
this->printErr("Only 1D, 2D and 3D datasets are supported");
2881+
return -1;
2882+
}
2883+
if(!this->hasPreconditionedDistributedEdges_) {
2884+
this->printErr("EdgeRankId query without pre-process!");
2885+
this->printErr(
2886+
"Please call preconditionDistributedEdges() in a pre-process.");
2887+
return -1;
2888+
}
2889+
if(lvid < 0 || lvid >= this->getNumberOfEdges()) {
2890+
return -1;
2891+
}
2892+
#endif // TTK_ENABLE_KAMIKAZE
2893+
return this->getEdgeRankInternal(lvid);
2894+
}
2895+
2896+
virtual inline int getTriangleRank(const SimplexId lvid) const {
2897+
2898+
if(!ttk::isRunningWithMPI()) {
2899+
return 0;
2900+
}
2901+
#ifndef TTK_ENABLE_KAMIKAZE
2902+
if(this->getDimensionality() != 1 && this->getDimensionality() != 2
2903+
&& this->getDimensionality() != 3) {
2904+
this->printErr("Only 1D, 2D and 3D datasets are supported");
2905+
return -1;
2906+
}
2907+
if(!this->hasPreconditionedDistributedTriangles_) {
2908+
this->printErr("TriangleRankId query without pre-process!");
2909+
this->printErr(
2910+
"Please call preconditionDistributedTriangles() in a pre-process.");
2911+
return -1;
2912+
}
2913+
if(lvid < 0 || lvid >= this->getNumberOfTriangles()) {
2914+
return -1;
2915+
}
2916+
#endif // TTK_ENABLE_KAMIKAZE
2917+
return this->getTriangleRankInternal(lvid);
2918+
}
2919+
28552920
virtual inline int getCellRank(const SimplexId lcid) const {
28562921
#ifndef TTK_ENABLE_KAMIKAZE
28572922
if(this->getDimensionality() != 1 && this->getDimensionality() != 2
@@ -2870,11 +2935,31 @@ namespace ttk {
28702935
}
28712936
#endif // TTK_ENABLE_KAMIKAZE
28722937
if(!ttk::isRunningWithMPI()) {
2873-
return lcid;
2938+
return ttk::MPIrank_;
28742939
}
28752940
return this->getCellRankInternal(lcid);
28762941
}
28772942

2943+
inline int getSimplexRank(const SimplexId lsid, const int type) const {
2944+
if(!ttk::isRunningWithMPI()) {
2945+
return ttk::MPIrank_;
2946+
}
2947+
switch(type) {
2948+
case 0:
2949+
return this->getVertexRank(lsid);
2950+
case 1:
2951+
return this->getEdgeRank(lsid);
2952+
case 2: {
2953+
if(getDimensionality() == 3)
2954+
return this->getTriangleRank(lsid);
2955+
return this->getCellRank(lsid);
2956+
}
2957+
case 3:
2958+
return this->getCellRank(lsid);
2959+
}
2960+
return -1;
2961+
}
2962+
28782963
virtual inline const std::vector<int> &getNeighborRanks() const {
28792964
return this->neighborRanks_;
28802965
}
@@ -3046,6 +3131,16 @@ namespace ttk {
30463131
return -1;
30473132
}
30483133

3134+
virtual inline int
3135+
getEdgeRankInternal(const SimplexId ttkNotUsed(lvid)) const {
3136+
return -1;
3137+
}
3138+
3139+
virtual inline int
3140+
getTriangleRankInternal(const SimplexId ttkNotUsed(lvid)) const {
3141+
return -1;
3142+
}
3143+
30493144
virtual inline int
30503145
getCellRankInternal(const SimplexId ttkNotUsed(lcid)) const {
30513146
return -1;

core/base/arrayPreconditioning/ArrayPreconditioning.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,9 +344,10 @@ namespace ttk {
344344

345345
ttk::SimplexId verticesToSortSize = verticesToSort.size();
346346
// Compute the order of the first element of the current process
347-
ttk::SimplexId orderOffset
348-
= std::accumulate(vertexDistribution.begin(),
349-
vertexDistribution.begin() + ttk::MPIrank_, 0);
347+
ttk::SimplexId orderOffset{0};
348+
for(int i = 0; i < ttk::MPIrank_; i++) {
349+
orderOffset += vertexDistribution[i];
350+
}
350351
// nbChunk, rest and nbChunkTotal are used to compute the
351352
// post-processing bit by bit.
352353
ttk::SimplexId nbChunk = std::floor(verticesToSortSize / ChunkSize);
@@ -412,7 +413,7 @@ namespace ttk {
412413
}
413414

414415
protected:
415-
bool GlobalOrder{false};
416+
bool GlobalOrder{true};
416417
// This value has been chosen for systems of 128 Gb of memory per computing
417418
// node. For systems with much smaller memory, it may be inadequate and
418419
// require a smaller value.

0 commit comments

Comments
 (0)