-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patheasywave.h
126 lines (93 loc) · 3.64 KB
/
easywave.h
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
/*
* EasyWave - A realtime tsunami simulation program with GPU support.
* Copyright (C) 2014 Andrey Babeyko, Johannes Spazier
* GFZ German Research Centre for Geosciences (http://www.gfz-potsdam.de)
*
* Parts of this program (especially the GPU extension) were developed
* within the context of the following publicly funded project:
* - TRIDEC, EU 7th Framework Programme, Grant Agreement 258723
* (http://www.tridec-online.eu)
*
* Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
* the European Commission - subsequent versions of the EUPL (the "Licence"),
* complemented with the following provision: For the scientific transparency
* and verification of results obtained and communicated to the public after
* using a modified version of the work, You (as the recipient of the source
* code and author of this modified version, used to produce the published
* results in scientific communications) commit to make this modified source
* code available in a repository that is easily and freely accessible for a
* duration of five years after the communication of the obtained results.
*
* You may not use this work except in compliance with the Licence.
*
* You may obtain a copy of the Licence at:
* https://joinup.ec.europa.eu/software/page/eupl
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the Licence is distributed on an "AS IS" basis,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the Licence for the specific language governing permissions and
* limitations under the Licence.
*/
#ifndef EASYWAVE_H
#define EASYWAVE_H
#define Re 6384.e+3 // Earth radius
#define Gravity 9.81 // gravity acceleration
#define Omega 7.29e-5 // Earth rotation period [1/sec]
namespace easywave {
using gpu_api_type_t = enum class GpuApiType { UNKNOWN, CUDA, HIP, SYCL };
}
#ifdef SYCL_LANGUAGE_VERSION
// Needs to be included before ewdefs to avoid nasty clash with idx preprocessor define.
#include <CL/sycl.hpp>
#define EW_GPU_ENABLED 1
#define DEVICE_FUNCTION /* empty */
#define HOST_FUNCTION /* empty */
constexpr easywave::gpu_api_type_t api = easywave::GpuApiType::SYCL;
namespace easywave { using quad_int_t = cl::sycl::int4; }
#elif defined(__CUDACC__)
#include <cuda.h>
#define DEVICE_FUNCTION __device__
#define HOST_FUNCTION __host__
#define EW_GPU_ENABLED 1
constexpr easywave::gpu_api_type_t api = easywave::GpuApiType::CUDA;
namespace easywave { using quad_int_t = int4; }
#elif defined(__HIPCC__)
#define DEVICE_FUNCTION __device__
#define HOST_FUNCTION __host__
#include "hip/hip_runtime.h"
#define EW_GPU_ENABLED 1
constexpr easywave::gpu_api_type_t api = easywave::GpuApiType::HIP;
namespace easywave { using quad_int_t = int4; }
#else
#include <array>
#define DEVICE_FUNCTION /* empty */
#define HOST_FUNCTION /* empty */
#undef EW_GPU_ENABLED
constexpr easywave::gpu_api_type_t api = easywave::GpuApiType::UNKNOWN;
namespace easywave { using quad_int_t = std::array<int, 4>; }
#endif /* GPU programming model */
#include "ewdefs.h"
int ewLoadBathymetry();
int ewParam( int argc, char **argv );
void ewLogParams(void);
int ewReset();
int ewSource();
int ewStep();
int ewStepCor();
int ewStart2DOutput();
int ewOut2D();
int ewDump2D();
int ewLoadPOIs();
int ewSavePOIs();
int ewDumpPOIs();
int ewDumpPOIsCompact( int istage );
extern int NPOIs;
extern long *idxPOI;
#define NUM_DURATIONS 5
extern float dur[NUM_DURATIONS];
#include "ewNode.h"
extern CNode *gNode;
/* verbose printf: only executed if -verbose was set */
#define printf_v( Args, ... ) if( Par.verbose ) printf( Args, ##__VA_ARGS__);
#endif /* EASYWAVE_H */