Skip to content

Commit 3a039aa

Browse files
committed
Update dakota 6.21 -> 6.23
1 parent 1fdf252 commit 3a039aa

7 files changed

Lines changed: 64 additions & 97 deletions

File tree

.github/workflows/bundle_with_dakota_caller.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ env:
44
ERT_SHOW_BACKTRACE: 1
55
NO_PROJECT_RES: 1
66
BOOST_VERSION: 1.87.0
7-
DAKOTA_VERSION: 6.21.0
7+
DAKOTA_VERSION: 6.23.0
88
INSTALL_DIR: local
99
NEEDS_REBUILD: true
1010

.github/workflows/bundle_with_dakota_macos.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,8 @@ jobs:
161161
162162
cd dakota-${{ inputs.DAKOTA_VERSION }}-public-src-cli
163163
164-
patch -p1 < $CAROLINA_DIR/dakota_manylinux_install_files/workdirhelper_boost_filesystem.patch
165164
patch -p1 < $CAROLINA_DIR/dakota_manylinux_install_files/CMakeLists_includes.patch
166165
167-
# Fix JEGA keyed_registry.hpp.inl bug (upstream fix: dakota-packages commit b837a87)
168-
JEGA_KEYED_REG=$(find . -path '*/JEGA/eddy/utilities/include/inline/keyed_registry.hpp.inl')
169-
if [ -n "$JEGA_KEYED_REG" ]; then
170-
echo "Applying JEGA keyed_registry fix to $JEGA_KEYED_REG ..."
171-
sed -i '' 's/const KeyType& value/const KeyType\& key/' "$JEGA_KEYED_REG"
172-
sed -i '' 's/this->find(this->key)/this->find(key)/' "$JEGA_KEYED_REG"
173-
fi
174-
175166
PYTHON_INCLUDE_DIR="$(python -c "from sysconfig import get_paths as gp; g=gp(); print(f\"{g['include']} \")")"
176167
177168
mkdir -p build

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![PyPI version](https://img.shields.io/pypi/v/Carolina)](https://badge.fury.io/py/carolina)
66
[![Platform](https://img.shields.io/badge/platform-macos%20%7C%20linux-lightgrey)](https://img.shields.io/badge/platform-macos%20%7C%20linux-lightgrey)
77

8-
Carolina is a [pyDAKOTA](https://github.com/wisdem/pyDAKOTA) fork maintained by Equinor. Its raison d'être is to have easier building of a Python [Dakota](https://dakota.sandia.gov/) wrapper, without any MPI support. Carolina supports Python version 3.11, 3.12
8+
Carolina is a [pyDAKOTA](https://github.com/wisdem/pyDAKOTA) fork maintained by Equinor. Its raison d'être is to have easier building of a Python [Dakota](https://dakota.sandia.gov/) wrapper, without any MPI support. Carolina supports Python version 3.11, 3.12, 3.13 and 3.14.
99

1010
## Installation
1111
For Linux and MacOS:

dakota_manylinux_install_files/build_deps_docker.sh

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fi
1010
PYTHON_VERSION_ARG="$1"
1111

1212
BOOST_VERSION="1.87.0"
13-
DAKOTA_VERSION="6.21.0"
13+
DAKOTA_VERSION="6.23.0"
1414

1515
cd /tmp
1616
INSTALL_DIR=/tmp/INSTALL_DIR
@@ -103,24 +103,8 @@ cd "dakota-${DAKOTA_VERSION}-public-src-cli"
103103

104104
echo "Applying patches ..."
105105
patch -p1 < "$CAROLINA_DIR/dakota_manylinux_install_files/CMakeLists.txt.patch"
106-
patch -p1 < "$CAROLINA_DIR/dakota_manylinux_install_files/DakotaFindPython.cmake.patch"
107-
patch -p1 < "$CAROLINA_DIR/dakota_manylinux_install_files/workdirhelper_boost_filesystem.patch"
108106
patch -p1 < "$CAROLINA_DIR/dakota_manylinux_install_files/CMakeLists_includes.patch"
109107

110-
# FIX: GCC 14 no longer transitively provides std::uint32_t etc. via <string>.
111-
# Trilinos's Teuchos_BigUIntDecl.hpp needs an explicit #include <cstdint>.
112-
echo "Applying GCC 14 compatibility fix (cstdint) ..."
113-
sed -i '/#ifndef TEUCHOS_BIG_UINT_DECL_HPP/a #include <cstdint>' \
114-
packages/external/trilinos/packages/teuchos/core/src/Teuchos_BigUIntDecl.hpp
115-
116-
# Fix JEGA keyed_registry.hpp.inl bug (upstream fix: dakota-packages commit b837a87)
117-
JEGA_KEYED_REG=$(find . -path '*/JEGA/eddy/utilities/include/inline/keyed_registry.hpp.inl')
118-
if [ -n "$JEGA_KEYED_REG" ]; then
119-
echo "Applying JEGA keyed_registry fix to $JEGA_KEYED_REG ..."
120-
sed -i 's/const KeyType& value/const KeyType\& key/' "$JEGA_KEYED_REG"
121-
sed -i 's/this->find(this->key)/this->find(key)/' "$JEGA_KEYED_REG"
122-
fi
123-
124108
mkdir build
125109
cd build
126110

@@ -153,7 +137,7 @@ echo "export CMAKE_LIBRARY_PATH=\"$CMAKE_LIBRARY_PATH\"" >> "$WORKSPACE/trace/en
153137
echo "export PYTHON_LIBRARIES=\"$PYTHON_LIBRARIES\"" >> "$WORKSPACE/trace/env"
154138
echo "export PYTHON_INCLUDE_DIR=\"$PYTHON_INCLUDE_DIR\"" >> "$WORKSPACE/trace/env"
155139

156-
echo "Boostrapping Dakota ..."
140+
echo "Bootstrapping Dakota ..."
157141
cmake \
158142
-DCMAKE_CXX_STANDARD=17 \
159143
-DBUILD_SHARED_LIBS=ON \
@@ -167,6 +151,7 @@ cmake \
167151
-DCMAKE_BUILD_TYPE="Release" \
168152
-DDAKOTA_NO_FIND_TRILINOS:BOOL=TRUE \
169153
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
154+
-DCMAKE_INSTALL_LIBDIR=lib \
170155
-DPYTHON_LIBRARIES="$PYTHON_LIBRARIES" \
171156
-DCMAKE_EXE_LINKER_FLAGS="-L${PYTHON_LIBRARIES} -lpython${PYTHON_VERSION_ARG} -lpthread" \
172157
-DTHREADS_PREFER_PTHREAD_FLAG=ON \

dakota_manylinux_install_files/build_deps_gha.sh

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,8 @@ cd "dakota-${DAKOTA_VERSION}-public-src-cli"
9090

9191
echo "Applying patches ..."
9292
patch -p1 < "$CAROLINA_DIR/dakota_manylinux_install_files/CMakeLists.txt.patch"
93-
patch -p1 < "$CAROLINA_DIR/dakota_manylinux_install_files/DakotaFindPython.cmake.patch"
94-
patch -p1 < "$CAROLINA_DIR/dakota_manylinux_install_files/workdirhelper_boost_filesystem.patch"
9593
patch -p1 < "$CAROLINA_DIR/dakota_manylinux_install_files/CMakeLists_includes.patch"
9694

97-
# FIX: GCC 14 no longer transitively provides std::uint32_t etc. via <string>.
98-
# Trilinos's Teuchos_BigUIntDecl.hpp needs an explicit #include <cstdint>.
99-
echo "Applying GCC 14 compatibility fix (cstdint) ..."
100-
sed -i '/#ifndef TEUCHOS_BIG_UINT_DECL_HPP/a #include <cstdint>' \
101-
packages/external/trilinos/packages/teuchos/core/src/Teuchos_BigUIntDecl.hpp
102-
103-
# Fix JEGA keyed_registry.hpp.inl bug (upstream fix: dakota-packages commit b837a87)
104-
JEGA_KEYED_REG=$(find . -path '*/JEGA/eddy/utilities/include/inline/keyed_registry.hpp.inl')
105-
if [ -n "$JEGA_KEYED_REG" ]; then
106-
echo "Applying JEGA keyed_registry fix to $JEGA_KEYED_REG ..."
107-
sed -i 's/const KeyType& value/const KeyType\& key/' "$JEGA_KEYED_REG"
108-
sed -i 's/this->find(this->key)/this->find(key)/' "$JEGA_KEYED_REG"
109-
fi
110-
11195
mkdir build
11296
cd build
11397

@@ -148,6 +132,7 @@ cmake \
148132
-DCMAKE_BUILD_TYPE="Release" \
149133
-DDAKOTA_NO_FIND_TRILINOS:BOOL=TRUE \
150134
-DCMAKE_INSTALL_PREFIX="$INSTALL_DIR" \
135+
-DCMAKE_INSTALL_LIBDIR=lib \
151136
-DPYTHON_LIBRARIES="$PYTHON_LIBRARIES" \
152137
-DCMAKE_EXE_LINKER_FLAGS="-L${PYTHON_LIBRARIES} -lpython${PYTHON_VERSION_ARG} -lpthread" \
153138
-DTHREADS_PREFER_PTHREAD_FLAG=ON \

script/build_boost_dakota.sh

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ set -eu
44

55

66
BOOST_VERSION="1.87.0"
7-
DAKOTA_VERSION="6.21.0"
7+
DAKOTA_VERSION="6.23.0"
88

99
BOOST_VER_NODOTS=$(echo "$BOOST_VERSION" | sed 's/\./_/g')
1010

@@ -115,17 +115,8 @@ tar xf "$CACHE_DIR"/$dakota_file
115115

116116
cd "dakota-${DAKOTA_VERSION}-public-src-cli"
117117

118-
patch -p1 < ../../../dakota_manylinux_install_files/workdirhelper_boost_filesystem.patch
119118
patch -p1 < ../../../dakota_manylinux_install_files/CMakeLists_includes.patch
120119

121-
# Fix JEGA keyed_registry.hpp.inl bug (upstream fix: dakota-packages commit b837a87)
122-
JEGA_KEYED_REG=$(find . -path '*/JEGA/eddy/utilities/include/inline/keyed_registry.hpp.inl')
123-
if [ -n "$JEGA_KEYED_REG" ]; then
124-
echo "Applying JEGA keyed_registry fix to $JEGA_KEYED_REG ..."
125-
sed -i '' 's/const KeyType& value/const KeyType\& key/' "$JEGA_KEYED_REG"
126-
sed -i '' 's/this->find(this->key)/this->find(key)/' "$JEGA_KEYED_REG"
127-
fi
128-
129120
mkdir -p build
130121
cd build
131122

setup.py

Lines changed: 57 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import platform
1111
import sys
1212
import shutil
13+
from pathlib import Path
1314

1415
import numpy
1516

@@ -19,7 +20,7 @@
1920

2021
DAKOTA_EXEC = shutil.which("dakota")
2122
if not DAKOTA_EXEC:
22-
exit('Unable to find dakota executable.')
23+
sys.exit("Unable to find dakota executable.")
2324

2425

2526
def get_default_boost_python():
@@ -34,42 +35,49 @@ def get_numpy_include():
3435
def find_dakota_paths():
3536
"""Assuming standard prefix-based install."""
3637
dakota_install = os.path.dirname(os.path.dirname(DAKOTA_EXEC))
37-
dakota_bin = os.path.join(dakota_install, 'bin')
38-
dakota_include = os.path.join(dakota_install, 'include')
39-
dakota_lib = os.path.join(dakota_install, 'lib')
40-
eigen_include = os.path.join(dakota_include, 'eigen3')
38+
dakota_bin = os.path.join(dakota_install, "bin")
39+
dakota_include = os.path.join(dakota_install, "include")
40+
dakota_lib = os.path.join(dakota_install, "lib")
41+
eigen_include = os.path.join(dakota_include, "eigen3")
4142
req = (dakota_bin, dakota_include, dakota_lib)
4243
if not all(map(os.path.exists, req)):
43-
exit("Can't find %s or %s or %s, bummer" % req)
44+
sys.exit("Can't find %s or %s or %s, bummer" % req)
4445
return dakota_install, dakota_bin, dakota_include, dakota_lib, eigen_include
4546

4647

4748
def read_dakota_macros(install_path):
4849
"""Read make macros from `install_path`/include/Makefile.export.Dakota."""
4950
dakota_macros = {}
50-
with open(os.path.join(install_path, 'include',
51-
'Makefile.export.Dakota'), 'r') as inp:
51+
with open(
52+
os.path.join(install_path, "include", "Makefile.export.Dakota"), "r"
53+
) as inp:
5254
for line in inp:
5355
line = line.strip()
54-
if not line or line.startswith('#'):
56+
if not line or line.startswith("#"):
5557
continue
56-
name, _, value = line.partition('=')
58+
name, _, value = line.partition("=")
5759
dakota_macros[name.strip()] = value.strip().split()
5860
return dakota_macros
5961

6062

6163
def get_dakota_libs(macros):
62-
"""Drop '-l' from Dakota_LIBRARIES if necessary."""
63-
libs = macros['Dakota_LIBRARIES']
64-
libs = [name[2:] if name.startswith('-l') else name for name in libs]
64+
"""Drop '-l' from Dakota_LIBRARIES if necessary.
65+
66+
Also strip CMake namespace prefixes
67+
(e.g. 'TeuchosCore::teuchoscore' -> 'teuchoscore')
68+
"""
69+
libs = macros["Dakota_LIBRARIES"]
70+
libs = [name[2:] if name.startswith("-l") else name for name in libs]
71+
libs = [name.split("::")[-1] if "::" in name else name for name in libs]
6572
return libs
6673

6774

6875
def get_define_macros(macros):
6976
"""Drop '-D' from Dakota_DEFINES."""
70-
define_macros = [(name[2:], None) for name in macros['Dakota_DEFINES']]
77+
define_macros = [(name[2:], None) for name in macros["Dakota_DEFINES"]]
7178
return define_macros
7279

80+
7381
def get_boost_inc_lib():
7482
"""BOOST_ROOT is expected to be set if a certain boost build is required.
7583
@@ -79,35 +87,36 @@ def get_boost_inc_lib():
7987
8088
"""
8189

82-
boost_root = os.getenv('BOOST_ROOT', None)
90+
boost_root = os.getenv("BOOST_ROOT", None)
8391

8492
boost_inc_dir = None
8593
boost_lib_dir = None
8694
if boost_root:
87-
boost_inc_dir = os.path.join(boost_root, 'include')
88-
boost_lib_dir = os.path.join(boost_root, 'lib')
95+
boost_inc_dir = os.path.join(boost_root, "include")
96+
boost_lib_dir = os.path.join(boost_root, "lib")
8997

90-
boost_python = os.getenv('BOOST_PYTHON', get_default_boost_python())
98+
boost_python = os.getenv("BOOST_PYTHON", get_default_boost_python())
9199

92100
if not boost_lib_dir:
93101
return boost_inc_dir, None, None, boost_python
94102

95-
return boost_inc_dir, boost_lib_dir, boost_lib_dir+'64', boost_python
103+
return boost_inc_dir, boost_lib_dir, boost_lib_dir + "64", boost_python
96104

97105

98106
def get_macros_include_library():
99107
"""Get the dakota macros, include and library dirs."""
100-
dakota_install, dakota_bin, dakota_include, dakota_lib, eigen_include = find_dakota_paths()
108+
dakota_install, dakota_bin, dakota_include, dakota_lib, eigen_include = (
109+
find_dakota_paths()
110+
)
101111
dakota_macros = read_dakota_macros(dakota_install)
102112

103113
inc = [dakota_include, eigen_include, get_numpy_include()]
104114
lib = [dakota_lib, dakota_bin]
105115
return dakota_macros, inc, lib
106116

107-
def get_carolina_extension():
108-
"""Setup everything and make an Extension for Carolina!
109117

110-
"""
118+
def get_carolina_extension():
119+
"""Setup everything and make an Extension for Carolina!"""
111120

112121
dakota_macros, include_dirs, library_dirs = get_macros_include_library()
113122

@@ -118,12 +127,16 @@ def get_carolina_extension():
118127
library_dirs.append(boost_lib)
119128
library_dirs.append(boost_lib64)
120129

130+
sources = ["src/dakface.cpp", "src/dakota_python_binding.cpp"]
121131

122-
sources = ['src/dakface.cpp', 'src/dakota_python_binding.cpp']
123-
124-
125-
external_libs = ['boost_regex', 'boost_filesystem', 'boost_serialization',
126-
'boost_system', 'boost_program_options', boost_python]
132+
external_libs = [
133+
"boost_regex",
134+
"boost_filesystem",
135+
"boost_serialization",
136+
"boost_system",
137+
"boost_program_options",
138+
boost_python,
139+
]
127140

128141
print(boost_python)
129142

@@ -134,19 +147,21 @@ def get_carolina_extension():
134147

135148
if "Darwin" in platform.system():
136149
# Reserve header space for install_name_tool rewrites by delocate
137-
extra_link_args = ['-Wl,-headerpad_max_install_names']
150+
extra_link_args = ["-Wl,-headerpad_max_install_names"]
138151
else:
139-
extra_link_args = ['-Wl,-z,origin']
140-
141-
carolina = Extension(name='carolina',
142-
sources=sources,
143-
include_dirs=include_dirs,
144-
define_macros=define_macros,
145-
extra_link_args=extra_link_args,
146-
extra_compile_args=['-std=c++17'],
147-
library_dirs=library_dirs,
148-
libraries=libraries,
149-
language='c++')
152+
extra_link_args = ["-Wl,-z,origin"]
153+
154+
carolina = Extension(
155+
name="carolina",
156+
sources=sources,
157+
include_dirs=include_dirs,
158+
define_macros=define_macros,
159+
extra_link_args=extra_link_args,
160+
extra_compile_args=["-std=c++17"],
161+
library_dirs=library_dirs,
162+
libraries=libraries,
163+
language="c++",
164+
)
150165
return carolina
151166

152167

@@ -155,8 +170,8 @@ def get_carolina_extension():
155170
setup(
156171
name="carolina",
157172
description="A Python wrapper for DAKOTA",
158-
long_description=open('README.md').read(),
159-
long_description_content_type='text/markdown',
173+
long_description=Path("README.md").read_text(encoding="utf-8"),
174+
long_description_content_type="text/markdown",
160175
py_modules=["dakota"],
161176
ext_modules=[CAROLINA],
162177
package_dir={"": "src"},

0 commit comments

Comments
 (0)