#include "ep_lib.hpp" #include #include "ep_declaration.hpp" #include #include #include "ep_mpi.hpp" using namespace std; namespace ep_lib { ep_intercomm::ep_intercomm() { intercomm_rank_map = NULL; local_rank_map = NULL; remote_rank_map = NULL; mpi_inter_comm = new ::MPI_Comm; } bool ep_intercomm::operator == (ep_intercomm right) { bool a = intercomm_rank_map == right.intercomm_rank_map; bool b = local_rank_map == right.local_rank_map; bool c = remote_rank_map == right.remote_rank_map; bool d = *(static_cast< ::MPI_Comm*>(mpi_inter_comm)) == *(static_cast< ::MPI_Comm*>(right.mpi_inter_comm)); bool e = size_rank_info == right.size_rank_info; bool f = intercomm_tag == right.intercomm_tag; return a&&b&&c&&d&&e&&f; } bool ep_intercomm::operator != (ep_intercomm right) { bool a = intercomm_rank_map != right.intercomm_rank_map; bool b = local_rank_map != right.local_rank_map; bool c = remote_rank_map != right.remote_rank_map; bool d = *(static_cast< ::MPI_Comm*>(mpi_inter_comm)) != *(static_cast< ::MPI_Comm*>(right.mpi_inter_comm)); bool e = size_rank_info != right.size_rank_info; bool f = intercomm_tag != right.intercomm_tag; return a||b||c||d||e||f; } ep_communicator::ep_communicator() { comm_list = NULL; message_queue = NULL; intercomm = NULL; } MPI_Message::MPI_Message(void* message) { mpi_message = new ::MPI_Message; *(static_cast< ::MPI_Message*>(mpi_message)) = *(static_cast< ::MPI_Message*>(message)); } MPI_Info::MPI_Info(void* info) { mpi_info = new ::MPI_Info; *(static_cast< ::MPI_Info*>(mpi_info)) = *(static_cast< ::MPI_Info*>(info)); } MPI_Info::MPI_Info() { mpi_info = new ::MPI_Info; *(static_cast< ::MPI_Info*>(mpi_info)) = *(static_cast< ::MPI_Info*>(MPI_INFO_NULL.mpi_info)); } MPI_Request::MPI_Request(void* request) { mpi_request = new ::MPI_Request; *(static_cast< ::MPI_Request*>(mpi_request)) = *static_cast< ::MPI_Request*>(request); } MPI_Aint::MPI_Aint(void* aint) { mpi_aint = new ::MPI_Aint; *(static_cast< ::MPI_Aint*>(mpi_aint)) = *(static_cast< ::MPI_Aint*>(aint)); } MPI_Fint::MPI_Fint(void* fint) { mpi_fint = new ::MPI_Fint; *(static_cast< ::MPI_Fint*>(mpi_fint)) = *(static_cast< ::MPI_Fint*>(fint)); } bool ep_communicator::operator == (ep_communicator right) { bool a = size_rank_info == right.size_rank_info; bool b = comm_label == right.comm_label; bool c = intercomm == right.intercomm; return a&&b&&c; } bool ep_communicator::operator != (ep_communicator right) { bool a = size_rank_info != right.size_rank_info; bool b = comm_label != right.comm_label; bool c = intercomm != right.intercomm; return a||b||c; } MPI_Comm::MPI_Comm() { is_ep = true; is_intercomm = false; my_buffer = NULL; ep_barrier = NULL; rank_map = NULL; ep_comm_ptr = NULL; mem_bridge = NULL; mpi_bridge = NULL; mpi_comm = new ::MPI_Comm; } MPI_Comm::MPI_Comm(void* comm) { is_ep = false; is_intercomm = false; my_buffer = NULL; ep_barrier = NULL; rank_map = NULL; ep_comm_ptr = NULL; mem_bridge = NULL; mpi_bridge = NULL; mpi_comm = new ::MPI_Comm; *(static_cast< ::MPI_Comm*>(mpi_comm)) = *(static_cast< ::MPI_Comm*>(comm)); } bool MPI_Comm::operator == (MPI_Comm right) { bool a = is_ep == right.is_ep; bool b = is_intercomm == right.is_intercomm; bool c = *(static_cast< ::MPI_Comm*>(mpi_comm)) == *(static_cast< ::MPI_Comm*>(right.mpi_comm)); bool d = is_ep ? ep_comm_ptr == right.ep_comm_ptr : true; return a&&b&&c&&d; } bool MPI_Comm::operator != (MPI_Comm right) { bool a = is_ep != right.is_ep; bool b = is_intercomm != right.is_intercomm; bool c = *(static_cast< ::MPI_Comm*>(mpi_comm)) != *(static_cast< ::MPI_Comm*>(right.mpi_comm)); bool d = is_ep ? ep_comm_ptr != right.ep_comm_ptr : true; return a||b||c||d; } bool MPI_Request::operator == (MPI_Request right) { bool b = type == right.type; bool c = buf == right.buf; bool d = ep_src == right.ep_src; bool e = ep_tag == right.ep_tag; bool f = ep_datatype == right.ep_datatype; return b&&c&&d&&e&&f; } }