MPQC 2.3.1

- Main Page
- Related Pages
- Classes
- Files

- File List

messmpi.h

    00001 //
    00002 // messmpi.h
    00003 //
    00004 // Copyright (C) 1996 Limit Point Systems, Inc.
    00005 //
    00006 // Author: Curtis Janssen <cljanss@limitpt.com>
    00007 // Maintainer: LPS
    00008 //
    00009 // This file is part of the SC Toolkit.
    00010 //
    00011 // The SC Toolkit is free software; you can redistribute it and/or modify
    00012 // it under the terms of the GNU Library General Public License as published by
    00013 // the Free Software Foundation; either version 2, or (at your option)
    00014 // any later version.
    00015 //
    00016 // The SC Toolkit is distributed in the hope that it will be useful,
    00017 // but WITHOUT ANY WARRANTY; without even the implied warranty of
    00018 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00019 // GNU Library General Public License for more details.
    00020 //
    00021 // You should have received a copy of the GNU Library General Public License
    00022 // along with the SC Toolkit; see the file COPYING.LIB.  If not, write to
    00023 // the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
    00024 //
    00025 // The U.S. Government is granted a limited license as per AL 91-7.
    00026 //
    00027
    00028 #ifndef _util_group_messmpi_h
    00029 #define _util_group_messmpi_h
    00030
    00031 #include <util/group/message.h>
    00032 #include <util/group/thread.h>
    00033
    00034 #define MPICH_SKIP_MPICXX
    00035 #include <mpi.h>
    00036
    00037 namespace sc {
    00038
    00041 class MPIMessageGrp: public MessageGrp {
    00042   protected:
    00043     void* buf;
    00044     int bufsize;
    00045
    00046     int rnode;
    00047     int rtag;
    00048     int rlen;
    00049
    00051     bool use_messagegrp_collectives_;
    00052
    00054     static int nmpi_grps;
    00056     static Ref<ThreadLock> grplock;
    00057
    00058     Ref<ThreadGrp> threadgrp;
    00060     MPI_Comm commgrp;
    00061
    00063     void init(MPI_Comm comm, int *argc=0, char ***argv=0);
    00064   public:
    00065     MPIMessageGrp();
    00068     MPIMessageGrp(MPI_Comm comm);
    00072     MPIMessageGrp(int *argc, char ***argv);
    00074     MPIMessageGrp(const Ref<KeyVal>&);
    00075     ~MPIMessageGrp();
    00076
    00078     Ref<MessageGrp> clone(void);
    00079
    00080     void raw_send(int target, const void* data, int nbyte);
    00081     void raw_recv(int sender, void* data, int nbyte);
    00082     void raw_sendt(int target, int type, const void* data, int nbyte);
    00083     void raw_recvt(int type, void* data, int nbyte);
    00084
    00085     int probet(int type);
    00086
    00087     void sync();
    00088
    00089     void sum(double*, int n, double*scratch = 0, int target = -1);
    00090     void sum(int*, int n, int*scratch = 0, int target = -1);
    00091
    00092     void reduce(double*, int n, GrpReduce<double>&,
    00093                 double*scratch = 0, int target = -1);
    00094     void reduce(unsigned int*, int n, GrpReduce<unsigned int>&,
    00095                 unsigned int*scratch = 0, int target = -1);
    00096     void reduce(int*, int n, GrpReduce<int>&,
    00097                 int*scratch = 0, int target = -1);
    00098     void reduce(char*, int n, GrpReduce<char>&,
    00099                 char*scratch = 0, int target = -1);
    00100     void reduce(unsigned char*, int n, GrpReduce<unsigned char>&,
    00101                 unsigned char*scratch = 0, int target = -1);
    00102     void reduce(signed char*, int n, GrpReduce<signed char>&,
    00103                 signed char*scratch = 0, int target = -1);
    00104     void reduce(short*, int n, GrpReduce<short>&,
    00105                 short*scratch = 0, int target = -1);
    00106     void reduce(float*, int n, GrpReduce<float>&,
    00107                 float*scratch = 0, int target = -1);
    00108     void reduce(long*, int n, GrpReduce<long>&,
    00109                 long*scratch = 0, int target = -1);
    00110
    00111     void raw_bcast(void* data, int nbyte, int from);
    00112 };
    00113
    00114 }
    00115
    00116 #endif
    00117
    00118 // Local Variables:
    00119 // mode: c++
    00120 // c-file-style: "CLJ"
    00121 // End: