/usr/include/linbox/util/mpicpp.inl is in liblinbox-dev 1.3.2-1.1build2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 | /* Copyright (C) 2010 LinBox
*
*
*
* ========LICENCE========
* This file is part of the library LinBox.
*
* LinBox is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
* ========LICENCE========
*/
#ifndef __LINBOX_mpicpp_INL
#define __LINBOX_mpicpp_INL
// BRYAN - changed the iterator specific lines to simply
// sizeof (int *)'s... also updated the .h file to not
// define these functions as having default parameters,
// as mpicxx compiler was having trouble with this
namespace LinBox
{
Communicator::Communicator(MPI_Comm comm = MPI_COMM_NULL) :
_mpi_comm(comm), _mpi_boss(false)
{}
// MPI_initializing constructor
// When this communicator is destroyed MPI is shut down (finalized).
Communicator::Communicator(int* ac, char*** av) :
_mpi_comm(MPI_COMM_WORLD), _mpi_boss(true)
{ MPI_Init(ac, av); }
// copy constructor
Communicator::Communicator(const Communicator& D) :
_mpi_comm(D._mpi_comm), _mpi_boss(false), stat(D.stat)
{}
Communicator::~Communicator()
{ if (_mpi_boss) MPI_Finalize(); }
// accessors
int Communicator::size()
{ int s; MPI_Comm_size(_mpi_comm, &s); return s; }
int Communicator::rank()
{ int r; MPI_Comm_rank(_mpi_comm, &r); return r; }
MPI_Status Communicator::status()
{ return stat; }
MPI_Comm Communicator::mpi_communicator()
{ return _mpi_comm; }
// peer to peer communication
template < class Ptr >
void Communicator::send( Ptr b, Ptr e, int dest, int tag = 0)
{
MPI_Send( &*b,
(e - b)*sizeof(typename Ptr::value_type),
MPI_BYTE,
dest,
tag,
_mpi_comm);
}
template < class Ptr >
void Communicator::ssend( Ptr b, Ptr e, int dest, int tag = 0)
{ MPI_Ssend( &b[0],
//(e - b)*sizeof(iterator_traits<Ptr>::value_type),
(e-b)*sizeof(int *),
MPI_BYTE,
dest,
tag,
_mpi_comm);
}
template < class Ptr >
void Communicator::recv( Ptr b, Ptr e, int dest, int tag = 0)
{
MPI_Recv( &b[0],
(e - b)*sizeof(typename Ptr::value_type),
MPI_BYTE,
dest,
tag,
_mpi_comm,
&stat);
}
template < class X >
void Communicator::send( X *b, X *e, int dest, int tag = 0)
{
MPI_Send( b,
(e - b)*sizeof(X),
MPI_BYTE,
dest,
tag,
_mpi_comm);
}
template < class X >
void Communicator::recv( X *b, X *e, int dest, int tag = 0)
{
MPI_Recv( b,
(e - b)*sizeof(X),
MPI_BYTE,
dest,
tag,
_mpi_comm,
&stat);
}
// whole object send and recv
template < class X >
void Communicator::send( X& b, int dest /*, int tag = 0 */)
{ MPI_Send(&b,
sizeof(X),
MPI_BYTE,
dest,
0,
_mpi_comm);
}
template < class X >
void Communicator::ssend( X& b, int dest /*, int tag = 0 */)
{ MPI_Ssend(&b,
sizeof(X),
MPI_BYTE,
dest,
0,
_mpi_comm);
}
template < class X >
void Communicator::bsend(X& b, int dest /*, int tag = 0*/)
{ MPI_Bsend( &b,
sizeof(X),
MPI_BYTE,
dest,
0,
_mpi_comm);
}
template < class X >
void Communicator::recv( X& b, int dest /*, int tag = 0*/)
{ MPI_Recv( &b,
sizeof(X),
MPI_BYTE,
dest,
0,
_mpi_comm,
&stat);
}
template < class X >
void Communicator::buffer_attach(X b)
{
MPI_Buffer_attach( malloc(sizeof(X) * 60) ,
sizeof(X) * 60 );
}
template < class X >
int Communicator::buffer_detach(X &b, int *size)
{ return MPI_Buffer_detach( &b,
size);
}
// collective communication
template < class Ptr, class Function_object >
void Communicator::reduce( Ptr bloc, Ptr eloc, Ptr bres, Function_object binop, int root)
{}
// member access
MPI_Status Communicator::get_stat()
{
return stat;
}
} // namespace LinBox
#endif // __LINBOX_mpicpp_INL
// vim:sts=8:sw=8:ts=8:noet:sr:cino=>s,f0,{0,g0,(0,:0,t0,+0,=s
// Local Variables:
// mode: C++
// tab-width: 8
// indent-tabs-mode: nil
// c-basic-offset: 8
// End:
|