messmpi.h
//
// messmpi.h
//
// Copyright (C) 1996 Limit Point Systems, Inc.
//
// Author: Curtis Janssen <cljanss@limitpt.com>
// Maintainer: LPS
//
// This file is part of the SC Toolkit.
//
// The SC Toolkit is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as published by
// the Free Software Foundation; either version 2, or (at your option)
// any later version.
//
// The SC Toolkit is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Library General Public License for more details.
//
// You should have received a copy of the GNU Library General Public License
// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
//
// The U.S. Government is granted a limited license as per AL 91-7.
//
#ifndef _util_group_messmpi_h
#define _util_group_messmpi_h
#include <util/group/message.h>
#include <util/group/thread.h>
#define MPICH_SKIP_MPICXX
#include <mpi.h>
namespace sc {
class MPIMessageGrp: public MessageGrp {
protected:
void* buf;
int bufsize;
int rnode;
int rtag;
int rlen;
bool use_messagegrp_collectives_;
static int nmpi_grps;
static Ref<ThreadLock> grplock;
Ref<ThreadGrp> threadgrp;
MPI_Comm commgrp;
void init(MPI_Comm comm, int *argc=0, char ***argv=0);
public:
MPIMessageGrp();
MPIMessageGrp(MPI_Comm comm);
MPIMessageGrp(int *argc, char ***argv);
MPIMessageGrp(const Ref<KeyVal>&);
~MPIMessageGrp();
Ref<MessageGrp> clone(void);
void raw_send(int target, const void* data, int nbyte);
void raw_recv(int sender, void* data, int nbyte);
void raw_sendt(int target, int type, const void* data, int nbyte);
void raw_recvt(int type, void* data, int nbyte);
int probet(int type);
void sync();
void sum(double*, int n, double*scratch = 0, int target = -1);
void sum(int*, int n, int*scratch = 0, int target = -1);
void reduce(double*, int n, GrpReduce<double>&,
double*scratch = 0, int target = -1);
void reduce(unsigned int*, int n, GrpReduce<unsigned int>&,
unsigned int*scratch = 0, int target = -1);
void reduce(int*, int n, GrpReduce<int>&,
int*scratch = 0, int target = -1);
void reduce(char*, int n, GrpReduce<char>&,
char*scratch = 0, int target = -1);
void reduce(unsigned char*, int n, GrpReduce<unsigned char>&,
unsigned char*scratch = 0, int target = -1);
void reduce(signed char*, int n, GrpReduce<signed char>&,
signed char*scratch = 0, int target = -1);
void reduce(short*, int n, GrpReduce<short>&,
short*scratch = 0, int target = -1);
void reduce(float*, int n, GrpReduce<float>&,
float*scratch = 0, int target = -1);
void reduce(long*, int n, GrpReduce<long>&,
long*scratch = 0, int target = -1);
void raw_bcast(void* data, int nbyte, int from);
};
}
#endif
// Local Variables:
// mode: c++
// c-file-style: "CLJ"
// End: