From e6f0393c4d2ec5e52f10b32d14ff16f0d0aefc62 Mon Sep 17 00:00:00 2001 From: Joss Whittle Date: Mon, 29 Aug 2016 23:38:47 +0100 Subject: [PATCH] p --- MEL/Graph.cpp | 10 +++------- MEL_deepcopy_experimental.hpp | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 17 deletions(-) diff --git a/MEL/Graph.cpp b/MEL/Graph.cpp index d5032c0..f3e129b 100644 --- a/MEL/Graph.cpp +++ b/MEL/Graph.cpp @@ -43,19 +43,15 @@ struct DiGraphNode { template inline void DeepCopy(MSG &msg) { - std::cout << "Object Deep Copy" << std::endl; - msg & edges; for (auto &e : edges) msg.packSharedPtr(e); }; }; template -inline void MyDeepCopy(DiGraphNode &obj, MSG &msg) { - std::cout << "My Deep Copy" << std::endl; - +inline void DiGraphNode_DeepCopy(DiGraphNode &obj, MSG &msg) { msg & obj.edges; - for (auto &e : obj.edges) msg.packSharedPtr, MyDeepCopy>(e); + for (auto &e : obj.edges) msg.packSharedPtr, DiGraphNode_DeepCopy>(e); }; inline DiGraphNode* MakeBTreeGraph(const int numNodes) { @@ -191,7 +187,7 @@ int main(int argc, char *argv[]) { auto startTime = MEL::Wtime(); // Start the clock! // Deep copy the graph to all nodes - MEL::Deep::Bcast*, MEL::Deep::PointerHashMap, MyDeepCopy, MyDeepCopy>(graph, 0, comm); + MEL::Deep::Bcast(graph, 0, comm); MEL::Barrier(comm); auto endTime = MEL::Wtime(); // Stop the clock! diff --git a/MEL_deepcopy_experimental.hpp b/MEL_deepcopy_experimental.hpp index 61970d9..0cec97b 100644 --- a/MEL_deepcopy_experimental.hpp +++ b/MEL_deepcopy_experimental.hpp @@ -978,7 +978,7 @@ namespace MEL { }; TEMPLATE_T_F(TransportBufferWrite) - inline enable_if_deep_not_pointer_not_stl BufferedSend(T &obj, const int dst, const int tag, const Comm &comm, const int bufferSize) { + inline enable_if_not_pointer_not_stl BufferedSend(T &obj, const int dst, const int tag, const Comm &comm, const int bufferSize) { char *buffer = MEL::MemAlloc(bufferSize); Message msg(buffer, bufferSize); msg.packRootVar(obj); @@ -994,7 +994,7 @@ namespace MEL { }; TEMPLATE_T_F(TransportBufferWrite) - inline enable_if_deep_not_pointer_not_stl BufferedSend(T &obj, const int dst, const int tag, const Comm &comm) { + inline enable_if_not_pointer_not_stl BufferedSend(T &obj, const int dst, const int tag, const Comm &comm) { MEL::Deep::BufferedSend(obj, dst, tag, comm, MEL::Deep::BufferSize(obj)); }; @@ -1167,7 +1167,7 @@ namespace MEL { }; TEMPLATE_T_F(TransportBufferRead) - inline enable_if_deep_not_pointer_not_stl BufferedRecv(T &obj, const int src, const int tag, const Comm &comm) { + inline enable_if_not_pointer_not_stl BufferedRecv(T &obj, const int src, const int tag, const Comm &comm) { int bufferSize; char *buffer = nullptr; MEL::Deep::Recv(buffer, bufferSize, src, tag, comm); @@ -1468,7 +1468,7 @@ namespace MEL { }; TEMPLATE_T_F2(TransportBufferWrite, TransportBufferRead) - inline enable_if_deep_not_pointer_not_stl BufferedBcast(T &obj, const int root, const Comm &comm, const int bufferSize) { + inline enable_if_not_pointer_not_stl BufferedBcast(T &obj, const int root, const Comm &comm, const int bufferSize) { if (MEL::CommRank(comm) == root) { char *buffer = MEL::MemAlloc(bufferSize); Message msg(buffer, bufferSize); @@ -1501,7 +1501,7 @@ namespace MEL { }; TEMPLATE_T_F2(TransportBufferWrite, TransportBufferRead) - inline enable_if_deep_not_pointer_not_stl BufferedBcast(T &obj, const int root, const Comm &comm) { + inline enable_if_not_pointer_not_stl BufferedBcast(T &obj, const int root, const Comm &comm) { if (MEL::CommRank(comm) == root) { MEL::Deep::BufferedBcast(obj, root, comm, MEL::Deep::BufferSize(obj)); } @@ -1896,7 +1896,7 @@ namespace MEL { }; TEMPLATE_T_F(TransportBufferWrite) - inline enable_if_deep_not_pointer_not_stl BufferedFileWrite(T &obj, MEL::File &file) { + inline enable_if_not_pointer_not_stl BufferedFileWrite(T &obj, MEL::File &file) { MEL::Deep::BufferedFileWrite(obj, file, MEL::Deep::BufferSize(obj)); }; @@ -2069,7 +2069,7 @@ namespace MEL { }; TEMPLATE_T_F(TransportBufferRead) - inline enable_if_deep_not_pointer_not_stl BufferedFileRead(T &obj, MEL::File &file) { + inline enable_if_not_pointer_not_stl BufferedFileRead(T &obj, MEL::File &file) { int bufferSize; char *buffer = nullptr; MEL::Deep::FileRead(buffer, bufferSize, file); @@ -2300,7 +2300,7 @@ namespace MEL { }; TEMPLATE_T_F(TransportBufferWrite) - inline enable_if_deep_not_pointer_not_stl BufferedFileWrite(T &obj, std::ofstream &file, const int bufferSize) { + inline enable_if_not_pointer_not_stl BufferedFileWrite(T &obj, std::ofstream &file, const int bufferSize) { char *buffer = MEL::MemAlloc(bufferSize); Message msg(buffer, bufferSize); msg.packRootVar(obj); @@ -2316,7 +2316,7 @@ namespace MEL { }; TEMPLATE_T_F(TransportBufferWrite) - inline enable_if_deep_not_pointer_not_stl BufferedFileWrite(T &obj, std::ofstream &file) { + inline enable_if_not_pointer_not_stl BufferedFileWrite(T &obj, std::ofstream &file) { MEL::Deep::BufferedFileWrite(obj, file, MEL::Deep::BufferSize(obj)); }; @@ -2489,7 +2489,7 @@ namespace MEL { }; TEMPLATE_T_F(TransportBufferRead) - inline enable_if_deep_not_pointer_not_stl BufferedFileRead(T &obj, std::ifstream &file) { + inline enable_if_not_pointer_not_stl BufferedFileRead(T &obj, std::ifstream &file) { int bufferSize; char *buffer = nullptr; MEL::Deep::FileRead(buffer, bufferSize, file);