![]()
|
memmtmpi.h00001 //
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 namespace sc {
00044
00045 class MTMPIThread;
00046
00051 class MTMPIMemoryGrp: public ActiveMsgMemoryGrp {
00052 private:
00053 Ref<ThreadGrp> th_;
00054
00055 Ref<ThreadLock> serial_lock_;
00056 int serial_;
00057 int serial(int node);
00058
00059 MPI_Comm comp_comm_;
00060 MPI_Comm comm_comm_;
00061 int req_tag_;
00062
00063 int active_;
00064
00065 unsigned int *nreq_sent_;
00066 unsigned int *nreq_sent_buf_;
00067
00068 MTMPIThread **thread_;
00069 Ref<ThreadLock> print_lock_; // needed for debugging only
00070 std::ofstream hout; // handler out
00071 std::ofstream mout; // main thread out
00072
00073 void init_mtmpimg(MPI_Comm comm, int nthreads);
00074
00075 // parent class pure virtuals
00076 void retrieve_data(void *, int node, int offset, int size, int lock);
00077 void replace_data(void *, int node, int offset, int size, int unlock);
00078 void sum_data(double *data, int node, int doffset, int dsize);
00079
00080 friend class MTMPIThread;
00081 public:
00086 MTMPIMemoryGrp(const Ref<MessageGrp>& msg, const Ref<ThreadGrp> &th,
00087 MPI_Comm comm = MPI_COMM_WORLD);
00090 MTMPIMemoryGrp(const Ref<KeyVal> &);
00091 ~MTMPIMemoryGrp();
00092
00093 void activate();
00094 void deactivate();
00095
00096 void sync();
00097 };
00098
00099 }
00100
00101 #endif
00102
00103 // Local Variables:
00104 // mode: c++
00105 // c-file-style: "CLJ"
00106 // End:
Generated at Fri Jan 10 08:14:09 2003 for MPQC 2.1.3 using the documentation package Doxygen 1.2.14. |