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_cadd_mask(void* a, real* c, 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;
64 (hipStream_t)glb_cmd_queue, (real*)a, *c, *size, mask, *mask_size);
66}
67
71void hip_invcol1_mask(void* a, int* size, int* mask, int* mask_size) {
72 const dim3 nthrds(1024, 1, 1);
73 const dim3 nblcks(((*mask_size) + 1024 - 1) / 1024, 1, 1);
74
75 if(*mask_size == 0) return;
77 (hipStream_t)glb_cmd_queue, (real*)a, *size, mask, *mask_size);
79}
80
84void hip_col2_mask(void* a, void* b, int* size, int* mask, int* mask_size) {
85 const dim3 nthrds(1024, 1, 1);
86 const dim3 nblcks(((*mask_size) + 1024 - 1) / 1024, 1, 1);
87
88 if(*mask_size == 0) return;
91 (real*)a, (real*)b, *size, mask, *mask_size);
93}
94
99 void* a, void* b, void* c, int* size, int* mask, int* mask_size) {
100
101 const dim3 nthrds(1024, 1, 1);
102 const dim3 nblcks(((*mask_size) + 1024 - 1) / 1024, 1, 1);
103
104 if(*mask_size == 0) return;
107 (real*)a, (real*)b, (real*)c, *size, mask, *mask_size);
109}
110
115 void* a, void* b, void* c, int* size, int* mask, int* mask_size) {
116
117 const dim3 nthrds(1024, 1, 1);
118 const dim3 nblcks(((*mask_size) + 1024 - 1) / 1024, 1, 1);
119
120 if(*mask_size == 0) return;
123 (real*)a, (real*)b, (real*)c, *size, mask, *mask_size);
125}
126}
__global__ void Borrvall_Petersson_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:71
void hip_col2_mask(void *a, void *b, int *size, int *mask, int *mask_size)
Definition math_ext.hip:84
void hip_cadd_mask(void *a, real *c, int *size, int *mask, int *mask_size)
Definition math_ext.hip:58
void hip_sub3_mask(void *a, void *b, void *c, int *size, int *mask, int *mask_size)
Definition math_ext.hip:114
void hip_col3_mask(void *a, void *b, void *c, int *size, int *mask, int *mask_size)
Definition math_ext.hip:98