- Main Page
- Related Pages
- Classes
- Files

# 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 #define MPICH_SKIP_MPICXX
    00038 #include <mpi.h>
    00039
    00040 #include <util/group/message.h>
    00041 #include <util/group/memamsg.h>
    00042 #include <util/group/thread.h>
    00043
    00044 namespace sc {
    00045
    00046 class MTMPIThread;
    00047
    00052 class MTMPIMemoryGrp: public ActiveMsgMemoryGrp {
    00053   private:
    00054     Ref<ThreadGrp> th_;
    00055
    00056     Ref<ThreadLock> serial_lock_;
    00057     int serial_;
    00058     int serial(int node);
    00059
    00060     MPI_Comm comp_comm_;
    00061     MPI_Comm comm_comm_;
    00062     int req_tag_;
    00063
    00064     int active_;
    00065
    00066     unsigned int *nreq_sent_;
    00067     unsigned int *nreq_sent_buf_;
    00068
    00069     MTMPIThread **thread_;
    00070     Ref<ThreadLock> print_lock_; // needed for debugging only
    00071     std::ofstream hout; // handler out
    00072     std::ofstream mout; // main thread out
    00073
    00074     void init_mtmpimg(MPI_Comm comm, int nthreads);
    00075
    00076     // parent class pure virtuals
    00077     void retrieve_data(void *, int node, int offset, int size, int lock);
    00078     void replace_data(void *, int node, int offset, int size, int unlock);
    00079     void sum_data(double *data, int node, int doffset, int dsize);
    00080
    00081     friend class MTMPIThread;
    00082   public:
    00087     MTMPIMemoryGrp(const Ref<MessageGrp>& msg, const Ref<ThreadGrp> &th,
    00088                    MPI_Comm comm = MPI_COMM_WORLD);
    00091     MTMPIMemoryGrp(const Ref<KeyVal> &);
    00092     ~MTMPIMemoryGrp();
    00093
    00094     void activate();
    00095     void deactivate();
    00096
    00097     void sync();
    00098 };
    00099
    00100 }
    00101
    00102 #endif
    00103
    00104 // Local Variables:
    00105 // mode: c++
    00106 // c-file-style: "CLJ"
    00107 // End: