Neko-TOP
A portable framework for high-order spectral element flow toplogy optimization.
Loading...
Searching...
No Matches
steepest_descent.hip File Reference

Fortran-callable HIP wrappers of the steepest-descent kernels. More...

#include <stdio.h>
#include <stdlib.h>
#include <hip/hip_runtime.h>
#include <neko/device/device_config.h>
#include <neko/device/hip/check.h>
#include "steepest_descent_kernel.h"
Include dependency graph for steepest_descent.hip:

Go to the source code of this file.

Functions

void hip_sd_direction (void *s_d, void *x_d, real *xmin, real *xmax, int *n)
 
void hip_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)
 
void hip_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)
 

Detailed Description

Scalars are passed by reference and device pointers by value. Every wrapper returns early for an empty range, so that a rank without design variables never launches a zero-block grid.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of the authors nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file steepest_descent.hip.

Function Documentation

◆ hip_sd_direction()

void hip_sd_direction ( void *  s_d,
void *  x_d,
real *  xmin,
real *  xmax,
int *  n 
)

Fortran wrapper for the bound-projected steepest-descent direction (D22).

Parameters
s_dDevice pointer to the gradient on entry, and to the projected direction on exit.
x_dDevice pointer to the design variables.
xminLower bound of the design variables.
xmaxUpper bound of the design variables.
nNumber of design variables.

Definition at line 66 of file steepest_descent.hip.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hip_sd_update_design()

void hip_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 
)

Fortran wrapper for the move-limited, box-constrained update (D24).

Parameters
x_new_dDevice pointer to the updated design variables.
x_dDevice pointer to the current design variables.
s_dDevice pointer to the bound-projected direction.
delta_dDevice pointer to the move limits.
psiStep length.
smaxGlobal maximum of the absolute value of the direction.
xminLower bound of the design variables.
xmaxUpper bound of the design variables.
nNumber of design variables.

Definition at line 118 of file steepest_descent.hip.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ hip_sd_update_move_limits()

void hip_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 
)

Fortran wrapper for the move-limit adaptation (D23).

Parameters
delta_dDevice pointer to the move limits, updated in place.
x_dDevice pointer to the design variables at the current iteration.
x1_dDevice pointer to the design variables one iteration back.
x2_dDevice pointer to the design variables two iterations back.
decFactor applied on oscillation.
incFactor applied on monotone progress.
dminSmallest allowed move limit.
dmaxLargest allowed move limit.
nNumber of design variables.

Definition at line 92 of file steepest_descent.hip.

Here is the call graph for this function:
Here is the caller graph for this function: