Skip to content

Commit a80f666

Browse files
committed
Snapshot of rol.git from commit 2a950a6ee345473843770e914aa8235a332ca1c2
From repository at [email protected]:sandialabs/rol.git At commit: commit 2a950a6ee345473843770e914aa8235a332ca1c2 Merge: 63695e34 e3b93ecc Author: Aurya Javeed <[email protected]> Date: Fri Nov 14 20:35:44 2025 -0700 Merge pull request #7 from sandialabs/trilinos-pr-fixes Fixes for inaugural Trilinos snapshot PR Signed-off-by: Aurya Javeed <[email protected]>
1 parent 4792547 commit a80f666

File tree

705 files changed

+84226
-1922
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

705 files changed

+84226
-1922
lines changed

packages/rol/CMakeLists.txt

Lines changed: 123 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -1,131 +1,124 @@
1-
INCLUDE(TribitsPackageMacros)
2-
INCLUDE(TribitsAddOptionAndDefine)
3-
4-
5-
#
6-
# A) Define the package
7-
#
8-
9-
TRIBITS_PACKAGE(ROL)
10-
11-
#
12-
# B) Set up package-specific options
13-
#
14-
15-
TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_DEBUG
16-
HAVE_ROL_DEBUG
17-
"Enable a host of runtime debug checking."
18-
${${PROJECT_NAME}_ENABLE_DEBUG}
19-
)
20-
21-
TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_TIMERS
22-
ROL_TIMERS
23-
"Build ROL with Teuchos TimeMonitors enabled."
24-
OFF
25-
)
26-
27-
TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_PYROL
28-
ENABLE_PYBIND11_PYROL
29-
"Build ROL with PyROL interface."
30-
OFF
31-
)
32-
33-
TRIBITS_ADD_OPTION_AND_DEFINE(${PACKAGE_NAME}_ENABLE_PARAMETERLIST_VALIDATION
34-
ENABLE_PARAMETERLIST_VALIDATION
35-
"Build ROL with ParameterList validation."
36-
OFF
1+
# Rapid Optimization Library
2+
3+
if( COMMAND TRIBITS_PACKAGE )
4+
set( STANDALONE_ROL FALSE )
5+
else()
6+
set( STANDALONE_ROL TRUE )
7+
endif()
8+
9+
if( STANDALONE_ROL )
10+
11+
cmake_minimum_required(VERSION 3.23)
12+
13+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
14+
15+
project( ROL
16+
VERSION 2.0
17+
DESCRIPTION "Rapid Optimization Library"
18+
LANGUAGES CXX )
19+
set(CMAKE_CXX_STANDARD 17)
20+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
21+
set(CMAKE_CXX_EXTENSIONS OFF)
22+
set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH})
23+
24+
find_package(BLAS REQUIRED)
25+
find_package(LAPACK REQUIRED)
26+
27+
if(NOT CMAKE_BUILD_TYPE)
28+
set(CMAKE_BUILD_TYPE RELEASE CACHE STRING "Build type" FORCE)
29+
endif()
30+
31+
# Set F77_BLAS_MANGLE macro based on Fortran-C interface (similar to Kokkos Kernels)
32+
if("${F77_BLAS_MANGLE}" STREQUAL "")
33+
enable_language(C)
34+
enable_language(Fortran)
35+
include(FortranCInterface)
36+
FortranCInterface_HEADER(${CMAKE_CURRENT_BINARY_DIR}/FortranCInterface.h MACRO_NAMESPACE "F77_")
37+
if(FortranCInterface_GLOBAL_SUFFIX STREQUAL "")
38+
set(F77_BLAS_MANGLE "(name,NAME) ${FortranCInterface_GLOBAL_PREFIX}name")
39+
else()
40+
set(F77_BLAS_MANGLE "(name,NAME) ${FortranCInterface_GLOBAL_PREFIX}name ## ${FortranCInterface_GLOBAL_SUFFIX}")
41+
endif()
42+
message(STATUS "Detected Fortran name mangling: ${F77_BLAS_MANGLE}")
43+
endif()
44+
45+
# Add pugixml for XML parameter file support
46+
include(FetchContent)
47+
FetchContent_Declare(
48+
pugixml
49+
GIT_REPOSITORY https://github.com/zeux/pugixml.git
50+
GIT_TAG v1.14
3751
)
38-
39-
# Build Options
40-
SET( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
41-
INCLUDE(BuildOptions)
42-
GET_PROPERTY( STACKTRACE_STRING GLOBAL PROPERTY STACKTRACE_IMPL )
43-
#IF( ${STACKTRACE_STRING} STREQUAL "backward-cpp" )
44-
#INCLUDE(BackwardConfig)
45-
#ENDIF()
46-
47-
48-
include(ROLParameters)
49-
50-
51-
#
52-
# C) Add the libraries, tests, and examples
53-
#
54-
55-
ADD_SUBDIRECTORY(src)
56-
57-
IF( ROL_ENABLE_Sacado )
58-
ADD_SUBDIRECTORY(adapters/sacado)
59-
ENDIF()
60-
61-
IF (ROL_ENABLE_ArrayFireCPU)
62-
ADD_SUBDIRECTORY(adapters/arrayfire)
63-
ENDIF()
64-
65-
IF( ROL_ENABLE_PYROL )
66-
ADD_SUBDIRECTORY(pyrol)
67-
ENDIF()
68-
69-
# Adapters which require use of Teuchos
70-
71-
#GET_PROPERTY( PTR_STRING GLOBAL PROPERTY PTR_IMPL )
72-
#GET_PROPERTY( PARAMETERLIST_STRING GLOBAL PROPERTY PARAMETERLIST_IMPL )
73-
#IF( PTR_STRING STREQUAL "Teuchos::RCP" )
74-
#IF( PARAMETERLIST_STRING STREQUAL "Teuchos::ParameterList" )
75-
76-
IF( ${USING_TEUCHOS_ALL} )
77-
78-
79-
ADD_SUBDIRECTORY(adapters/teuchos)
80-
81-
IF( TPL_ENABLE_MPI )
82-
ADD_SUBDIRECTORY(adapters/mpi)
83-
ENDIF()
84-
85-
IF( ROL_ENABLE_Epetra )
86-
ADD_SUBDIRECTORY(adapters/epetra)
87-
ENDIF()
88-
89-
IF( ROL_ENABLE_Tpetra )
90-
ADD_SUBDIRECTORY(adapters/tpetra)
91-
ENDIF()
92-
93-
IF( ROL_ENABLE_Belos )
94-
ADD_SUBDIRECTORY(adapters/belos)
95-
ENDIF()
96-
97-
IF( ROL_ENABLE_Thyra )
98-
ADD_SUBDIRECTORY(adapters/thyra)
99-
ENDIF()
100-
101-
IF( ROL_ENABLE_TriKota )
102-
ADD_SUBDIRECTORY(adapters/trikota)
103-
ENDIF()
104-
105-
IF( ROL_ENABLE_pebbl )
106-
ADD_SUBDIRECTORY(adapters/pebbl)
107-
ENDIF()
108-
109-
IF (ROL_ENABLE_Boost AND ROL_ENABLE_MiniTensor)
110-
ADD_SUBDIRECTORY(adapters/minitensor)
111-
ENDIF()
112-
113-
ENDIF( ${USING_TEUCHOS_ALL} )
114-
115-
#ENDIF( PARAMETERLIST_STRING STREQUAL "Teuchos::ParameterList" )
116-
#ENDIF( PTR_STRING STREQUAL "Teuchos::RCP" )
117-
118-
IF (ROL_ENABLE_Eigen)
119-
ADD_SUBDIRECTORY(adapters/eigen)
120-
ENDIF()
121-
122-
123-
TRIBITS_ADD_TEST_DIRECTORIES(test)
124-
TRIBITS_ADD_EXAMPLE_DIRECTORIES(example)
125-
TRIBITS_ADD_EXAMPLE_DIRECTORIES(tutorial)
126-
127-
#
128-
# D) Do standard postprocessing
129-
#
130-
131-
TRIBITS_PACKAGE_POSTPROCESS()
52+
FetchContent_MakeAvailable(pugixml)
53+
54+
include(ROLUtils)
55+
56+
# Configure the config header
57+
configure_file("${PROJECT_SOURCE_DIR}/cmake/ROL_config.h.in" ROL_config.h @ONLY)
58+
59+
add_library(rol SHARED)
60+
61+
set(SRC ${PROJECT_SOURCE_DIR}/src)
62+
63+
# Set up compatibility includes (specific directories to avoid conflicts)
64+
set(ROL_COMPATIBILITY_INCLUDES ${SRC}/compatibility/teuchos/blas
65+
${SRC}/compatibility/teuchos/la
66+
${SRC}/compatibility/simple/lapack
67+
${SRC}/compatibility/simple/mpi
68+
${SRC}/compatibility/simple/parameterlist
69+
${SRC}/compatibility/std/shared_ptr
70+
${SRC}/compatibility/teuchos/stacktrace
71+
${SRC}/compatibility/teuchos-lite)
72+
73+
add_library(Teuchos_BLAS OBJECT ${SRC}/compatibility/teuchos-lite/Teuchos_BLAS.cpp)
74+
add_library(Teuchos_CompObject OBJECT ${SRC}/compatibility/teuchos-lite/Teuchos_CompObject.cpp)
75+
add_library(Teuchos_TestForException OBJECT ${SRC}/compatibility/teuchos-lite/Teuchos_TestForException.cpp)
76+
77+
# Use GLOB_RECURSE to find all directories in core components
78+
set(ROL_CORE_DIRS ${SRC}/algorithm
79+
${SRC}/elementwise
80+
${SRC}/function
81+
${SRC}/oed
82+
${SRC}/sol
83+
${SRC}/status
84+
${SRC}/step
85+
${SRC}/utils
86+
${SRC}/vector
87+
${SRC}/zoo)
88+
89+
set(ROL_CORE_INCLUDES)
90+
foreach(core_dir ${ROL_CORE_DIRS})
91+
file(GLOB_RECURSE subdirs LIST_DIRECTORIES true "${core_dir}/*")
92+
list(APPEND ROL_CORE_INCLUDES ${core_dir})
93+
foreach(subdir ${subdirs})
94+
if(IS_DIRECTORY ${subdir})
95+
list(APPEND ROL_CORE_INCLUDES ${subdir})
96+
endif()
97+
endforeach()
98+
endforeach()
99+
100+
target_include_directories(rol PUBLIC ${CMAKE_CURRENT_BINARY_DIR}
101+
${ROL_COMPATIBILITY_INCLUDES}
102+
${ROL_CORE_INCLUDES})
103+
104+
target_link_libraries(rol PUBLIC ${BLAS_LIBRARIES} ${LAPACK_LIBRARIES}
105+
pugixml
106+
Teuchos_BLAS Teuchos_CompObject Teuchos_TestForException)
107+
108+
add_library(rol::rol ALIAS rol)
109+
110+
option(ENABLE_TESTS OFF)
111+
option(ENABLE_EXAMPLES OFF)
112+
113+
if(ENABLE_TESTS)
114+
enable_testing()
115+
add_subdirectory(test)
116+
endif()
117+
118+
if(ENABLE_EXAMPLES)
119+
add_subdirectory(example)
120+
endif()
121+
122+
else() # Build with Trilinos
123+
include(cmake/TrilinosROL.cmake)
124+
endif()

packages/rol/README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Rapid Optimization Library (ROL) Package
1+
# Rapid Optimization Library (ROL)
22

3-
![Rapid Optimization Library](rol.png)
3+
![Rapid Optimization Library](https://raw.githubusercontent.com/sandialabs/rol/refs/heads/develop/rol.png)
44

55
**ROL** (as in rock and _roll_) is a high-performance C++ library for numerical optimization.
66
ROL brings an extensive collection of state-of-the-art optimization algorithms to virtually
@@ -20,16 +20,17 @@ Feature highlights:
2020
4. Fast and robust algorithms for nonsmooth optimization
2121
5. Trust-region methods for inexact and adaptive computations
2222
6. PDE-OPT application development kit for PDE-constrained optimization
23+
7. Interfaces and algorithms for optimal experimental design
2324

2425

2526
## Copyright and License
26-
See rol/COPYRIGHT, rol/LICENSE, https://trilinos.github.io/license.html and individual file headers for additional information.
27+
See COPYRIGHT and LICENSE.
2728

2829

29-
## Questions?
30-
Contact lead developers:
30+
## Questions?
31+
Contact team or developers:
3132

32-
* ROL team (GitHub handle: @trilinos/rol)
33+
* ROL Team (GitHub handle: @sandialabs/rol)
3334
* Drew Kouri (GitHub handle: [dpkouri](https://github.com/dpkouri) or [email protected])
3435
* Denis Ridzal (GitHub handle: [dridzal](https://github.com/dridzal) or [email protected])
3536

packages/rol/adapters/arrayfire/test/vector/test_01.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "ROL_StdVector.hpp"
1616
#include "ROL_Types.hpp"
1717
#include "ROL_Stream.hpp"
18-
#include "Teuchos_GlobalMPISession.hpp"
18+
#include "ROL_GlobalMPISession.hpp"
1919

2020
#include <iostream>
2121

@@ -24,7 +24,7 @@ typedef float ElementT;
2424

2525
int main(int argc, char *argv[]) {
2626

27-
Teuchos::GlobalMPISession mpiSession(&argc, &argv);
27+
ROL::GlobalMPISession mpiSession(&argc, &argv);
2828

2929
// This little trick lets us print to std::cout only if a (dummy) command-line argument is provided.
3030
int iprint = argc - 1;

packages/rol/adapters/belos/test/vector/test_01.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "ROL_StatusTest.hpp"
2121

2222
#include "ROL_Stream.hpp"
23-
#include "Teuchos_GlobalMPISession.hpp"
23+
#include "ROL_GlobalMPISession.hpp"
2424
#include "Teuchos_XMLParameterListHelpers.hpp"
2525

2626
#include <cstdlib>
@@ -29,7 +29,7 @@ typedef double RealT;
2929

3030
int main(int argc, char *argv[]) {
3131

32-
Teuchos::GlobalMPISession mpiSession(&argc, &argv,0);
32+
ROL::GlobalMPISession mpiSession(&argc, &argv,0);
3333

3434
// This little trick lets us print to std::cout only if a (dummy) command-line argument is provided.
3535
int iprint = argc - 1;

packages/rol/adapters/eigen/test/vector/test_01.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "ROL_RandomVector.hpp"
1313
#include "ROL_StdVector.hpp"
1414
#include "ROL_Stream.hpp"
15-
#include "Teuchos_GlobalMPISession.hpp"
15+
#include "ROL_GlobalMPISession.hpp"
1616

1717
#include <iostream>
1818

@@ -26,7 +26,7 @@ int main(int argc, char *argv[]) {
2626
using E3V = ROL::Eigen3Vector<RealT>;
2727
using EigenVector = Eigen::Matrix<RealT,Eigen::Dynamic,1>;
2828

29-
Teuchos::GlobalMPISession mpiSession(&argc, &argv);
29+
ROL::GlobalMPISession mpiSession(&argc, &argv);
3030

3131
// This little trick lets us print to std::cout only if a (dummy) command-line argument is provided.
3232
int iprint = argc - 1;

packages/rol/adapters/epetra/test/sol/test_01.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void printSolution(const std::vector<RealT> &x,
127127
int main(int argc, char* argv[]) {
128128
ROL::Ptr<Epetra_Comm> comm;
129129
#ifdef HAVE_MPI
130-
Teuchos::GlobalMPISession mpiSession(&argc, &argv,0);
130+
ROL::GlobalMPISession mpiSession(&argc, &argv,0);
131131
comm = ROL::makePtr<Epetra_MpiComm>(MPI_COMM_WORLD);
132132
#else
133133
comm = ROL::makePtr<Epetra_SerialComm>();

packages/rol/adapters/epetra/test/sol/test_02.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#include "Teuchos_ParameterList.hpp"
1111
#include "Teuchos_XMLParameterListHelpers.hpp"
1212
#include "ROL_Stream.hpp"
13+
#include "ROL_GlobalMPISession.hpp"
1314

1415
#ifdef HAVE_MPI
1516
#include "Epetra_MpiComm.h"
@@ -26,7 +27,7 @@ typedef double RealT;
2627
int main(int argc, char* argv[]) {
2728
ROL::Ptr<Epetra_Comm> comm;
2829
#ifdef HAVE_MPI
29-
Teuchos::GlobalMPISession mpiSession(&argc, &argv,0);
30+
ROL::GlobalMPISession mpiSession(&argc, &argv,0);
3031
comm = ROL::makePtr<Epetra_MpiComm>(MPI_COMM_WORLD);
3132
#else
3233
comm = ROL::makePtr<Epetra_SerialComm>();

packages/rol/adapters/epetra/test/vector/test_01.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include "ROL_Types.hpp"
1616
#include "Epetra_Map.h"
1717
#include "ROL_Stream.hpp"
18-
#include "Teuchos_GlobalMPISession.hpp"
18+
#include "ROL_GlobalMPISession.hpp"
1919
#ifdef HAVE_MPI
2020
#include "Epetra_MpiComm.h"
2121
#else
@@ -30,7 +30,7 @@ typedef double ElementT;
3030
int main(int argc, char *argv[]) {
3131

3232
#ifdef HAVE_MPI
33-
Teuchos::GlobalMPISession mpiSession(&argc, &argv,0);
33+
ROL::GlobalMPISession mpiSession(&argc, &argv,0);
3434
Epetra_MpiComm Comm(MPI_COMM_WORLD);
3535
#else
3636
Epetra_SerialComm Comm;

packages/rol/adapters/mpi/src/function/ROL_PinTCommunicationUtilities.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <vector>
1414
#include <mpi.h>
1515

16-
#include "Teuchos_GlobalMPISession.hpp"
16+
#include "ROL_GlobalMPISession.hpp"
1717

1818
#include "ROL_TimeStamp.hpp"
1919
#include "ROL_PinTCommunicators.hpp"

0 commit comments

Comments
 (0)