Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/opflow/model/power_bal_hiop/pbpolhiopkernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ PetscErrorCode OPFLOWComputeDenseInequalityConstraintJacobian_PBPOLHIOP(
PetscFunctionReturn(0);
}

PetscErrorCode OPFLOWComputeDenseEqualityConstraintHessian_PBPOLHIOP(
PetscErrorCode OPFLOWComputeDenseEqualityConstraintsHessian_PBPOLHIOP(
OPFLOW opflow, const double *x, const double *lambda, double *HDD) {
PetscErrorCode ierr;
PBPOLHIOP pbpolhiop = (PBPOLHIOP)opflow->model;
Expand Down Expand Up @@ -1379,7 +1379,7 @@ PetscErrorCode OPFLOWComputeDenseEqualityConstraintHessian_PBPOLHIOP(
PetscFunctionReturn(0);
}

PetscErrorCode OPFLOWComputeDenseInequalityConstraintHessian_PBPOLHIOP(
PetscErrorCode OPFLOWComputeDenseInequalityConstraintsHessian_PBPOLHIOP(
OPFLOW opflow, const double *x, const double *lambda, double *HDD) {
int i;
PBPOLHIOP pbpolhiop = (PBPOLHIOP)opflow->model;
Expand Down Expand Up @@ -1821,12 +1821,12 @@ PetscErrorCode OPFLOWComputeDenseHessian_PBPOLHIOP(OPFLOW opflow,
HDD[i] = 0.0;

/* Equality constraint Hessian */
ierr = OPFLOWComputeDenseEqualityConstraintHessian_PBPOLHIOP(opflow, x,
lambda, HDD);
ierr = OPFLOWComputeDenseEqualityConstraintsHessian_PBPOLHIOP(opflow, x,
lambda, HDD);
CHKERRQ(ierr);

if (opflow->nconineq) {
ierr = OPFLOWComputeDenseInequalityConstraintHessian_PBPOLHIOP(
ierr = OPFLOWComputeDenseInequalityConstraintsHessian_PBPOLHIOP(
opflow, x, lambda + opflow->nconeq, HDD);
CHKERRQ(ierr);
}
Expand Down
8 changes: 4 additions & 4 deletions src/opflow/model/power_bal_hiop/pbpolrajahiopkernels.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1204,7 +1204,7 @@ PetscErrorCode OPFLOWComputeDenseInequalityConstraintJacobian_PBPOLRAJAHIOP(
/**
* @param[inout] HDD_dev Hessian matrix with size nxdense x nxdense
*/
PetscErrorCode OPFLOWComputeDenseEqualityConstraintHessian_PBPOLRAJAHIOP(
PetscErrorCode OPFLOWComputeDenseEqualityConstraintsHessian_PBPOLRAJAHIOP(
OPFLOW opflow, const double *x_dev, const double *lambda_dev,
double *HDD_dev) {
PbpolModelRajaHiop *pbpolrajahiop =
Expand Down Expand Up @@ -1594,7 +1594,7 @@ PetscErrorCode OPFLOWComputeDenseEqualityConstraintHessian_PBPOLRAJAHIOP(
/**
* @param[inout] HDD_dev Hessian matrix with size nxdense x nxdense
*/
PetscErrorCode OPFLOWComputeDenseInequalityConstraintHessian_PBPOLRAJAHIOP(
PetscErrorCode OPFLOWComputeDenseInequalityConstraintsHessian_PBPOLRAJAHIOP(
OPFLOW opflow, const double *x_dev, const double *lambda_dev,
double *HDD_dev) {
PbpolModelRajaHiop *pbpolrajahiop =
Expand Down Expand Up @@ -2085,12 +2085,12 @@ PetscErrorCode OPFLOWComputeDenseHessian_PBPOLRAJAHIOP(OPFLOW opflow,
RAJA_LAMBDA(RAJA::Index_type i) { HDD_dev[i] = 0.0; });

/* Equality constraint Hessian */
ierr = OPFLOWComputeDenseEqualityConstraintHessian_PBPOLRAJAHIOP(
ierr = OPFLOWComputeDenseEqualityConstraintsHessian_PBPOLRAJAHIOP(
opflow, x_dev, lambda_dev, HDD_dev);
CHKERRQ(ierr);

if (opflow->nconineq) {
ierr = OPFLOWComputeDenseInequalityConstraintHessian_PBPOLRAJAHIOP(
ierr = OPFLOWComputeDenseInequalityConstraintsHessian_PBPOLRAJAHIOP(
opflow, x_dev, lambda_dev + opflow->nconeq, HDD_dev);
CHKERRQ(ierr);
}
Expand Down
70 changes: 1 addition & 69 deletions tests/unit/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,81 +1,14 @@
add_subdirectory(opflow)
add_subdirectory(pflow)
add_subdirectory(ps)

if(EXAGO_ENABLE_RAJA AND EXAGO_ENABLE_CUDA)
set_source_files_properties(test_acopf.cpp PROPERTIES LANGUAGE CUDA)
endif()

add_executable(test_acopf test_acopf.cpp utils/test_acopf_utils.cpp)
target_link_libraries(test_acopf ExaGO::OPFLOW)
target_include_directories(test_acopf PRIVATE ./utils)

add_executable(test_pflow test_pflow.cpp utils/test_acopf_utils.cpp)
target_link_libraries(test_pflow ExaGO::PFLOW)
target_include_directories(test_pflow PRIVATE ./utils)

if(EXAGO_ENABLE_RAJA AND EXAGO_ENABLE_HIOP_SPARSE)
if(EXAGO_ENABLE_CUDA)
set_source_files_properties(test_ineqjac_gpu.cpp PROPERTIES LANGUAGE CUDA)
endif()
add_executable(test_ineqjac_gpu test_ineqjac_gpu.cpp)
target_link_libraries(test_ineqjac_gpu ExaGO::OPFLOW)
target_include_directories(
test_ineqjac_gpu PRIVATE ${CMAKE_SOURCE_DIR}/src/opflow
)
endif()

add_executable(test_error_handler test_error_handler.cpp)
target_link_libraries(test_error_handler ExaGO::UTILS)

add_executable(test_logger test_logger.cpp)
target_link_libraries(test_logger ExaGO::UTILS)

if(EXAGO_RUN_TESTS)
# Unit tests
exago_add_test(
NAME
"UNIT_TESTS_OPFLOW"
DEPENDS
HIOP
COMMAND
${RUNCMD}
$<TARGET_FILE:test_acopf>
-opflow_genbusvoltage
VARIABLE_WITHIN_BOUNDS
-validation_dir
${CMAKE_SOURCE_DIR}/datafiles/test_validation
NETFILES
${network_files}
)

exago_add_test(
NAME
"UNIT_TESTS_PFLOW"
COMMAND
${RUNCMD}
$<TARGET_FILE:test_pflow>
-validation_dir
${CMAKE_SOURCE_DIR}/datafiles/test_validation
NETFILES
${network_files}
)

if(EXAGO_ENABLE_RAJA AND EXAGO_ENABLE_HIOP_SPARSE)
exago_add_test(
NAME
"UNIT_TEST_INEQJAC_GPU"
DEPENDS
HIOP
COMMAND
${RUNCMD}
$<TARGET_FILE:test_ineqjac_gpu>
-opflow_genbusvoltage
VARIABLE_WITHIN_BOUNDS
NETFILES
${network_files}
)
endif()

exago_add_test(
NAME UNIT_TESTS_UTILS COMMAND $<TARGET_FILE:test_error_handler>
)
Expand All @@ -92,5 +25,4 @@ if(EXAGO_RUN_TESTS)
DEPENDS
LOGGING
)

endif()
81 changes: 81 additions & 0 deletions tests/unit/opflow/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,83 @@
# Tests with "analytical" solutions
add_subdirectory(objective)
add_subdirectory(constraint_jacobian)

# Tests using PETSc solution as reference
if(EXAGO_ENABLE_RAJA AND EXAGO_ENABLE_CUDA)
set_source_files_properties(test_acopf.cpp PROPERTIES LANGUAGE CUDA)
if(EXAGO_ENABLE_HIOP_SPARSE)
set_source_files_properties(test_eqjac_gpu.cpp PROPERTIES LANGUAGE CUDA)
set_source_files_properties(test_ineqjac_gpu.cpp PROPERTIES LANGUAGE CUDA)
endif()
endif()

add_executable(
test_acopf test_acopf.cpp
${CMAKE_SOURCE_DIR}/tests/unit/utils/test_acopf_utils.cpp
)
target_link_libraries(test_acopf ExaGO::OPFLOW)
target_include_directories(
test_acopf PRIVATE ${CMAKE_SOURCE_DIR}/tests/unit/utils
)

if(EXAGO_ENABLE_HIOP_SPARSE AND EXAGO_ENABLE_GPU)
add_executable(test_ineqjac_gpu test_ineqjac_gpu.cpp)
target_link_libraries(test_ineqjac_gpu ExaGO::OPFLOW)
target_include_directories(
test_ineqjac_gpu PRIVATE ${CMAKE_SOURCE_DIR}/src/opflow
)

add_executable(test_eqjac_gpu test_eqjac_gpu.cpp)
target_link_libraries(test_eqjac_gpu ExaGO::OPFLOW)
target_include_directories(
test_eqjac_gpu PRIVATE ${CMAKE_SOURCE_DIR}/tests/unit/opflow
)
endif()

if(EXAGO_RUN_TESTS)
exago_add_test(
NAME
"UNIT_TESTS_OPFLOW"
DEPENDS
HIOP
COMMAND
${RUNCMD}
$<TARGET_FILE:test_acopf>
-opflow_genbusvoltage
VARIABLE_WITHIN_BOUNDS
-validation_dir
${CMAKE_SOURCE_DIR}/datafiles/test_validation
NETFILES
${network_files}
)

exago_add_test(
NAME
"UNIT_TESTS_OPFLOW_EQUALITY_CONSTRAINT_JACOBIAN_GPU"
DEPENDS
GPU
HIOP_SPARSE
RAJA
COMMAND
${RUNCMD}
$<TARGET_FILE:test_eqjac_gpu>
NETFILES
${network_files}
)

exago_add_test(
NAME
"UNIT_TESTS_OPFLOW_INEQUALITY_CONSTRAINT_JACOBIAN_GPU"
DEPENDS
GPU
HIOP_SPARSE
RAJA
COMMAND
${RUNCMD}
$<TARGET_FILE:test_ineqjac_gpu>
-opflow_genbusvoltage
VARIABLE_WITHIN_BOUNDS
NETFILES
${network_files}
)
endif()
41 changes: 1 addition & 40 deletions tests/unit/opflow/constraint_jacobian/equality/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,28 +1,6 @@
if(EXAGO_ENABLE_RAJA AND EXAGO_ENABLE_CUDA)
set_source_files_properties(jac_eq_acopf.cpp PROPERTIES LANGUAGE CUDA)
set_source_files_properties(test_eqjac_compare.cpp PROPERTIES LANGUAGE CUDA)
endif()
if(EXAGO_ENABLE_RAJA AND EXAGO_ENABLE_HIP)
set_source_files_properties(test_eqjac_compare.cpp PROPERTIES LANGUAGE HIP)
endif()

add_executable(test_eqjac_compare test_eqjac_compare.cpp)
target_link_libraries(test_eqjac_compare ExaGO::OPFLOW)
target_include_directories(
test_eqjac_compare PRIVATE ${CMAKE_SOURCE_DIR}/tests/unit/opflow
)

if(EXAGO_ENABLE_RAJA AND EXAGO_ENABLE_HIP)
set_source_files_properties(test_eqjac_perf.cpp PROPERTIES LANGUAGE HIP)
endif()
if(EXAGO_ENABLE_RAJA AND EXAGO_ENABLE_CUDA)
set_source_files_properties(test_eqjac_perf.cpp PROPERTIES LANGUAGE CUDA)
endif()
add_executable(test_eqjac_perf test_eqjac_perf.cpp)
target_link_libraries(test_eqjac_perf ExaGO::OPFLOW)
target_include_directories(
test_eqjac_perf PRIVATE ${CMAKE_SOURCE_DIR}/tests/unit/opflow
)

add_executable(
jac_eq_acopf jac_eq_acopf.cpp
Expand Down Expand Up @@ -76,23 +54,6 @@ if(EXAGO_ENABLE_RAJA)
list(APPEND dependencies HIOP)
endif()

if(EXAGO_RUN_TESTS)
if(EXAGO_ENABLE_RAJA AND EXAGO_ENABLE_HIOP)
set(prefix_net ${CMAKE_SOURCE_DIR}/datafiles/unit/opflow/objective/)
exago_add_test(
NAME
UNIT_TESTS_EQJAC_GPU_VS_PETSC_testx3
DEPENDS
HIOP_SPARSE
COMMAND
${RUNCMD}
$<TARGET_FILE:test_eqjac_compare>
-netfile
${prefix_net}testx3.m
)
endif()
endif()

if(EXAGO_RUN_TESTS)
foreach(
model
Expand All @@ -108,7 +69,7 @@ if(EXAGO_RUN_TESTS)
foreach(network num IN ZIP_LISTS obj_network_files num_copies)
get_filename_component(net ${network} NAME)
set(testname
"UNIT_TESTS_EQUALITY_CONSTRAINT_JACOBIAN_${net}_${solver}_${model}"
"UNIT_TESTS_OPFLOW_EQUALITY_CONSTRAINT_JACOBIAN_${net}_${solver}_${model}"
)
exago_add_test(
NAME
Expand Down
Loading