source: ThirdParty/mpqc_open/src/lib/util/group/messmpi.h@ 7516f6

Action_Thermostats Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.1 ChemicalSpaceEvaluator Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Exclude_Hydrogens_annealWithBondGraph Fix_Verbose_Codepatterns ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion Gui_displays_atomic_force_velocity JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool PythonUI_with_named_parameters Recreated_GuiChecks StoppableMakroAction TremoloParser_IncreasedPrecision
Last change on this file since 7516f6 was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100644
File size: 4.0 KB
Line 
1//
2// messmpi.h
3//
4// Copyright (C) 1996 Limit Point Systems, Inc.
5//
6// Author: Curtis Janssen <cljanss@limitpt.com>
7// Maintainer: LPS
8//
9// This file is part of the SC Toolkit.
10//
11// The SC Toolkit is free software; you can redistribute it and/or modify
12// it under the terms of the GNU Library General Public License as published by
13// the Free Software Foundation; either version 2, or (at your option)
14// any later version.
15//
16// The SC Toolkit is distributed in the hope that it will be useful,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19// GNU Library General Public License for more details.
20//
21// You should have received a copy of the GNU Library General Public License
22// along with the SC Toolkit; see the file COPYING.LIB. If not, write to
23// the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24//
25// The U.S. Government is granted a limited license as per AL 91-7.
26//
27
28#ifndef _util_group_messmpi_h
29#define _util_group_messmpi_h
30
31#include <util/group/message.h>
32#include <util/group/thread.h>
33
34#define MPICH_SKIP_MPICXX
35#include <mpi.h>
36
37namespace sc {
38
39/** The MPIMessageGrp class is an concrete implementation of MessageGrp
40that uses the MPI 1 library. */
41class MPIMessageGrp: public MessageGrp {
42 protected:
43 void* buf;
44 int bufsize;
45
46 int rnode;
47 int rtag;
48 int rlen;
49
50 /// If true use the generic collective routines in the base class
51 bool use_messagegrp_collectives_;
52
53 /// Number of MPIMessageGrp's currently in use.
54 static int nmpi_grps;
55 /// lock to access nmpi_grps variable
56 static Ref<ThreadLock> grplock;
57
58 Ref<ThreadGrp> threadgrp;
59 /// Currently each commgrp is a dup of MPI_COMM_WORLD
60 MPI_Comm commgrp;
61
62 /// Not thread-safe due to race condition on nmpi_grps variable.
63 void init(MPI_Comm comm, int *argc=0, char ***argv=0);
64 public:
65 MPIMessageGrp();
66 /** Use an MPI communicator to create a MessageGrp. The comm
67 argument could be a subset of MPI_COMM_WORLD, for example. */
68 MPIMessageGrp(MPI_Comm comm);
69 /** Use argc and argv to create a MPIMessageGrp. This would
70 have to be used for implementations of MPI that have MPI_Init
71 fill in argc and argv. */
72 MPIMessageGrp(int *argc, char ***argv);
73 /** Construction MPIMessageGrp given a KeyVal input object. */
74 MPIMessageGrp(const Ref<KeyVal>&);
75 ~MPIMessageGrp();
76
77 /// Clones (dups) an MPIMessageGrp from MPI_COMM_WORLD
78 Ref<MessageGrp> clone(void);
79
80 void raw_send(int target, const void* data, int nbyte);
81 void raw_recv(int sender, void* data, int nbyte);
82 void raw_sendt(int target, int type, const void* data, int nbyte);
83 void raw_recvt(int type, void* data, int nbyte);
84
85 int probet(int type);
86
87 void sync();
88
89 void sum(double*, int n, double*scratch = 0, int target = -1);
90 void sum(int*, int n, int*scratch = 0, int target = -1);
91
92 void reduce(double*, int n, GrpReduce<double>&,
93 double*scratch = 0, int target = -1);
94 void reduce(unsigned int*, int n, GrpReduce<unsigned int>&,
95 unsigned int*scratch = 0, int target = -1);
96 void reduce(int*, int n, GrpReduce<int>&,
97 int*scratch = 0, int target = -1);
98 void reduce(char*, int n, GrpReduce<char>&,
99 char*scratch = 0, int target = -1);
100 void reduce(unsigned char*, int n, GrpReduce<unsigned char>&,
101 unsigned char*scratch = 0, int target = -1);
102 void reduce(signed char*, int n, GrpReduce<signed char>&,
103 signed char*scratch = 0, int target = -1);
104 void reduce(short*, int n, GrpReduce<short>&,
105 short*scratch = 0, int target = -1);
106 void reduce(float*, int n, GrpReduce<float>&,
107 float*scratch = 0, int target = -1);
108 void reduce(long*, int n, GrpReduce<long>&,
109 long*scratch = 0, int target = -1);
110
111 void raw_bcast(void* data, int nbyte, int from);
112};
113
114}
115
116#endif
117
118// Local Variables:
119// mode: c++
120// c-file-style: "CLJ"
121// End:
Note: See TracBrowser for help on using the repository browser.