1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
|
/*@@
@header pugh.h
@author Paul Walker
@date March 1997
@desc
This is just a bunch of includes and some simple definitions.
You should really see @seefile pGF.h @seefile pGH.h and
@seefile pughProtos.h for the pugh bit, and @seefile
pughProblem.h for the cactus-specific bits.
@enddesc
@version $Id$
@@*/
#ifndef _PUGH_H_
#define _PUGH_H_
#include "cctk.h"
/* FIXME */
/* 3 ways up shutting down: */
/*
#define STOP cshutdown(0);
#define ABORT cabort(0);
#define CORE ccore();
*/
#define STOP exit(0);
#define ABORT exit(1);
#define CORE exit(2);
/* Two ways to shut down with a non-zero exit code. */
#define ERROR_STOP(xerrcode) cshutdown(xerrcode);
#define ERROR_ABORT(xerrcode) cabort(xerrcode);
#ifdef MPI
#include "mpi.h"
#endif
/***
Define the different datatypes used for MPI communication
NOTE: the complex datatype is defined in SetupPGH.c
***/
/* char type is easy */
#define PUGH_MPI_CHAR MPI_CHAR
/* floating points are precision-dependent */
#define PUGH_MPI_REAL4 MPI_FLOAT
#ifdef SINGLE_PRECISION
#define PUGH_MPI_REAL MPI_FLOAT
#else
#define PUGH_MPI_REAL MPI_DOUBLE
#endif
/* integers are architecture specific:
PUGH_MPI_INT is used for communicating CCTK_INTs
PUGH_MPI_INT4 is used to explicitely communicate 4 byte integers */
#ifdef CCTK_INTEGER_PRECISION_8
#define PUGH_MPI_INT (sizeof (int) == 8 ? MPI_INT : MPI_LONG)
#elif CCTK_INTEGER_PRECISION_4
#define PUGH_MPI_INT (sizeof (int) == 8 ? MPI_SHORT : MPI_INT)
#elif CCTK_INTEGER_PRECISION_2
#define PUGH_MPI_INT MPI_SHORT
#endif
#define PUGH_MPI_INT4 (sizeof (int) == 8 ? MPI_SHORT : MPI_INT)
#include "pugh_constants.h"
#include "pGV.h"
#include "pGF.h"
#include "pGH.h"
#ifdef MPI
#define CACTUS_MPI_ERROR(xf) do {int errcode; \
if((errcode = xf) != MPI_SUCCESS) \
{ \
char mpi_error_string[MPI_MAX_ERROR_STRING+1]; \
int resultlen; \
MPI_Error_string(errcode, mpi_error_string, &resultlen);\
fprintf(stderr, "MPI Call %s returned error code %d (%s)\n", \
#xf, errcode, mpi_error_string); \
fprintf(stderr, "At line %d of file %s\n", \
__LINE__, __FILE__); \
} \
} while (0)
#endif
#ifdef _cplusplus
extern "C"
{
#endif
int PUGH_SetupGroup
(
pGH *newGH,
int *nsize,
int *nghostsize,
int gtype,
int vtype,
int dim,
int n_variables,
int staggertype,
int n_timelevels
);
pGH *PUGH_SetupPGH(void *callerid,
int dim,
int *nsize,
int *nghostzones,
int staggertype);
int pugh_GFSize(int dim,
int *nsize);
int pugh_GFGhostsize(int dim,
int *ghostsize);
pGH *pugh_pGH(cGH *GH);
#ifdef _cplusplus
}
#endif
/*
#include "pughDriver.h"
*/
#endif /* defined _PUGH_H_ */
|