Skip to content

Commit b76b4b2

Browse files
IOSS: add an S3 database component (#725)
* IOSS: add an S3 database component * update copyright header * make S3 optional in non-CMake builds * Ionit: TPL_ENABLE_S3 -> TPL_ENABLE_AWSSDK AND TPL_ENABLE_Cereal Ioss: TPL_ENABLE_AWSSDK -> TPL_ENABLE_AWSSDK AND TPL_ENABLE_Cereal * use cstdlib instead of stdlib.h * use fmt::print instead of std::cout and std::cerr * don't use ostringstream to create error messages for IOSS_ERROR() * use default member initialization * all vectors should be passed by reference * add back the missing "null" type * use MAX_LINE_LENGTH for info records instead of MAX_STR_LENGTH * use fmt::format to assemble keys * use fmt::format to create subkey search terms * remove temporary and optional code that was commented out * rewrite parameter processing * make a local nonconst copy of the PropertyManager * populate it with the existing Properties from const PropertyManager * get any S3 parameters from environment variables and add to the PropertyManager * populate the S3 parameter struct from the PropertyManager * put internal methods in the anonymous namespace * formatting * make better use of const-ref use IOSS_ERROR for unrecoverable errors remove unnecessary error message * fix copyright header * remove unused assert header add a PackedBytes type alias to clarify pack/unpack vector usage * use IOSS_ERROR for unrecoverable errors * fix copyright header use ${CMAKE_SHARED_LIBRARY_SUFFIX} instead of hardcoded .so * set minimum policy version to 3.5 add "lib" to the list of install dirs to look in for AWS libraries only enable S3 if both AWSSDK and Cereal are found * set a default NETCDF_ROOT * improve the documentation of the IOSS-S3 component and TPLs * add IOSS-S3 configuration option to cmake-config. remove cmake-s3 script in favor of cmake-config. * add AWS TPL to install-tpl.sh * AWS helpers now return bool instead of int change result var name from rc to success * change map_fields result name to num_failed. change map_properties result name to num_failed. * envvar to properties: use better variable names properties to params: respect boolean values not just existence of the property * update copyright header * in README.md, refer to README-S3.md for AWSSDK info * README-S3.md: fix IOSS_S3_DISABLE_EC2_LOOKUP default. should be True. * Committing clang-format changes --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent fc24213 commit b76b4b2

29 files changed

+4363
-69
lines changed

README-S3.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Introduction
2+
3+
This document describes the requirements to build and use the IOSS-S3
4+
DatabaseIO component.
5+
6+
## Installing the AWS SDK for C++ and Cereal TPLs
7+
8+
In addition to the usual TPLs required for building SEACAS, the
9+
IOSS-S3 component requires the Amazon Web Services (AWS) Software
10+
Development Kit (SDK) for C++ and the Cereal serialization
11+
library. These TPLs can be installed using the `install-tpl.sh`
12+
script as described in [README.md](README.md). There is also a
13+
description of manual installation in
14+
[TPL-Manual-Install.md](TPL-Manual-Install.md).
15+
16+
## Building SEACAS with S3
17+
18+
The `cmake-config` script is able to build the IOSS-S3 component using
19+
the TPLs installed by the `install-tpl.sh` script. When it finds both
20+
the AWS SDK for C++ and Cereal, it will enable the IOSS-S3 component.
21+
A full description of `cmake-config` can be found in
22+
[README.md](README.md).
23+
24+
## Passing Parameters to the IOSS-S3 component
25+
26+
The IOSS-S3 component has several parameters that control its
27+
behavior. Each parameter can be specified either by the user setting
28+
an environment variable or by the application by setting an IOSS
29+
Property. If both are specified, the environment variable takes
30+
precedence over the Property.
31+
32+
The parameters are descibed in the table below.
33+
34+
| Property or Environment Variable | Values | Default | Description |
35+
|----------------------------------|:---------------:|:-------:|-------------|
36+
| IOSS_S3_ENDPOINT | URI of the S3 object store | None | This parameter is required and does not have a default. |
37+
| IOSS_S3_PROFILE | name of the S3 credential profile | default | |
38+
| IOSS_S3_CA_FILE | path to a certificate authority file | None | Only required with your S3 object store requires it. |
39+
| IOSS_S3_USE_CA_FILE | enable the CA file | False | |
40+
| IOSS_S3_USE_TRANSFER_MANAGER | enable the transfer manager | False | Enable to transfer large data. |
41+
| IOSS_S3_ENABLE_AWS_TRACING | enable debug in AWSSDK | False | Caution: the output is very verbose. |
42+
| IOSS_S3_DISABLE_EC2_LOOKUP | disable an EC2 lookup at startup | True | Useful for on-prem object stores. |
43+
44+
45+
## Example: copy an Exodus file to S3 and back
46+
47+
A simple way to verify your IOSS-S3 installation is to copy an Exodus
48+
file into your S3 object store, copy it back out to disk and then
49+
compare them. The io_shell tool can be used to copy data in and out
50+
of S3. In this example, the data is Exodus data so the exodiff tool
51+
will be used to compare the original file to the copy.
52+
53+
```
54+
export IOSS_S3_ENDPOINT="https://mys3server"
55+
export IOSS_S3_PROFILE=my-s3-profile
56+
io_shell -in_type exodus -out_type s3 my_exodus_file.exo my_exodus_file.exo
57+
io_shell -in_type s3 -out_type exodus my_exodus_file.exo my_exodus_file_copy.exo
58+
exodiff my_exodus_file.exo my_exodus_file_copy.exo
59+
```

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ cd seacas && export ACCESS=`pwd`
4646

4747
There are a few externally developed third-party libraries (TPL) that
4848
are required (or optional) to build SEACAS: HDF5, NetCDF, CGNS, MatIO,
49-
Kokkos, and (if MPI set) PnetCDF libraries. You can build the
50-
libraries using the `install-tpl.sh` script, or you can install them
51-
manually as detailed in
49+
Kokkos, (if MPI set) PnetCDF, AWS SDK for C++ and Cereal
50+
libraries. You can build the libraries using the `install-tpl.sh`
51+
script, or you can install them manually as detailed in
5252
[TPL-Manual-Install.md](TPL-Manual-Install.md).
5353

5454
* The script requires bash and curl, which you may need to install.
@@ -78,6 +78,8 @@ manually as detailed in
7878
| PARMETIS | YES, NO | NO | Should parmetis TPL be built (parallel decomposition). |
7979
| ADIOS2 | YES, NO | NO | Should adios2 TPL be built. |
8080
| CATALYST2 | YES, NO | NO | Should catalyst 2 TPL be built. |
81+
| AWSSDK | YES, NO | NO | Should AWS SDK for C++ TPL be built. See [README-S3.md](README-S3.md). |
82+
| CEREAL | YES, NO | NO | Should Cereal TPL be built. |
8183
| KOKKOS | YES, NO | NO | Should Kokkos TPL be built. |
8284
| GNU_PARALLEL | YES, NO | YES | Should GNU parallel script be built. |
8385
| FMT | YES, NO | YES | Should Lib::FMT TPL be built. |

TPL-Manual-Install.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ described in the previous section.
1111
* [GNU Parallel](#gnu-parallel) -- optional
1212
* [CGNS](#cgns) -- experimental optional
1313
* [Faodel](#faodel) -- optional
14+
* [AWS SDK for C++](#aws-sdk-cpp) -- optional
15+
* [Cereal](#cereal) -- optional
1416

1517
## Zoltan
1618
A snapshot of [zoltan_distrib\_v3.83.tar.gz](http://www.cs.sandia.gov/Zoltan/Zoltan_download.html) is provided in seacas/packages/zoltan. This will be built automatically as part of the SEACAS build process.
@@ -154,3 +156,72 @@ The IOSS library supports using CGNS for structured and unstructred meshes. To
154156
Faodel is a collection of data management tools that Sandia is developing to improve how datasets migrate between memory and storage resources in a distributed system. For SEACAS Faodel support means adding a new backend to IOSS. This enables additional data storage capabilities and the chance to communicate data between execution spaces.
155157

156158
Faodel is available at [Faodel](https://github.com/faodel/faodel). And is built here as a SEACAS TPL.
159+
160+
## AWS SDK for C++
161+
The AWS SDK for C++ is the official C++ interface to the entire Amazon
162+
Web Services ecosystem. This includes packages for transferring data
163+
to and from S3 (Simple Storage Service) object stores. For SEACAS,
164+
AWS support means adding a new backend to IOSS that stores mesh data
165+
in S3.
166+
167+
The AWS SDK for C++ is available at
168+
[aws-sdk-cpp](https://github.com/aws/aws-sdk-cpp). And is built here
169+
as a SEACAS TPL.
170+
171+
The AWS SDK for C++ is in multiple github repositories and composed
172+
using submodules. Below is an example of building the tested version
173+
1.11.77. Complete build instructions for the AWS SDK for C++ can be
174+
found here:
175+
https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/setup-linux.html
176+
177+
178+
* Cloning from github.
179+
180+
* `cd TPL/aws-sdk-cpp`
181+
182+
* `git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp`
183+
184+
* `cd aws-sdk-cpp`
185+
186+
* `git branch branch/tag-1.11.77 1.11.77`
187+
188+
* `git checkout branch/tag-1.11.77`
189+
190+
* `git submodule update --recursive`
191+
192+
* Build using CMake.
193+
194+
* Modify `TPL/aws-sdk-cpp/runcmake.sh` to meet your environment
195+
196+
* `mkdir build`
197+
198+
* `cd build`
199+
200+
* `../../runcmake.sh`
201+
202+
* `make && make install`
203+
204+
205+
## Cereal
206+
cereal is a serialization library that transforms C++ objects into
207+
transportable representations that can be transferred between process
208+
spaces and storage. For SEACAS, cereal support is required to store
209+
complex IOSS objects in Faodel and S3. The Faodel and S3 database
210+
components require that cereal be installed.
211+
212+
cereal is available at
213+
[cereal](https://github.com/USCiLab/cereal). And is built here as a
214+
SEACAS TPL.
215+
216+
cereal is a header-only library so installation is as simple as
217+
copying the files to your install directory.
218+
219+
* `mkdir TPL/cereal`
220+
221+
* `cd TPL/cereal`
222+
223+
* `curl -O -L --insecure https://github.com/USCiLab/cereal/archive/v1.3.2.tar.gz`
224+
225+
* `tar xzf v1.3.2.tar.gz`
226+
227+
* `cp -R cereal-1.3.2/include/cereal $INSTALL_PATH/include/`

TPL/aws-sdk-cpp/runcmake.sh

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#! /usr/bin/env bash
2+
3+
### The following assumes you are building in a subdirectory of ACCESS Root
4+
if [ "X$ACCESS" == "X" ] ; then
5+
ACCESS=$(cd ../../../..; pwd)
6+
echo "ACCESS set to ${ACCESS}"
7+
fi
8+
INSTALL_PATH=${INSTALL_PATH:-${ACCESS}}
9+
10+
DEBUG="${DEBUG:-NO}"
11+
if [ "$DEBUG" == "YES" ]
12+
then
13+
BUILD_TYPE="Debug"
14+
else
15+
BUILD_TYPE="Release"
16+
fi
17+
18+
if [ "$CRAY" == "YES" ]
19+
then
20+
SHARED="${SHARED:-NO}"
21+
else
22+
SHARED="${SHARED:-YES}"
23+
fi
24+
25+
if [[ "$SHARED" == "ON" || "$SHARED" == "YES" ]]
26+
then
27+
OS=$(uname -s)
28+
if [ "$OS" = "Darwin" ] ; then
29+
LD_EXT="dylib"
30+
else
31+
LD_EXT="so"
32+
fi
33+
else
34+
LD_EXT="a"
35+
fi
36+
37+
. ${ACCESS}/TPL/compiler.sh
38+
39+
# If using an XLF compiler on an IBM system, may need to add the following:
40+
# -DCMAKE_Fortran_FLAGS="-qfixed=72" \
41+
# -DCMAKE_EXE_LINKER_FLAGS:STRING="-lxl -lxlopt"
42+
43+
rm -f config.cache
44+
45+
cmake .. -DCMAKE_C_COMPILER:FILEPATH=${CC} \
46+
-DBUILD_SHARED_LIBS:BOOL=${SHARED} \
47+
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=ON \
48+
-DBUILD_TESTING:BOOL=OFF \
49+
-DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} \
50+
-DCMAKE_BUILD_TYPE=${BUILD_TYPE} \
51+
\
52+
-DAUTORUN_UNIT_TESTS:BOOL=OFF
53+
54+
echo ""
55+
echo " MPI: ${MPI}"
56+
echo " COMPILER: ${CC}"
57+
echo " ACCESS: ${ACCESS}"
58+
echo "INSTALL_PATH: ${INSTALL_PATH}"
59+
echo ""

TPLsList.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ SET( Seacas_TPLS_FINDMODS_CLASSIFICATIONS
7272
Matio "cmake/TPLs/" SS
7373
CUDA "cmake/TPLs/" SS
7474
Kokkos "${${PROJECT_NAME}_TRIBITS_DIR}/common_tpls/" SS
75+
AWSSDK "${PROJECT_SOURCE_DIR}/packages/seacas/cmake/tpls/" SS
7576
Faodel "${PROJECT_SOURCE_DIR}/packages/seacas/cmake/tpls/" SS
7677
Cereal "${PROJECT_SOURCE_DIR}/packages/seacas/cmake/tpls/" SS
7778
ADIOS2 "${${PROJECT_NAME}_TRIBITS_DIR}/common_tpls/" EX

cmake-config

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ KOKKOS_PATH=${KOKKOS_PATH:-${INSTALL_PATH}}
7575
METIS_PATH=${METIS_PATH:-${INSTALL_PATH}}
7676
PARMETIS_PATH=${PARMETIS_PATH:-${INSTALL_PATH}}
7777
FMT_PATH=${FMT_PATH:-${INSTALL_PATH}}
78+
AWSSDK_PATH=${AWSSDK_PATH:-${INSTALL_PATH}}
79+
CEREAL_PATH=${CEREAL_PATH:-${INSTALL_PATH}}
7880

7981
### Set to ON for parallel compile; otherwise OFF for serial (default)
8082
if [ "${MPI}" = "" ]
@@ -330,6 +332,8 @@ HAVE_MATIO=$(check_enable "${MATIO_PATH}/include/matio.h")
330332
HAVE_CGNS=$(check_enable "${CGNS_PATH}/include/cgnslib.h")
331333
HAVE_FAODEL=$(check_enable "${FAODEL_PATH}/include/faodel/faodelConfig.h")
332334
HAVE_ADIOS2=$(check_enable "${ADIOS2_PATH}/include/adios2.h")
335+
HAVE_AWSSDK=$(check_enable "${AWSSDK_PATH}/include/aws/core/Aws.h")
336+
HAVE_CEREAL=$(check_enable "${CEREAL_PATH}/include/cereal/cereal.hpp")
333337
HAVE_CATALYST2=$(check_enable "${CATALYST2_PATH}/include/catalyst-2.0/catalyst.h")
334338
HAVE_GTEST=$(check_enable "${GTEST_PATH}/include/gtest/gtest.h")
335339
HAVE_CATCH2=$(check_enable "${CATCH2_PATH}/include/catch2/catch_all.hpp")
@@ -399,6 +403,16 @@ then
399403
-DTPL_Kokkos_LIBRARIES=${KOKKOS_PATH}/lib/libkokkoscore.${LD_EXT}"
400404
fi
401405

406+
if [ "$HAVE_AWSSDK" == "YES" ] && [ "$HAVE_CEREAL" == "YES" ]
407+
then
408+
AWSSDK_SYMBOLS=" -D TPL_ENABLE_AWSSDK:BOOL=${HAVE_AWSSDK} \
409+
-D AWSSDK_ROOT:PATH=${AWSSDK_PATH} \
410+
"
411+
CEREAL_SYMBOLS=" -D TPL_ENABLE_Cereal:BOOL=${HAVE_CEREAL} \
412+
-D Cereal_INCLUDE_DIRS:PATH=${CEREAL_PATH}/include \
413+
"
414+
fi
415+
402416
if [ "$HAVE_FAODEL" == "YES" ]
403417
then
404418
FAODEL_SYMBOLS=" -D TPL_ENABLE_Faodel:BOOL=${HAVE_FAODEL} \
@@ -547,6 +561,8 @@ ${MPI_SYMBOLS} \
547561
${DARWIN_OPT} \
548562
${FAODEL_SYMBOLS} \
549563
${ADIOS2_SYMBOLS} \
564+
${AWSSDK_SYMBOLS} \
565+
${CEREAL_SYMBOLS} \
550566
\
551567
-D MPI_BIN_DIR:PATH=${MPI_BIN} \
552568
-D NetCDF_ROOT:PATH=${NETCDF_PATH} \
@@ -589,6 +605,9 @@ echo " CATALYST2: ${HAVE_CATALYST2}"
589605
echo " METIS: ${HAVE_METIS}"
590606
echo " PARMETIS: ${HAVE_PARMETIS}"
591607
echo " FAODEL: ${HAVE_FAODEL}"
608+
echo " AWSSDK: ${HAVE_AWSSDK}"
609+
echo "AWSSDK_PATH: ${AWSSDK_PATH}"
610+
echo "CEREAL_PATH: ${CEREAL_PATH}"
592611
echo " GTEST: ${HAVE_GTEST}"
593612
echo " CATCH2: ${HAVE_CATCH2}"
594613
echo " DOXYGEN: ${DOXYGEN}"

install-tpl.sh

Lines changed: 61 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ ADIOS2=$(check_valid ADIOS2) || exit
139139
CATALYST2=${CATALYST2:-NO}
140140
CATALYST2=$(check_valid CATALYST2) || exit
141141

142+
AWSSDK=${AWSSDK:-NO}
143+
AWSSDK=$(check_valid AWSSDK) || exit
144+
145+
CEREAL=${CEREAL:-NO}
146+
CEREAL=$(check_valid CEREAL) || exit
147+
142148
GTEST=${GTEST:-${FAODEL}}
143149
GTEST=$(check_valid GTEST) || exit
144150

@@ -232,6 +238,8 @@ fi
232238
echo " FAODEL = ${FAODEL}"
233239
echo " ADIOS2 = ${ADIOS2}"
234240
echo " CATALYST2 = ${CATALYST2}"
241+
echo " AWSSDK = ${AWSSDK}"
242+
echo " CEREAL = ${CEREAL}"
235243
echo " CATCH2 = ${CATCH2}"
236244
echo " GTEST = ${GTEST}"
237245
echo ""
@@ -1141,32 +1149,77 @@ then
11411149
fi
11421150
fi
11431151

1152+
# =================== INSTALL aws-sdk-cpp ===============
1153+
if [ "$AWSSDK" == "YES" ]
1154+
then
1155+
if [ "$FORCE" == "YES" ] || ! [ -e $INSTALL_PATH/include/aws/core/Aws.h ]
1156+
then
1157+
echo "${txtgrn}+++ aws-sdk-cpp${txtrst}"
1158+
cd $ACCESS || exit
1159+
cd TPL/aws-sdk-cpp || exit
1160+
if [ "$DOWNLOAD" == "YES" ]
1161+
then
1162+
echo "${txtgrn}+++ Downloading...${txtrst}"
1163+
rm -rf aws-sdk-cpp
1164+
git clone --recurse-submodules https://github.com/aws/aws-sdk-cpp
1165+
cd aws-sdk-cpp
1166+
git branch branch/tag-1.11.77 1.11.77
1167+
git checkout branch/tag-1.11.77
1168+
git submodule update --recursive
1169+
cd ..
1170+
fi
1171+
1172+
if [ "$BUILD" == "YES" ]
1173+
then
1174+
echo "${txtgrn}+++ Configuring, Building, and Installing...${txtrst}"
1175+
cd aws-sdk-cpp || exit
1176+
rm -rf build
1177+
mkdir build
1178+
cd build || exit
1179+
CRAY=${CRAY} DEBUG=${DEBUG} SHARED=${SHARED} MPI=${MPI} bash -x ../../runcmake.sh
1180+
if [[ $? != 0 ]]
1181+
then
1182+
echo 1>&2 ${txtred}couldn\'t configure aws-sdk-cpp. exiting.${txtrst}
1183+
exit 1
1184+
fi
1185+
make -j${JOBS} && ${SUDO} make "V=${VERBOSE}" install
1186+
if [[ $? != 0 ]]
1187+
then
1188+
echo 1>&2 ${txtred}couldn\'t build aws-sdk-cpp. exiting.${txtrst}
1189+
exit 1
1190+
fi
1191+
fi
1192+
else
1193+
echo "${txtylw}+++ aws-sdk-cpp already installed. Skipping download and installation.${txtrst}"
1194+
fi
1195+
fi
1196+
11441197
# =================== INSTALL CEREAL ===============
1145-
if [ "$FAODEL" == "YES" ]
1198+
if [ "$AWSSDK" == "YES" ] || [ "$FAODEL" == "YES" ]
11461199
then
1147-
# Currently, the FAODEL backend requires cereal, so if Faodel is enabled, we'll install cereal, too.
1148-
if [ "$FORCE" == "YES" ] || [ "$FORCE_FAODEL" == "YES" ] || ! [ -e $INSTALL_PATH/include/cereal/archives/portable_binary.hpp ]
1200+
# Currently, the S3 and FAODEL backends require cereal. If S3 or Faodel are enabled, we'll install cereal too.
1201+
if [ "$FORCE" == "YES" ] || [ "$FORCE_AWSSDK" == "YES" ] || [ "$FORCE_FAODEL" == "YES" ] || ! [ -e $INSTALL_PATH/include/cereal/archives/portable_binary.hpp ]
11491202
then
11501203
echo "${txtgrn}+++ Cereal${txtrst}"
11511204
cd $ACCESS || exit
11521205
CEREAL_DIR="TPL/cereal"
11531206
if [ ! -d "${CEREAL_DIR}" ]; then
11541207
mkdir ${CEREAL_DIR}
11551208
fi
1156-
cd ${CEREAL} || exit
1209+
cd ${CEREAL_DIR} || exit
11571210
if [ "$DOWNLOAD" == "YES" ]
11581211
then
11591212
echo "${txtgrn}+++ Downloading...${txtrst}"
11601213
rm -rf cereal*
1161-
curl -O -L --insecure https://github.com/USCiLab/cereal/archive/v1.3.0.tar.gz
1162-
tar xzf v1.3.0.tar.gz
1163-
rm -f v1.3.0.tar.gz
1164-
cp -R cereal-1.3.0/include/cereal $INSTALL_PATH/include/
1214+
curl -O -L --insecure https://github.com/USCiLab/cereal/archive/v1.3.2.tar.gz
1215+
tar xzf v1.3.2.tar.gz
1216+
rm -f v1.3.2.tar.gz
11651217
fi
11661218

11671219
if [ "$BUILD" == "YES" ]
11681220
then
11691221
echo "${txtgrn}+++ Configuring, Building, and Installing...${txtrst}"
1222+
cp -R cereal-1.3.2/include/cereal $INSTALL_PATH/include/
11701223
fi
11711224
else
11721225
echo "${txtylw}+++ Cereal already installed. Skipping download and installation.${txtrst}"

0 commit comments

Comments
 (0)