Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
steepest_descent.cu
Go to the documentation of this file.
1
41// System includes
42#include <stdio.h>
43#include <stdlib.h>
44
45// Device includes
46#include <cuda_runtime.h>
47
48// Neko includes
49#include <neko/device/cuda/check.h>
50#include <neko/device/device_config.h>
51
52// Local includes
54
55extern "C" {
56
66void cuda_sd_direction(void* s_d, void* x_d, real* xmin, real* xmax,
67 int* n) {
68 if (*n < 1) return;
69
70 const dim3 nthrds(1024, 1, 1);
71 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
72
75 ((real*)s_d, (real*)x_d, *xmin, *xmax, *n);
77}
78
92void cuda_sd_update_move_limits(void* delta_d, void* x_d, void* x1_d,
93 void* x2_d, real* dec, real* inc, real* dmin, real* dmax, int* n) {
94 if (*n < 1) return;
95
96 const dim3 nthrds(1024, 1, 1);
97 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
98
101 ((real*)delta_d, (real*)x_d, (real*)x1_d, (real*)x2_d,
102 *dec, *inc, *dmin, *dmax, *n);
104}
105
118void cuda_sd_update_design(void* x_new_d, void* x_d, void* s_d,
119 void* delta_d, real* psi, real* smax, real* xmin, real* xmax, int* n) {
120 if (*n < 1) return;
121
122 const dim3 nthrds(1024, 1, 1);
123 const dim3 nblcks(((*n) + 1024 - 1) / 1024, 1, 1);
124
127 ((real*)x_new_d, (real*)x_d, (real*)s_d, (real*)delta_d,
128 *psi, *smax, *xmin, *xmax, *n);
130}
131
132}
__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)
HIP kernels of the steepest-descent optimizer.
void cuda_sd_direction(void *s_d, void *x_d, real *xmin, real *xmax, int *n)
void cuda_sd_update_design(void *x_new_d, void *x_d, void *s_d, void *delta_d, real *psi, real *smax, real *xmin, real *xmax, int *n)
void cuda_sd_update_move_limits(void *delta_d, void *x_d, void *x1_d, void *x2_d, real *dec, real *inc, real *dmin, real *dmax, int *n)