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

[#205] Implemented multimap test #242

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 7 additions & 1 deletion include/shad/data_structures/abstract_data_structure.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ class AbstractDataStructure {
/// @brief Default constructor
AbstractDataStructure() = default;


/// @brief Create method.
///
/// Creates a global instance of DataStructure, and associates to it a unique
Expand All @@ -85,7 +86,9 @@ class AbstractDataStructure {
ObjectID id = catalogRef->GetNextID();
std::tuple<ObjectID, Args...> tuple(id, args...);
rt::executeOnAll(CreateFunWrapper<ObjectID, Args...>, tuple);
return catalogRef->GetPtr(id);
auto ret= catalogRef->GetPtr(id);
ret->DataStructurePointerCommunication();
return ret;
}

/// @brief Destroy method.
Expand Down Expand Up @@ -150,6 +153,8 @@ class AbstractDataStructure {
CreateFunInnerWrapper(std::move(args), std::index_sequence_for<Args...>());
}

void DataStructurePointerCommunication(){}

class Catalog {
public:
void Insert(const ObjectID &oid, const SharedPtr ce) {
Expand Down Expand Up @@ -196,6 +201,7 @@ class AbstractDataStructure {
}

private:

Catalog() : register_(rt::numLocalities()), oidCache_(), registerLock_() {}

/// The Type storing the counter to obtain new DataStructure object IDs.
Expand Down
15 changes: 15 additions & 0 deletions include/shad/data_structures/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -701,6 +701,18 @@ void PrintAllElements() {
}
}

constexpr void DataStructurePointerCommunication() {
rt::executeOnAll([](const ObjectID &oid) {
auto This = Array<T>::GetPtr(oid);
rt::executeOnAll([](const std::tuple<ObjectID, rt::Locality, T*> &args) {
auto This = Array<T>::GetPtr(std::get<0>(args));

This->ptrs_[(uint32_t)std::get<1>(args)] = std::get<2>(args);
},
std::make_tuple(This->GetGlobalID(), rt::thisLocality(), This->data_.data()));
}, GetGlobalID());
}

private:
ObjectID oid_;
size_t size_;
Expand Down Expand Up @@ -948,6 +960,9 @@ void PrintAllElements() {
}
};

template <>
constexpr void Array<bool>::DataStructurePointerCommunication() {}

static std::pair<rt::Locality, size_t> getTargetLocalityFromTargePosition(
const std::vector<std::pair<size_t, size_t>> &dataDistribution,
size_t position) {
Expand Down
Loading