Skip to content

Commit

Permalink
Fix unused variable/parameter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
wperkins committed Sep 18, 2023
1 parent 95e41be commit ad00d28
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/opflow/model/power_bal_hiop/paramsrajahiop.h
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ struct _p_FormPBPOLRAJAHIOP {};
typedef struct _p_FormPBPOLRAJAHIOP *PBPOLRAJAHIOP;

struct PbpolModelRajaHiop : public _p_FormPBPOLRAJAHIOP {
PbpolModelRajaHiop(OPFLOW opflow) {
PbpolModelRajaHiop(void) {
i_jaceq = j_jaceq = i_jacineq = j_jacineq = NULL;
i_hess = j_hess = NULL;
val_jaceq = val_jacineq = val_hess = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/opflow/model/power_bal_hiop/pbpolrajahiop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ extern PetscErrorCode OPFLOWModelSetNumConstraints_PBPOL(OPFLOW, PetscInt *,
PetscErrorCode OPFLOWModelCreate_PBPOLRAJAHIOP(OPFLOW opflow) {
PetscFunctionBegin;

PbpolModelRajaHiop *pbpol = new PbpolModelRajaHiop(opflow);
PbpolModelRajaHiop *pbpol = new PbpolModelRajaHiop();

opflow->model = pbpol;

Expand Down
15 changes: 5 additions & 10 deletions src/opflow/model/power_bal_hiop/pbpolrajahiopsparse.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,6 @@ extern PetscErrorCode OPFLOWSetVariableBounds_PBPOL(OPFLOW, Vec, Vec);
PetscErrorCode OPFLOWSetVariableBounds_PBPOLRAJAHIOPSPARSE(OPFLOW opflow,
Vec Xl, Vec Xu) {
PetscErrorCode ierr;
double *xl, *xu, *xlt, *xut;
Vec Xlt, Xut;
int i;

PetscFunctionBegin;
ierr = OPFLOWSetVariableBounds_PBPOL(opflow, Xl, Xu);
Expand Down Expand Up @@ -231,16 +228,15 @@ PetscErrorCode OPFLOWModelSetUp_PBPOLRAJAHIOPSPARSE(OPFLOW opflow) {
opflow->nnz_ineqjacsp = nnz_ineqjacsp;
opflow->nnz_hesssp = nnz_hesssp;

ierr = pbpolrajahiopsparse->busparams.copy(opflow);
ierr = pbpolrajahiopsparse->genparams.copy(opflow);
ierr = pbpolrajahiopsparse->lineparams.copy(opflow);
ierr = pbpolrajahiopsparse->loadparams.copy(opflow);
ierr = busparams->copy(opflow);
ierr = genparams->copy(opflow);
ierr = lineparams->copy(opflow);
ierr = loadparams->copy(opflow);

PetscFunctionReturn(0);
}

PetscErrorCode OPFLOWModelDestroy_PBPOLRAJAHIOPSPARSE(OPFLOW opflow) {
PetscErrorCode ierr;
PbpolModelRajaHiop *pbpolrajahiopsparse =
reinterpret_cast<PbpolModelRajaHiop *>(opflow->model);

Expand All @@ -265,11 +261,10 @@ extern PetscErrorCode OPFLOWComputeInequalityConstraintJacobian_PBPOL(OPFLOW,
extern PetscErrorCode OPFLOWComputeHessian_PBPOL(OPFLOW, Vec, Vec, Vec, Mat);

PetscErrorCode OPFLOWModelCreate_PBPOLRAJAHIOPSPARSE(OPFLOW opflow) {
PetscErrorCode ierr;

PetscFunctionBegin;

PbpolModelRajaHiop *pbpolrajahiopsparse = new PbpolModelRajaHiop(opflow);
PbpolModelRajaHiop *pbpolrajahiopsparse = new PbpolModelRajaHiop();

opflow->model = pbpolrajahiopsparse;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ OPFLOWComputeSparseInequalityConstraintJacobian_PBPOLRAJAHIOPSPARSE(
Hence the offset
*/
roffset = opflow->nconeq;
coffset = 0;

ierr = (*opflow->modelops.computeinequalityconstraintjacobian)(opflow, opflow->X, opflow->Jac_Gi);
CHKERRQ(ierr);
Expand Down
73 changes: 71 additions & 2 deletions src/opflow/solver/hiop/opflow_hiopsparsegpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ bool OPFLOWHIOPSPARSEGPUInterface::get_sparse_blocks_info(
hiop::size_type &nx, hiop::size_type &nnz_sparse_Jaceq, hiop::size_type &nnz_sparse_Jacineq,
hiop::size_type &nnz_sparse_Hess_Lagr) {
PetscErrorCode ierr;
PetscScalar *xl, *xu, *gl, *gu;
MatInfo info_eq, info_ineq, info_hes;

nx = opflow->nx;
Expand Down Expand Up @@ -104,6 +103,10 @@ bool OPFLOWHIOPSPARSEGPUInterface::eval_f(const hiop::size_type &n, const double
bool new_x, double &obj_value) {
PetscErrorCode ierr;

(void)n;
(void)new_x;


obj_value = 0.0;

/* Compute objective */
Expand All @@ -119,6 +122,13 @@ bool OPFLOWHIOPSPARSEGPUInterface::eval_cons(const hiop::size_type &n,
const hiop::size_type *idx_cons,
const double *x, bool new_x,
double *cons) {
(void)n;
(void)m;
(void)num_cons;
(void)idx_cons;
(void)x;
(void)new_x;
(void)cons;
return false;
}

Expand All @@ -128,6 +138,11 @@ bool OPFLOWHIOPSPARSEGPUInterface::eval_cons(const hiop::size_type &n,
double *cons) {
PetscErrorCode ierr;

(void)n;
(void)m;
(void)new_x;
(void)cons;

/* Equality constaints */
ierr = PetscLogEventBegin(opflow->eqconslogger, 0, 0, 0, 0);
CHKERRQ(ierr);
Expand Down Expand Up @@ -156,6 +171,9 @@ bool OPFLOWHIOPSPARSEGPUInterface::eval_grad_f(const hiop::size_type &n,
double *gradf) {
PetscErrorCode ierr;

(void)n;
(void)new_x;

ierr = PetscLogEventBegin(opflow->gradlogger, 0, 0, 0, 0);
CHKERRQ(ierr);
ierr = (*opflow->modelops.computegradientarray)(opflow, x, gradf);
Expand All @@ -170,6 +188,18 @@ bool OPFLOWHIOPSPARSEGPUInterface::eval_Jac_cons(
const hiop::size_type &n, const hiop::size_type &m, const hiop::size_type &num_cons,
const hiop::size_type *idx_cons, const double *x, bool new_x, const hiop::size_type &nnzJacS,
hiop::index_type *iJacS_dev, hiop::index_type *jJacS_dev, double *MJacS_dev) {

(void)n;
(void)m;
(void)num_cons;
(void)idx_cons;
(void)x;
(void)new_x;
(void)nnzJacS;
(void)iJacS_dev;
(void)jJacS_dev;
(void)MJacS_dev;

return false;
}

Expand All @@ -180,6 +210,12 @@ bool OPFLOWHIOPSPARSEGPUInterface::eval_Jac_cons(const hiop::size_type &n,
hiop::index_type *jJacS_dev, double *MJacS_dev) {
PetscErrorCode ierr;

(void)n;
(void)m;
(void)new_x;
(void)nnzJacS;


/* Sparse Jacobian */
ierr = (*opflow->modelops.computesparseequalityconstraintjacobianhiop)(
opflow, x, iJacS_dev, jJacS_dev, MJacS_dev);
Expand All @@ -200,6 +236,12 @@ bool OPFLOWHIOPSPARSEGPUInterface::eval_Hess_Lagr(
const hiop::size_type &nnzHSS, hiop::index_type *iHSS_dev, hiop::index_type *jHSS_dev, double *MHSS_dev) {
PetscErrorCode ierr;

(void)n;
(void)m;
(void)new_x;
(void)new_lambda;
(void)nnzHSS;

opflow->obj_factor = obj_factor;

/* Compute sparse hessian */
Expand All @@ -217,7 +259,9 @@ bool OPFLOWHIOPSPARSEGPUInterface::eval_Hess_Lagr(
bool OPFLOWHIOPSPARSEGPUInterface::get_starting_point(const hiop::size_type &global_n,
double *x0) {
PetscErrorCode ierr;
const PetscScalar *xarr;

(void)global_n;


/* Set initial guess */
ierr = (*opflow->modelops.setinitialguessarray)(opflow, x0);
Expand All @@ -231,6 +275,13 @@ void OPFLOWHIOPSPARSEGPUInterface::solution_callback(
const double *z_U, int m, const double *gsol, const double *lamsol,
double obj_value) {
PetscErrorCode ierr;

(void)n;
(void)z_L;
(void)z_U;
(void)m;


OPFLOWSolver_HIOPSPARSEGPU hiop = (OPFLOWSolver_HIOPSPARSEGPU)opflow->solver;
PetscScalar *x, *lam, *g;

Expand Down Expand Up @@ -277,6 +328,24 @@ bool OPFLOWHIOPSPARSEGPUInterface::iterate_callback(
const double *g, const double *lambda, double inf_pr, double inf_du,
double onenorm_pr_, double mu, double alpha_du, double alpha_pr,
int ls_trials) {
(void)obj_value;
(void)logbar_obj_value;
(void)n;
(void)x;
(void)z_L;
(void)z_U;
(void)m_ineq;
(void)s;
(void)m;
(void)g;
(void)lambda;
(void)inf_pr;
(void)inf_du;
(void)onenorm_pr_;
(void)mu;
(void)alpha_du;
(void)alpha_pr;
(void)ls_trials;
opflow->numits = iter;
return true;
}
Expand Down

0 comments on commit ad00d28

Please sign in to comment.