MALOC  0.1
vcom.h
1 /*
2  * ***************************************************************************
3  * MALOC = < Minimal Abstraction Layer for Object-oriented C >
4  * Copyright (C) 1994--2006 Michael Holst
5  *
6  * This program is free software; you can redistribute it and/or modify it
7  * under the terms of the GNU General Public License as published by the
8  * Free Software Foundation; either version 2 of the License, or (at your
9  * option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 675 Mass Ave, Cambridge, MA 02139, USA.
19  *
20  * rcsid="$Id: vcom.h,v 1.26 2006/06/03 07:22:30 mholst Exp $"
21  * ***************************************************************************
22  */
23 
24 /*
25  * ***************************************************************************
26  * File: vcom.h < vcom.c >
27  *
28  * Purpose: Class Vcom: virtual (currently just MPI) communications layer
29  *
30  * Author: Nathan Baker and Michael Holst
31  * ***************************************************************************
32  */
33 
34 #ifndef _VCOM_H_
35 #define _VCOM_H_
36 
37 #include <maloc/maloc_base.h>
38 
39 #include <maloc/vsys.h>
40 
41 /* A base value for MPI tags */
42 #define VCOM_MPI_TAG 111
43 
44 /*
45  * ***************************************************************************
46  * Class Vcom: Parameters and datatypes
47  * ***************************************************************************
48  */
49 
50 /*
51  * ***************************************************************************
52  * Class Vcom: Definition
53  * ***************************************************************************
54  */
55 
56 typedef struct Vcom {
57 
58  int mpi_rank; /* Local PE rank from MPI */
59  int mpi_size; /* Total number of PEs in this communicator from MPI */
60 
61  int type; /* Communications type */
62  /* 0 = not initialized */
63  /* 1 = Message Passing Interface 1.1 */
64 
65  int error; /* note if any error has occurred on this vcom device*/
66 
67  void *core; /* Private MPI core */
68 
69 } Vcom;
70 
71 /*
72  * ***************************************************************************
73  * Class Vcom: Inlineable methods (vcom.c)
74  * ***************************************************************************
75  */
76 
77 #if !defined(VINLINE_MALOC)
78 #else /* if defined(VINLINE_MALOC) */
79 #endif /* if !defined(VINLINE_MALOC) */
80 
81 /*
82  * ***************************************************************************
83  * Class Vcom: Non-Inlineable methods (vcom.c)
84  * ***************************************************************************
85  */
86 
87 int Vcom_init(int *argc, char ***argv);
88 int Vcom_finalize(void);
89 
90 Vcom* Vcom_ctor(int commtype);
91 int Vcom_ctor2(Vcom* thee, int commtype);
92 void Vcom_dtor(Vcom **thee);
93 void Vcom_dtor2(Vcom *thee);
94 
95 int Vcom_send(Vcom *thee, int des, void *buf, int len, int type,
96  int block);
97 int Vcom_recv(Vcom *thee, int src, void *buf, int len, int type,
98  int block);
99 int Vcom_getCount(Vcom *thee, int src, int *length, int type);
100 int Vcom_reduce(Vcom *thee, void *sendbuf, void *recvbuf, int length,
101  int type, int op);
102 int Vcom_size(Vcom *thee);
103 int Vcom_resize(Vcom *thee, int newsize);
104 int Vcom_rank(Vcom *thee);
105 int Vcom_barr(Vcom *thee);
106 
107 #endif /* _VCOM_H_ */
108 
109