Commit 97672586 authored by Philipp Samfass's avatar Philipp Samfass
Browse files

added optional header for teaMPI + communicator for communication within a team

parent a099eeed
......@@ -2,8 +2,8 @@ CC=mpiicpc
CFLAGS += -fPIC -g -Wall -std=c++11
LDFLAGS += -shared
SRC = Rank.cpp RankControl.cpp Timing.cpp Wrapper.cpp
DEP = Rank.h RankControl.h Timing.h Wrapper.h Logging.h
SRC = Rank.cpp RankControl.cpp Timing.cpp Wrapper.cpp teaMPI.cpp
DEP = Rank.h RankControl.h Timing.h Wrapper.h Logging.h teaMPI.h
OBJECTS = $(SRC:.cpp=.o)
TARGET = libtmpi.so
......
......@@ -23,6 +23,7 @@ static int numTeams;
static MPI_Comm TMPI_COMM_TEAM;
static MPI_Comm TMPI_COMM_DUP;
static MPI_Comm TMPI_COMM_INTER_TEAM;
int initialiseTMPI() {
/**
......@@ -44,6 +45,9 @@ int initialiseTMPI() {
PMPI_Comm_size(TMPI_COMM_TEAM, &teamSize);
// Todo: free
PMPI_Comm_split(MPI_COMM_WORLD, teamRank, worldRank, &TMPI_COMM_INTER_TEAM);
assert(teamSize == (worldSize / numTeams));
registerSignalHandler();
......@@ -92,6 +96,10 @@ MPI_Comm getTeamComm(MPI_Comm comm) {
return (comm==MPI_COMM_WORLD) ? TMPI_COMM_TEAM : comm;
}
MPI_Comm getTeamInterComm() {
return TMPI_COMM_INTER_TEAM;
}
int freeTeamComm() {
return MPI_Comm_free(&TMPI_COMM_TEAM);
}
......
......@@ -53,6 +53,8 @@ int getTeam();
MPI_Comm getTeamComm(MPI_Comm comm);
int freeTeamComm();
MPI_Comm getTeamInterComm();
/* The duplicate MPI_COMM_WORLD used by the library*/
MPI_Comm getLibComm();
int freeLibComm();
......
/**
* teaMPI.cpp
*
* Created on 19 Aug 2019
* Author: Philipp Samfass
*/
#include "teaMPI.h"
#include "Rank.h"
#include <mpi.h>
int TMPI_GetInterTeamCommSize() {
return getNumberOfTeams();
}
MPI_Comm TMPI_GetInterTeamComm() {
return getTeamInterComm();
}
/**
* teaMPI.h
*
* Created on 19 Aug 2019
* Author: Philipp Samfass
*/
#include <mpi.h>
MPI_Comm TMPI_GetInterTeamComm();
int TMPI_GetInterTeamCommSize();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment