65 template<
class T1,
unsigned Dim,
class RHS,
class Op>
81 typedef typename RHS::PETE_Return_t T2;
87 T1 lhs_compressed_data;
88 T2 rhs_compressed_data;
89 LFI lhs_i(lhs_compressed_data);
90 RFI rhs_i(rhs_compressed_data);
101 typedef std::multimap< NDIndex<Dim> ,
LField<T1,Dim>* , std::less<NDIndex<Dim> > >
103 ac_recv_type recv_ac;
110 ASSIGNMSG(msg <<
"Processing send-loop for " << nprocs <<
" nodes." <<
endl);
116 bool* recvmsg =
new bool[nprocs];
118 for (iproc=0; iproc<nprocs; ++iproc) {
120 recvmsg[iproc] =
false;
126 for (lf_i = lhs.
begin_if(); lf_i != lf_e; ++lf_i) {
135 for (rv_i = range.first; rv_i != range.second; ++rv_i) {
143 int rnode = (*rv_i).second->getNode();
144 recvmsg[rnode] =
true;
151 for (rf_i = rhs.
begin_if(); rf_i != rf_e; ++rf_i) {
161 for (remote_i = range.first; remote_i != range.second; ++remote_i) {
166 int rnode = (*remote_i).second->getNode();
169 rhs_i = rf.
begin(intersection, rhs_compressed_data);
173 if (mess[rnode] == 0)
176 rhs_i.putMessage(*mess[rnode]);
183 for (iproc=0; iproc<nprocs; ++iproc)
184 if (recvmsg[iproc]) ++remaining;
190 for (iproc=0; iproc<nprocs; ++iproc) {
191 if (mess[iproc] != 0)
205 ASSIGNMSG(msg <<
" local lhs blocks and ");
208 for (lf_i = lhs.
begin_if(); lf_i != lf_e; ++lf_i) {
215 ASSIGNMSG(msg <<
"Assigning to local LField with owned = " << lo);
219 for (rf_i = rhs.
begin_if(); rf_i != rf_e; ++rf_i) {
226 ASSIGNMSG(msg <<
"Computing assignment of portion of rhs " << ro);
234 ASSIGNMSG(msg <<
"Checking for possible compressed-assign:");
235 ASSIGNMSG(msg <<
"\n rf.IsCompressed = " << c1);
236 ASSIGNMSG(msg <<
"\n lf.IsCompressed = " << c2);
237 ASSIGNMSG(msg <<
"\n ro.contains(lo) = " << c3);
241 if (c1 && c2 && c3) {
242 ASSIGNMSG(msg <<
"LHS, RHS both compressed, and rhs contains lhs, ");
250 ASSIGNMSG(msg <<
"Intersection is " << intersection <<
endl);
253 RFI rhs_i2 = rf.
begin(intersection);
259 if (rhs_i2.CanCompress(*rf.
begin(intersection)) &&
264 ASSIGNMSG(msg <<
"LHS BF is compressible, rhs_i2 compressed, ");
265 ASSIGNMSG(msg <<
"intersection contains ");
266 ASSIGNMSG(msg << la <<
", assignment ==> compress assign.");
281 ASSIGNMSG(msg <<
"Cannot do compressed assign, so do loop."<<
endl);
287 LFI lhs_i2 = lf.
begin(intersection);
301 ASSIGNMSG(msg <<
"Processing receive-loop for " << nprocs<<
" nodes."<<
endl);
304 while (remaining>0) {
312 int ndoms = rmess->
size() / (
Dim+3);
313 for (
int idom=0; idom<ndoms; ++idom) {
319 T2 rhs_compressed_data2;
320 RFI rhs_i2(rhs_compressed_data2);
321 rhs_i2.getMessage(*rmess);
325 PAssert( hit != recv_ac.end() );
333 (*rhs_i2 == *lf.
begin())) )
340 LFI lhs_i2 = lf.
begin(intersection);
347 recv_ac.erase( hit );
355 ASSIGNMSG(msg <<
"Filling GC's at end if necessary ..." <<
endl);
362 ASSIGNMSG(msg <<
"Trying to compress BareField at end ..." <<
endl);
T * value_type(const SliceIterator< T > &)
void assign(const BareField< T1, Dim > &clhs, RHS rhsp, Op op, ExprTag< false >)
void PETE_apply(const OpPeriodic< T > &, T &a, const T &b)
Inform & endl(Inform &inf)
std::string::iterator iterator
Message & getMessage(Message &m)
bool touches(const NDIndex< Dim > &) const
bool contains(const NDIndex< Dim > &a) const
Message & putMessage(Message &m) const
NDIndex< Dim > intersect(const NDIndex< Dim > &) const
bool containsAllPoints(const NDIndex< Dim > &b) const
void fillGuardCellsIfNotDirty() const
const NDIndex< Dim > & getDomain() const
ac_id_larray::const_iterator const_iterator_if
ac_id_larray::iterator iterator_if
bool compressible() const
ac_id_larray::size_type size_if() const
const GuardCellSizes< Dim > & getGuardCellSizes() const
Layout_t & getLayout() const
bool IsCompressed() const
const NDIndex< Dim > & getOwned() const
const NDIndex< Dim > & getAllocated() const
const iterator & begin() const
void Uncompress(bool fill_domain=true)
touch_range_dv touch_range_rdv(const NDIndex< Dim > &domain, const GuardCellSizes< Dim > &gc=gc0()) const
std::pair< touch_iterator_dv, touch_iterator_dv > touch_range_dv
bool send(Message *, int node, int tag, bool delmsg=true)
Message * receive_block(int &node, int &tag)
int next_tag(int t, int s=1000)
static Communicate * Comm