angel
mercurial changeset:
|
00001 // $Id: angel_comm.hpp,v 1.10 2004/10/16 04:18:17 jean_utke Exp $ 00002 /* 00003 ############################################################# 00004 # This file is part of angel released under the BSD license # 00005 # The full COPYRIGHT notice can be found in the top # 00006 # level directory of the angel distribution # 00007 ############################################################# 00008 */ 00009 00010 #ifndef _angel_comm_include_ 00011 #define _angel_comm_include_ 00012 00013 #ifdef USE_MPI 00014 00015 #include "angel_types.hpp" 00016 #include "gmpi.hpp" 00017 #include "eliminations.hpp" 00018 00019 namespace angel { 00021 typedef GMPI::buffer_t<int> comm_buffer_t; 00022 00024 enum graph_id_t {c_graph_id, line_graph_id, accu_graph_id}; 00025 00026 typedef GMPI::comm_ref_t<int, c_graph_t> c_graph_comm_ref_t; 00027 00028 typedef GMPI::comm_ref_t<int, line_graph_t> line_graph_comm_ref_t; 00029 00030 // Tags used in angel 00031 const int completion_tag= 3377; 00032 00033 } 00034 00035 // additional operators for GMPI 00036 namespace GMPI { 00037 // =============== reading from and writing into buffers =========== 00038 00040 inline const angel::comm_buffer_t& operator>> (const angel::comm_buffer_t& buffer, 00041 angel::c_graph_t::vertex_t& input) { 00042 input= buffer.read (); return buffer; } 00043 00045 inline angel::comm_buffer_t& operator<< (angel::comm_buffer_t& buffer, 00046 const angel::c_graph_t::vertex_t& output) { 00047 buffer.write (output); return buffer; } 00048 00050 inline const angel::comm_buffer_t& operator>> (const angel::comm_buffer_t& buffer, 00051 angel::edge_ij_elim_t& input) { 00052 int tmp; buffer >> input.i >> input.j >> tmp; 00053 input.front= (bool) tmp; return buffer; } 00054 00056 inline angel::comm_buffer_t& operator<< (angel::comm_buffer_t& buffer, 00057 const angel::edge_ij_elim_t& output) { 00058 buffer << output.i << output.j << (int) output.front; return buffer; } 00059 00061 inline const angel::comm_buffer_t& operator>> (const angel::comm_buffer_t& buffer, 00062 angel::triplet_t& input) { 00063 buffer >> input.i >> input.j >> input.k; return buffer; } 00064 00066 inline angel::comm_buffer_t& operator<< (angel::comm_buffer_t& buffer, 00067 const angel::triplet_t& output) { 00068 buffer << output.i << output.j << output.k; return buffer; } 00069 00071 const angel::comm_buffer_t& operator>> (const angel::comm_buffer_t& buffer, 00072 angel::c_graph_t& cg); 00073 00075 angel::comm_buffer_t& operator<< (angel::comm_buffer_t& buffer, const angel::c_graph_t& cg); 00076 00078 const angel::comm_buffer_t& operator>> (const angel::comm_buffer_t& buffer, 00079 angel::line_graph_t& input); 00080 00082 angel::comm_buffer_t& operator<< (angel::comm_buffer_t& buffer, 00083 const angel::line_graph_t& output); 00084 00086 template <typename Ad_graph_t, typename El_spec_t> 00087 const angel::comm_buffer_t& operator>> (const angel::comm_buffer_t& buffer, 00088 angel::elimination_history_t<Ad_graph_t,El_spec_t>& input) { 00089 // Clear graph and sequence 00090 Ad_graph_t empty; input.cg= empty; input.seq.resize (0); 00091 buffer >> input.ccosts >> input.cg >> input.seq; 00092 return buffer; 00093 } 00094 00096 template <typename Ad_graph_t, typename El_spec_t> 00097 angel::comm_buffer_t& operator<< (angel::comm_buffer_t& buffer, 00098 const angel::elimination_history_t<Ad_graph_t,El_spec_t>& input) { 00099 buffer << input.ccosts << input.cg << input.seq; 00100 return buffer; } 00101 00102 } // namespace GMPI 00103 00104 00105 #endif // USE_MPI 00106 00107 #endif // _angel_comm_include_