![]()
|
messmpi.h00001 //
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 #include <mpi.h>
00035
00036 namespace sc {
00037
00040 class MPIMessageGrp: public MessageGrp {
00041 protected:
00042 void* buf;
00043 int bufsize;
00044
00045 int rnode;
00046 int rtag;
00047 int rlen;
00048
00050 static int nmpi_grps;
00052 static Ref<ThreadLock> grplock;
00053
00054 Ref<ThreadGrp> threadgrp;
00056 MPI_Comm commgrp;
00057
00058 #if HAVE_P4
00059 int nlocal; // the number of processes on the master cluster
00060 int nremote; // the number of remote clusters
00061 char *master; // the name of the master cluster
00062 char * jobid; // a unique job name selected by the user
00063
00064 struct p4_cluster {
00065 char *hostname; // name of the remote cluster
00066 int nslaves; // the number of slaves on the remote cluster
00067 } *remote_clusters;
00068
00069 struct p4_cluster * my_node_info(const char[], int&);
00070 #endif
00071
00072 void init(MPI_Comm comm, int *argc=0, char ***argv=0);
00073 public:
00074 MPIMessageGrp();
00077 MPIMessageGrp(MPI_Comm comm);
00081 MPIMessageGrp(int *argc, char ***argv);
00083 MPIMessageGrp(const Ref<KeyVal>&);
00084 ~MPIMessageGrp();
00085
00087 Ref<MessageGrp> clone(void);
00088
00089 void raw_send(int target, void* data, int nbyte);
00090 void raw_recv(int sender, void* data, int nbyte);
00091 void raw_sendt(int target, int type, void* data, int nbyte);
00092 void raw_recvt(int type, void* data, int nbyte);
00093
00094 int probet(int type);
00095
00096 void sync();
00097
00098 void reduce(double*, int n, GrpReduce<double>&,
00099 double*scratch = 0, int target = -1);
00100 void reduce(unsigned int*, int n, GrpReduce<unsigned int>&,
00101 unsigned int*scratch = 0, int target = -1);
00102 void reduce(int*, int n, GrpReduce<int>&,
00103 int*scratch = 0, int target = -1);
00104 void reduce(char*, int n, GrpReduce<char>&,
00105 char*scratch = 0, int target = -1);
00106 void reduce(unsigned char*, int n, GrpReduce<unsigned char>&,
00107 unsigned char*scratch = 0, int target = -1);
00108 void reduce(signed char*, int n, GrpReduce<signed char>&,
00109 signed char*scratch = 0, int target = -1);
00110 void reduce(short*, int n, GrpReduce<short>&,
00111 short*scratch = 0, int target = -1);
00112 void reduce(float*, int n, GrpReduce<float>&,
00113 float*scratch = 0, int target = -1);
00114 void reduce(long*, int n, GrpReduce<long>&,
00115 long*scratch = 0, int target = -1);
00116
00117 void raw_bcast(void* data, int nbyte, int from);
00118 };
00119
00120 }
00121
00122 #endif
00123
00124 // Local Variables:
00125 // mode: c++
00126 // c-file-style: "CLJ"
00127 // End:
Generated at Fri Jan 10 08:14:09 2003 for MPQC 2.1.3 using the documentation package Doxygen 1.2.14. |