Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
30 changes: 17 additions & 13 deletions handle-data.h
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,17 @@ template <typename M, auto E> class alignas(64) HandleData {
}*/
HandleData(const HandleData &o) { this->init(o.handle); }
HandleData(HandleData &&o) noexcept { this->init(o.handle); }
virtual void init(M group
virtual HandleData<M, E> *init(M group
#ifdef FORTRAN_SUPPORT
,
MPI_Fint fGroup
,
MPI_Fint fGroup
#endif
) {
handle = group;
#ifdef FORTRAN_SUPPORT
fHandle = fGroup;
#endif
return this;
}
/*virtual void init(const HandleData &o) {
handle = o.handle;
Expand Down Expand Up @@ -155,10 +156,10 @@ class alignas(64) CommData {
#ifdef FORTRAN_SUPPORT
int fHandle{-1};
#endif
void init(MPI_Comm comm
CommData *init(MPI_Comm comm
#ifdef FORTRAN_SUPPORT
,
MPI_Fint fComm = -1
,
MPI_Fint fComm = -1
#endif
) {
this->handle = comm;
Expand All @@ -169,10 +170,11 @@ class alignas(64) CommData {
fHandle = fComm;
#endif
if (comm == MPI_COMM_NULL)
return;
return this;
PMPI_Comm_dup(comm, &dupComm);
PMPI_Comm_size(comm, &size);
PMPI_Comm_rank(comm, &rank);
return this;
}
void fini() { PMPI_Comm_free(&dupComm); }
int getSize() { return size; }
Expand Down Expand Up @@ -352,9 +354,9 @@ class alignas(64) RequestData : public ipcData {
MPI_Fint fHandle{-1};
#endif

void init(MPI_Request request, KIND _kind, int _remote = -1, int _tag = -1,
CommData *_comm = nullptr, int _root = -1,
bool _persistent = false) {
RequestData *init(MPI_Request request, KIND _kind, int _remote = -1,
int _tag = -1, CommData *_comm = nullptr, int _root = -1,
bool _persistent = false) {
handle = request;
#ifdef FORTRAN_SUPPORT
fHandle = -1;
Expand All @@ -367,14 +369,15 @@ class alignas(64) RequestData : public ipcData {
persistent = _persistent;
freed = false;
cancelled = false;
return this;
}

template <typename M>
void init(M request,
RequestData *init(M request,
#ifdef FORTRAN_SUPPORT
MPI_Fint fRequest = -1,
MPI_Fint fRequest = -1,
#endif
bool _persistent = false) {
bool _persistent = false) {
persistent = _persistent;
handle = (MPI_Request)request;
#ifdef FORTRAN_SUPPORT
Expand All @@ -385,6 +388,7 @@ class alignas(64) RequestData : public ipcData {
#endif
freed = false;
cancelled = false;
return this;
}

void start() {
Expand Down
2 changes: 2 additions & 0 deletions ompt-critical.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ template <typename T> struct DataPool final {
DataPointer.PushBack(new (datas + i * paddedSize) T(this));
}
total += ndatas;
printf("%s, %li, %li, %i\n", __PRETTY_FUNCTION__, elemSize, paddedSize,
ndatas);
}

// get data from the pool
Expand Down
18 changes: 9 additions & 9 deletions tracking.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,16 @@ bool AbstractHandleFactory<MPI_Comm, CommData, toolCommData>::isPredefined(
}
template <>
void AbstractHandleFactory<MPI_Comm, CommData, toolCommData>::initPredefined() {
predefHandles[MPI_COMM_NULL].init(MPI_COMM_NULL);
predefHandles[MPI_COMM_WORLD].init(MPI_COMM_WORLD);
predefHandles[MPI_COMM_SELF].init(MPI_COMM_SELF);
predefHandles[MPI_COMM_NULL] = newData()->init(MPI_COMM_NULL);
predefHandles[MPI_COMM_WORLD] = newData()->init(MPI_COMM_WORLD);
predefHandles[MPI_COMM_SELF] = newData()->init(MPI_COMM_SELF);
#ifdef FORTRAN_SUPPORT
predefFHandles[predefHandles[MPI_COMM_NULL].fHandle] =
&predefHandles[MPI_COMM_NULL];
predefFHandles[predefHandles[MPI_COMM_WORLD].fHandle] =
&predefHandles[MPI_COMM_WORLD];
predefFHandles[predefHandles[MPI_COMM_SELF].fHandle] =
&predefHandles[MPI_COMM_SELF];
predefFHandles[predefHandles[MPI_COMM_NULL]->fHandle] =
predefHandles[MPI_COMM_NULL];
predefFHandles[predefHandles[MPI_COMM_WORLD]->fHandle] =
predefHandles[MPI_COMM_WORLD];
predefFHandles[predefHandles[MPI_COMM_SELF]->fHandle] =
predefHandles[MPI_COMM_SELF];
#endif
}
MPI_Comm CommData::nullHandle{MPI_COMM_NULL};
Expand Down
10 changes: 5 additions & 5 deletions tracking.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,13 @@ template <typename M, typename T, auto E> class AbstractHandleFactory {
using A =
M; // A is the application facing handle, M is the MPI facing handle.
protected:
CompactHashMap<M, T> predefHandles{};
CompactHashMap<M, T *> predefHandles{};
virtual bool isPredefined(A handle) { return handle == T::nullHandle; }
virtual T *findPredefinedData(A handle) {
auto iter = predefHandles.Find(handle);
if (iter == predefHandles.end())
return nullptr;
return &(iter->second);
return (iter->second);
}
#ifdef FORTRAN_SUPPORT
CompactHashMap<MPI_Fint, T *> predefFHandles{};
Expand Down Expand Up @@ -125,10 +125,10 @@ template <typename M, typename T, auto E> class AbstractHandleFactory {
virtual M &getHandleLocked(A &handle) = 0;
virtual std::shared_lock<std::shared_mutex> getSharedLock() = 0;
virtual void initPredefined() {
predefHandles[T::nullHandle].init(T::nullHandle);
T *nHandle = newData()->init(T::nullHandle);
predefHandles[T::nullHandle] = nHandle;
#ifdef FORTRAN_SUPPORT
auto &nHandle = predefHandles[T::nullHandle];
predefFHandles[nHandle.fHandle] = &nHandle;
predefFHandles[nHandle->fHandle] = nHandle;
#endif
}
};
Expand Down
Loading