Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
math_ext.hip
Go to the documentation of this file.
1
37// System includes
38#include <stdio.h>
39#include <stdlib.h>
40
41// Device includes
42#include <hip/hip_runtime.h>
43
44// Neko includes
45#include <neko/device/device_config.h>
46#include <neko/device/hip/check.h>
47#include <neko/math/bcknd/device/device_mpi_op.h>
48#include <neko/math/bcknd/device/device_mpi_reduce.h>
49
50// Local includes
51#include "math_ext_kernel.h"
52
53extern "C" {
54
58void hip_copy_mask(void* a, void* b, int* size, int* mask, int* mask_size) {
59 const dim3 nthrds(1024, 1, 1);
60 const dim3 nblcks(((*mask_size) + 1024 - 1) / 1024, 1, 1);
61
62 if(*mask_size == 0) return;
65 (real*)a, (real*)b, *size, mask, *mask_size);
67}
68
72void hip_cadd_mask(void* a, real* c, int* size, int* mask, int* mask_size) {
73 const dim3 nthrds(1024, 1, 1);
74 const dim3 nblcks(((*mask_size) + 1024 - 1) / 1024, 1, 1);
75
76 if(*mask_size == 0) return;
78 (hipStream_t)glb_cmd_queue, (real*)a, *c, *size, mask, *mask_size);
80}
81
85void hip_invcol1_mask(void* a, int* size, int* mask, int* mask_size) {
86 const dim3 nthrds(1024, 1, 1);
87 const dim3 nblcks(((*mask_size) + 1024 - 1) / 1024, 1, 1);
88
89 if(*mask_size == 0) return;
91 (hipStream_t)glb_cmd_queue, (real*)a, *size, mask, *mask_size);
93}
94
98void hip_col2_mask(void* a, void* b, int* size, int* mask, int* mask_size) {
99 const dim3 nthrds(1024, 1, 1);
100 const dim3 nblcks(((*mask_size) + 1024 - 1) / 1024, 1, 1);
101
102 if(*mask_size == 0) return;
105 (real*)a, (real*)b, *size, mask, *mask_size);
107}
108
113 void* a, void* b, void* c, int* size, int* mask, int* mask_size) {
114
115 const dim3 nthrds(1024, 1, 1);
116 const dim3 nblcks(((*mask_size) + 1024 - 1) / 1024, 1, 1);
117
118 if(*mask_size == 0) return;
121 (real*)a, (real*)b, (real*)c, *size, mask, *mask_size);
123}
124
129 void* a, void* b, void* c, int* size, int* mask, int* mask_size) {
130
131 const dim3 nthrds(1024, 1, 1);
132 const dim3 nblcks(((*mask_size) + 1024 - 1) / 1024, 1, 1);
133
134 if(*mask_size == 0) return;
137 (real*)a, (real*)b, (real*)c, *size, mask, *mask_size);
139}
140}
__global__ void convex_down_RAMP_mapping_apply_kernel(const T f_min, const T f_max, const T q, T *__restrict__ X_out_d, T *__restrict__ X_in_d, const int n)
void hip_invcol1_mask(void *a, int *size, int *mask, int *mask_size)
Definition math_ext.hip:85
void hip_col2_mask(void *a, void *b, int *size, int *mask, int *mask_size)
Definition math_ext.hip:98
void hip_cadd_mask(void *a, real *c, int *size, int *mask, int *mask_size)
Definition math_ext.hip:72
void hip_sub3_mask(void *a, void *b, void *c, int *size, int *mask, int *mask_size)
Definition math_ext.hip:128
void hip_copy_mask(void *a, void *b, int *size, int *mask, int *mask_size)
Definition math_ext.hip:58
void hip_col3_mask(void *a, void *b, void *c, int *size, int *mask, int *mask_size)
Definition math_ext.hip:112