-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8b7b66
commit 9efb23c
Showing
11 changed files
with
762 additions
and
0 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
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,107 @@ | ||
#################### | ||
Tutorial: ADIOS2 101 | ||
#################### | ||
|
||
******** | ||
Setup | ||
******** | ||
|
||
- Install adios2 | ||
- Go to the tutorial dir | ||
- cmake | ||
- cmake --build | ||
|
||
|
||
****************** | ||
(hello)adios world | ||
****************** | ||
|
||
Solution at `tutorials/00_helloworld/helloworld_solution.cxx` | ||
Source at `tutorials/00_helloworld/helloworld.cxx` | ||
|
||
Open source. | ||
|
||
In the writer side: | ||
|
||
1. First we need to initialize ADIOS2 | ||
|
||
... | ||
|
||
2. Second we need to declare an IO object which means ... | ||
|
||
... | ||
|
||
3. Then we can create an engine, which we have many types of ... | ||
|
||
... | ||
|
||
4. Now create a simpel variable ... | ||
|
||
Pass an string ... | ||
|
||
In the reader side: | ||
|
||
5. repeat 1-4 steps. | ||
|
||
... | ||
|
||
6. Now read the variable | ||
|
||
... | ||
|
||
********************************** | ||
(hello)adios world (Low level API) | ||
********************************** | ||
|
||
Solution at `tutorials/00_helloworld_basics/helloworld_solution.cxx` | ||
Source at `tutorials/00_helloworld_basics/helloworld.cxx` | ||
|
||
Open source. | ||
|
||
In the writer side: | ||
|
||
1. First we need to initialize ADIOS2 | ||
|
||
... | ||
|
||
2. Second we need to declare an IO object which means ... | ||
|
||
... | ||
|
||
3. Then we can create an engine, which we have many types of ... | ||
|
||
... | ||
|
||
4. Now create a simpel variable ... | ||
|
||
Pass an string ... | ||
|
||
In the reader side: | ||
|
||
5. repeat 1-4 steps. | ||
|
||
... | ||
|
||
6. Now read the variable | ||
|
||
... | ||
|
||
|
||
********* | ||
Variables | ||
********* | ||
|
||
Concept of steps | ||
Concept of Variables shape | ||
|
||
Solution at `tutorials/01_variables/variables_solution.cxx` | ||
Source at `tutorials/01_variables/variables.cxx` | ||
|
||
********* | ||
Operators | ||
********* | ||
|
||
Concept of Operators | ||
|
||
Solution at `tutorials/02_operators/operators_solution.cxx` | ||
Source at `tutorials/02_operators/operators.cxx` |
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,9 @@ | ||
#------------------------------------------------------------------------------# | ||
# Distributed under the OSI-approved Apache License, Version 2.0. See | ||
# accompanying file Copyright.txt for details. | ||
#------------------------------------------------------------------------------# | ||
cmake_minimum_required(VERSION 3.12) | ||
project(adios2HelloWorld LANGUAGES C CXX) | ||
|
||
add_executable(ADIOS2helloworld helloworld.cxx) | ||
target_link_libraries(ADIOS2helloworld adios2::cxx11) |
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,48 @@ | ||
/* | ||
* Distributed under the OSI-approved Apache License, Version 2.0. See | ||
* accompanying file Copyright.txt for details. | ||
* | ||
* hello-world-hl.cpp : adios2 high-level API example to write and read a | ||
* std::string Variable with a greeting | ||
* | ||
*/ | ||
|
||
#include <iostream> | ||
#include <stdexcept> | ||
#include <adios2.h> | ||
|
||
void writer(const std::string &greeting) | ||
{ | ||
// ToDo | ||
} | ||
|
||
std::string reader() | ||
{ | ||
std::vector<std::string> output; | ||
adios2::fstep iStep; | ||
|
||
// ToDo | ||
|
||
adios2::getstep(in, iStep); | ||
|
||
// ToDo | ||
|
||
return output.front(); | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
try | ||
{ | ||
const std::string greeting = "Hello World from ADIOS2"; | ||
writer(greeting); | ||
|
||
const std::string message = reader(); | ||
std::cout << message << "\n"; | ||
} | ||
catch (std::exception &e) | ||
{ | ||
std::cout << "ERROR: ADIOS2 exception: " << e.what() << "\n"; | ||
} | ||
|
||
return 0; |
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,49 @@ | ||
/* | ||
* Distributed under the OSI-approved Apache License, Version 2.0. See | ||
* accompanying file Copyright.txt for details. | ||
* | ||
* hello-world-hl.cpp : adios2 high-level API example to write and read a | ||
* std::string Variable with a greeting | ||
* | ||
*/ | ||
|
||
#include <iostream> | ||
#include <stdexcept> | ||
#include <adios2.h> | ||
|
||
void writer(const std::string &greeting) | ||
{ | ||
adios2::fstream out("hello-world-hl-cpp.bp", adios2::fstream::out); | ||
out.write("Greeting", greeting); | ||
out.close(); | ||
} | ||
|
||
std::string reader() | ||
{ | ||
std::vector<std::string> output; | ||
adios2::fstep iStep; | ||
|
||
adios2::fstream in("hello-world-hl-cpp.bp", adios2::fstream::in); | ||
adios2::getstep(in, iStep); | ||
output = in.read<std::string>("Greeting").front(); | ||
in.close() | ||
|
||
return output.front(); | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
try | ||
{ | ||
const std::string greeting = "Hello World from ADIOS2"; | ||
writer(greeting); | ||
|
||
const std::string message = reader(); | ||
std::cout << message << "\n"; | ||
} | ||
catch (std::exception &e) | ||
{ | ||
std::cout << "ERROR: ADIOS2 exception: " << e.what() << "\n"; | ||
} | ||
|
||
return 0; |
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,9 @@ | ||
#------------------------------------------------------------------------------# | ||
# Distributed under the OSI-approved Apache License, Version 2.0. See | ||
# accompanying file Copyright.txt for details. | ||
#------------------------------------------------------------------------------# | ||
cmake_minimum_required(VERSION 3.12) | ||
project(adios2HelloWorldBasic LANGUAGES C CXX) | ||
|
||
add_executable(ADIOS2helloworldBasic helloworld.cxx) | ||
target_link_libraries(ADIOS2helloworldBasic adios2::cxx11) |
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,52 @@ | ||
/* | ||
* Distributed under the OSI-approved Apache License, Version 2.0. See | ||
* accompanying file Copyright.txt for details. | ||
* | ||
* hello-world.cpp : adios2 low-level API example to write and read a | ||
* std::string Variable with a greeting | ||
*/ | ||
|
||
#include <iostream> | ||
#include <stdexcept> | ||
|
||
#include <adios2.h> | ||
|
||
void writer(adios2::ADIOS &adios, const std::string &greeting) | ||
{ | ||
// ToDo | ||
} | ||
|
||
std::string reader(adios2::ADIOS &adios) | ||
{ | ||
// ToDo | ||
|
||
reader.BeginStep(); | ||
|
||
// ToDo | ||
|
||
reader.EndStep(); | ||
|
||
// ToDo | ||
|
||
return greeting; | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
try | ||
{ | ||
adios2::ADIOS adios; | ||
|
||
const std::string greeting = "Hello World from ADIOS2"; | ||
writer(adios, greeting); | ||
|
||
const std::string message = reader(adios); | ||
std::cout << message << "\n"; | ||
} | ||
catch (std::exception &e) | ||
{ | ||
std::cout << "ERROR: ADIOS2 exception: " << e.what() << "\n"; | ||
} | ||
|
||
return 0; | ||
} |
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,61 @@ | ||
/* | ||
* Distributed under the OSI-approved Apache License, Version 2.0. See | ||
* accompanying file Copyright.txt for details. | ||
* | ||
* hello-world.cpp : adios2 low-level API example to write and read a | ||
* std::string Variable with a greeting | ||
* | ||
* Created on: Nov 14, 2019 | ||
* Author: William F Godoy godoywf@ornl.gov | ||
*/ | ||
|
||
#include <iostream> | ||
#include <stdexcept> | ||
|
||
#include <adios2.h> | ||
|
||
void writer(adios2::ADIOS &adios, const std::string &greeting) | ||
{ | ||
adios2::IO io = adios.DeclareIO("hello-world-writer"); | ||
adios2::Variable<std::string> varGreeting = | ||
io.DefineVariable<std::string>("Greeting"); | ||
|
||
adios2::Engine writer = io.Open("hello-world-cpp.bp", adios2::Mode::Write); | ||
writer.Put(varGreeting, greeting); | ||
writer.Close(); | ||
} | ||
|
||
std::string reader(adios2::ADIOS &adios) | ||
{ | ||
adios2::IO io = adios.DeclareIO("hello-world-reader"); | ||
adios2::Engine reader = io.Open("hello-world-cpp.bp", adios2::Mode::Read); | ||
reader.BeginStep(); | ||
adios2::Variable<std::string> varGreeting = | ||
io.InquireVariable<std::string>("Greeting"); | ||
std::string greeting; | ||
reader.Get(varGreeting, greeting); | ||
reader.EndStep(); | ||
reader.Close(); | ||
return greeting; | ||
} | ||
|
||
int main(int argc, char *argv[]) | ||
{ | ||
|
||
try | ||
{ | ||
adios2::ADIOS adios; | ||
|
||
const std::string greeting = "Hello World from ADIOS2"; | ||
writer(adios, greeting); | ||
|
||
const std::string message = reader(adios); | ||
std::cout << message << "\n"; | ||
} | ||
catch (std::exception &e) | ||
{ | ||
std::cout << "ERROR: ADIOS2 exception: " << e.what() << "\n"; | ||
} | ||
|
||
return 0; | ||
} |
Oops, something went wrong.