Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

memmtmpi.h

00001 //
00002 // memmtmpi.h
00003 // based on memmpi.h
00004 //
00005 // Copyright (C) 1996 Limit Point Systems, Inc.
00006 //
00007 // Author: Curtis Janssen <cljanss@limitpt.com>
00008 // Maintainer: LPS
00009 //
00010 // This file is part of the SC Toolkit.
00011 //
00012 // The SC Toolkit is free software; you can redistribute it and/or modify
00013 // it under the terms of the GNU Library General Public License as published by
00014 // the Free Software Foundation; either version 2, or (at your option)
00015 // any later version.
00016 //
00017 // The SC Toolkit is distributed in the hope that it will be useful,
00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 // GNU Library General Public License for more details.
00021 //
00022 // You should have received a copy of the GNU Library General Public License
00023 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
00024 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
00025 //
00026 // The U.S. Government is granted a limited license as per AL 91-7.
00027 //
00028 
00029 #ifdef __GNUC__
00030 #pragma interface
00031 #endif
00032 
00033 #ifndef _util_group_memmtmpi_h
00034 #define _util_group_memmtmpi_h
00035 
00036 #include <fstream>
00037 #include <mpi.h>
00038 
00039 #include <util/group/message.h>
00040 #include <util/group/memamsg.h>
00041 #include <util/group/thread.h>
00042 
00043 class MTMPIThread;
00044 
00049 class MTMPIMemoryGrp: public ActiveMsgMemoryGrp {
00050   private:
00051     Ref<ThreadGrp> th_;
00052 
00053     Ref<ThreadLock> serial_lock_;
00054     int serial_;
00055     int serial(int node);
00056 
00057     MPI_Comm comm_;
00058 
00059     int req_tag_;
00060 
00061     int active_;
00062 
00063     unsigned int *nreq_sent_;
00064     unsigned int *nreq_sent_buf_;
00065 
00066     MTMPIThread **thread_;
00067     Ref<ThreadLock> print_lock_; // needed for debugging only
00068     std::ofstream hout; // handler out
00069     std::ofstream mout; // main thread out
00070 
00071     void init_mtmpimg(int nthreads);
00072 
00073     // parent class pure virtuals
00074     void retrieve_data(void *, int node, int offset, int size, int lock);
00075     void replace_data(void *, int node, int offset, int size, int unlock);
00076     void sum_data(double *data, int node, int doffset, int dsize);
00077 
00078     friend class MTMPIThread;
00079   public:
00080     MTMPIMemoryGrp(const Ref<MessageGrp>& msg, const Ref<ThreadGrp> &th);
00081     MTMPIMemoryGrp(const Ref<KeyVal> &);
00082     ~MTMPIMemoryGrp();
00083 
00084     void activate();
00085     void deactivate();
00086 
00087     void sync();
00088 };
00089 
00090 #endif
00091 
00092 // Local Variables:
00093 // mode: c++
00094 // c-file-style: "CLJ"
00095 // End:

Generated at Thu Oct 4 18:08:45 2001 for MPQC 2.0.0 using the documentation package Doxygen 1.2.5.