This repository has been archived by the owner on Jun 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadvec_mom_kernel_cuda.cu
executable file
·98 lines (83 loc) · 2.77 KB
/
advec_mom_kernel_cuda.cu
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
/*Crown Copyright 2012 AWE.
*
* This file is part of CloverLeaf.
*
* CloverLeaf is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the
* Free Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* CloverLeaf 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 General Public License for more
* details.
*
* You should have received a copy of the GNU General Public License along with
* CloverLeaf. If not, see http://www.gnu.org/licenses/.
*/
/*
* @brief CUDA momentum advection driver
* @author Michael Boulton NVIDIA Corporation
* @details CUDA momentum advection driver.
*/
#include "cuda_common.hpp"
#include "kernel_files/advec_mom_kernel.cuknl"
extern "C" void advec_mom_kernel_cuda_
(int *whch_vl,
int *swp_nmbr,
int *drctn)
{
cuda_chunk.advec_mom_kernel(*whch_vl, *swp_nmbr, *drctn);
}
void CloverleafCudaChunk::advec_mom_kernel
(int which_vel, int sweep_number, int direction)
{
int mom_sweep = direction + (2 * (sweep_number - 1));
CUDALAUNCH(device_advec_mom_vol_kernel_cuda,
mom_sweep, work_array_1, work_array_2, volume,
vol_flux_x, vol_flux_y);
/*
post_vol = work array 1
node_flux = work array 2
node_mass_post = work array 3
node_mass_pre = work array 4
mom_flux = work array 5
*/
double* vel1;
if (which_vel == 1)
{
vel1 = xvel1;
}
else
{
vel1 = yvel1;
}
if (direction == 1)
{
CUDALAUNCH(device_advec_mom_node_flux_post_x_kernel_cuda,
work_array_2, work_array_3, mass_flux_x,
work_array_1, density1);
CUDALAUNCH(device_advec_mom_node_pre_x_kernel_cuda,
work_array_2, work_array_3, work_array_4);
CUDALAUNCH(device_advec_mom_flux_x_kernel_cuda,
work_array_2, work_array_3, work_array_4,
vel1, celldx, work_array_5);
CUDALAUNCH(device_advec_mom_xvel_kernel_cuda,
work_array_3, work_array_4, work_array_5,
vel1);
}
else if (direction == 2)
{
CUDALAUNCH(device_advec_mom_node_flux_post_y_kernel_cuda,
work_array_2, work_array_3, mass_flux_y,
work_array_1, density1);
CUDALAUNCH(device_advec_mom_node_pre_y_kernel_cuda,
work_array_2, work_array_3, work_array_4);
CUDALAUNCH(device_advec_mom_flux_y_kernel_cuda,
work_array_2, work_array_3, work_array_4,
vel1, celldy, work_array_5);
CUDALAUNCH(device_advec_mom_yvel_kernel_cuda,
work_array_3, work_array_4, work_array_5,
vel1);
}
}