Neko
1.99.1
A portable framework for high-order spectral element flow simulations
Loading...
Searching...
No Matches
wall_model.cu
Go to the documentation of this file.
1
/*
2
Copyright (c) 2025, The Neko Authors
3
All rights reserved.
4
5
Redistribution and use in source and binary forms, with or without
6
modification, are permitted provided that the following conditions
7
are met:
8
9
* Redistributions of source code must retain the above copyright
10
notice, this list of conditions and the following disclaimer.
11
12
* Redistributions in binary form must reproduce the above
13
copyright notice, this list of conditions and/or other materials
14
provided with the distribution.
15
16
* Neither the name of the authors nor the names of its
17
contributors may be used to endorse or promote products derived
18
from this software without specific prior written permission.
19
20
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24
COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31
POSSIBILITY OF SUCH DAMAGE.
32
*/
33
34
#include <string.h>
35
#include <stdlib.h>
36
#include <stdio.h>
37
#include <
device/device_config.h
>
38
#include <
device/cuda/check.h
>
39
#include "
wall_model_kernel.h
"
40
41
extern
"C"
{
42
void
cuda_wall_model_compute_mag_field
(
void
*
tau_x_d
,
void
*
tau_y_d
,
void
*
tau_z_d
,
43
void
*
tau_field_d
,
void
*msk_d,
int
*m) {
44
// Define CUDA grid and block dimensions
45
const
dim3
nthrds
(1024, 1, 1);
46
const
dim3
nblcks
(((*m) + 1024 - 1) / 1024, 1, 1);
47
const
cudaStream_t
stream = (
cudaStream_t
) glb_cmd_queue;
48
49
// Launch the CUDA kernel
50
wall_model_compute_mag_field<real>
51
<<<
nblcks
,
nthrds
, 0, stream>>>((
real
*)
tau_x_d
, (
real
*)
tau_y_d
, (
real
*)
tau_z_d
,
52
(
real
*)
tau_field_d
, (
int
*) msk_d, *m);
53
54
// Check for CUDA errors
55
CUDA_CHECK
(
cudaGetLastError
());
56
}
57
}
check.h
CUDA_CHECK
#define CUDA_CHECK(err)
Definition
check.h:6
dirichlet_apply_scalar_kernel
__global__ void dirichlet_apply_scalar_kernel(const int *__restrict__ msk, T *__restrict__ x, const T g, const int m)
Definition
dirichlet_kernel.h:42
device_config.h
real
double real
Definition
device_config.h:12
wall_model_kernel.h
cuda_wall_model_compute_mag_field
void cuda_wall_model_compute_mag_field(void *tau_x_d, void *tau_y_d, void *tau_z_d, void *tau_field_d, void *msk_d, int *m)
Definition
wall_model.cu:42
src
wall_models
bcknd
device
cuda
wall_model.cu
Generated on Fri Sep 5 2025 03:41:56 for Neko by
1.9.8