-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2766 from boutproject/adios-io-next-rebase
ADIOS 2 I/O
- Loading branch information
Showing
51 changed files
with
1,723 additions
and
322 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
if test $BUILD_ADIOS2 ; then | ||
if [[ ! -d $HOME/local/adios/include/adios2.h ]] || test $1 ; then | ||
echo "****************************************" | ||
echo "Building ADIOS2" | ||
echo "****************************************" | ||
|
||
branch=${1:-release_29} | ||
if [ ! -d adios2 ]; then | ||
git clone -b $branch https://github.com/ornladios/ADIOS2.git adios2 --depth=1 | ||
fi | ||
|
||
pushd adios2 | ||
rm -rf build | ||
mkdir -p build | ||
pushd build | ||
|
||
cmake .. \ | ||
-DCMAKE_INSTALL_PREFIX=$HOME/local \ | ||
-DADIOS2_USE_MPI=ON \ | ||
-DADIOS2_USE_Fortran=OFF \ | ||
-DADIOS2_USE_Python=OFF \ | ||
-DADIOS2_BUILD_EXAMPLES=OFF \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DCMAKE_POSITION_INDEPENDENT_CODE=ON \ | ||
-DBUILD_TESTING=OFF \ | ||
-DADIOS2_USE_SST=OFF \ | ||
-DADIOS2_USE_MGARD=OFF \ | ||
-DADIOS2_USE_HDF5=OFF \ | ||
-DADIOS2_USE_BZip2=OFF \ | ||
-DADIOS2_USE_Blosc2=OFF \ | ||
-DADIOS2_USE_SZ=OFF \ | ||
-DADIOS2_USE_ZFP=OFF \ | ||
-DADIOS2_USE_DAOS=OFF \ | ||
-DADIOS2_USE_UCX=OFF \ | ||
-DADIOS2_USE_LIBPRESSIO=OFF \ | ||
-DADIOS2_USE_Sodium=OFF \ | ||
-DADIOS2_USE_ZeroMQ=OFF \ | ||
-DADIOS2_USE_MHS=OFF \ | ||
-DADIOS2_USE_DataMan=OFF | ||
|
||
make -j 4 && make install | ||
popd | ||
|
||
echo "****************************************" | ||
echo " Finished building ADIOS2" | ||
echo "****************************************" | ||
|
||
else | ||
|
||
echo "****************************************" | ||
echo " ADIOS2 already installed" | ||
echo "****************************************" | ||
fi | ||
else | ||
echo "****************************************" | ||
echo " ADIOS2 not requested" | ||
echo "****************************************" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/*!************************************************************************ | ||
* Provides access to the ADIOS library, handling initialisation and | ||
* finalisation. | ||
* | ||
* Usage | ||
* ----- | ||
* | ||
* #include <bout/adios_object.hxx> | ||
* | ||
**************************************************************************/ | ||
|
||
#ifndef ADIOS_OBJECT_HXX | ||
#define ADIOS_OBJECT_HXX | ||
|
||
#include "bout/build_config.hxx" | ||
|
||
#if BOUT_HAS_ADIOS | ||
|
||
#include <adios2.h> | ||
#include <memory> | ||
#include <mpi.h> | ||
|
||
namespace bout { | ||
|
||
void ADIOSInit(MPI_Comm comm); | ||
void ADIOSInit(const std::string configFile, MPI_Comm comm); | ||
void ADIOSFinalize(); | ||
|
||
using ADIOSPtr = std::shared_ptr<adios2::ADIOS>; | ||
using EnginePtr = std::shared_ptr<adios2::Engine>; | ||
using IOPtr = std::shared_ptr<adios2::IO>; | ||
|
||
ADIOSPtr GetADIOSPtr(); | ||
IOPtr GetIOPtr(const std::string IOName); | ||
|
||
class ADIOSStream { | ||
public: | ||
adios2::IO io; | ||
adios2::Engine engine; | ||
adios2::Variable<double> vTime; | ||
adios2::Variable<int> vStep; | ||
int adiosStep = 0; | ||
bool isInStep = false; // true if BeginStep was called and EndStep was not yet called | ||
|
||
/** create or return the ADIOSStream based on the target file name */ | ||
static ADIOSStream& ADIOSGetStream(const std::string& fname); | ||
|
||
~ADIOSStream(); | ||
|
||
template <class T> | ||
adios2::Variable<T> GetValueVariable(const std::string& varname) { | ||
auto v = io.InquireVariable<T>(varname); | ||
if (!v) { | ||
v = io.DefineVariable<T>(varname); | ||
} | ||
return v; | ||
} | ||
|
||
template <class T> | ||
adios2::Variable<T> GetArrayVariable(const std::string& varname, adios2::Dims& shape) { | ||
adios2::Variable<T> v = io.InquireVariable<T>(varname); | ||
if (!v) { | ||
adios2::Dims start(shape.size()); | ||
v = io.DefineVariable<T>(varname, shape, start, shape); | ||
} else { | ||
v.SetShape(shape); | ||
} | ||
return v; | ||
} | ||
|
||
private: | ||
ADIOSStream(const std::string fname) : fname(fname){}; | ||
std::string fname; | ||
}; | ||
|
||
/** Set user parameters for an IO group */ | ||
void ADIOSSetParameters(const std::string& input, const char delimKeyValue, | ||
const char delimItem, adios2::IO& io); | ||
|
||
} // namespace bout | ||
|
||
#endif //BOUT_HAS_ADIOS | ||
#endif //ADIOS_OBJECT_HXX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.