-
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.
added support to query BP5 files (#3809)
* added support to query BP5 files * size_type fix * updated python test and added to ctest * moved QueryWorker to the beginstep/endstep loop because bp5 metadata loading pattern deprecate bp3 engine test and replaced with bp5 engine test * clang-format * clang-format * removed some comments * flake8 * correct previous commit. Wrong files changed * furthur formatting * removed comments * added new doc file * Polished query.rst * more touch ups * more clean ups * subblock calculated by the helper function is relative to block so added block start before return to user * clang-format fix * clang-format fix
- Loading branch information
Showing
11 changed files
with
299 additions
and
145 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
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,93 @@ | ||
################# | ||
ADIOS2 query API | ||
################# | ||
|
||
The query API in ADIOS2 allows a client to pass a query in XML or json format, | ||
and get back a list of blocks or subblocks that contains hits. | ||
Both BP4 and BP5 engines are supported. | ||
|
||
|
||
The interface | ||
============= | ||
User is expected to pass a query file (configFile), and init a read engine (engine) | ||
to construct a query and evaluate using the engine. | ||
(note that the engine and query should be using the same ADIOS IO) | ||
|
||
.. code-block:: c++ | ||
|
||
class QueryWorker | ||
{ | ||
public: | ||
// configFile has query, can be either xml or json | ||
QueryWorker(const std::string &configFile, adios2::Engine &engine); | ||
|
||
// touched_blocks is a list of regions specified by (start, count), | ||
// that contains data that satisfies the query file | ||
void GetResultCoverage(std::vector<adios2::Box<adios2::Dims>> &touched_blocks); | ||
... | ||
} | ||
|
||
A Sample Compound Query | ||
---------------------- | ||
|
||
This query targets a 1D variable "doubleV", data of interest is (x > 6.6) or (x < -0.17) or (2.8 < x < 2.9) | ||
In addition, this query also specied an output region [start=5,count=80]. | ||
|
||
|
||
.. code-block:: xml | ||
<adios-query> | ||
<io name="query"> | ||
<var name="doubleV"> | ||
<boundingbox start="5" count="80"/> | ||
<op value="OR"> | ||
<range compare="GT" value="6.6"/> | ||
<range compare="LT" value="-0.17"/> | ||
<op value="AND"> | ||
<range compare="LT" value="2.9"/> | ||
<range compare="GT" value="2.8"/> | ||
</op> | ||
</op> | ||
</var> | ||
</io> | ||
</adios-query> | ||
Code EXAMPLES: | ||
============== | ||
C++: | ||
---- | ||
.. code-block:: c++ | ||
|
||
while (reader.BeginStep() == adios2::StepStatus::OK) | ||
{ | ||
adios2::QueryWorker w = adios2::QueryWorker(queryFile, reader); | ||
w.GetResultCoverage(touched_blocks); | ||
|
||
std::cout << " ... now can read out touched blocks ... size=" << touched_blocks.size() | ||
<< std::endl; | ||
} | ||
|
||
|
||
The Full C++ example is here: | ||
https://github.com/ornladios/ADIOS2/blob/master/examples/query/test.cpp | ||
|
||
|
||
Python: | ||
------- | ||
|
||
.. code-block:: python | ||
while (reader.BeginStep() == adios2.StepStatus.OK): | ||
# say only rank 0 wants to process result | ||
var = [queryIO.InquireVariable("T")] | ||
if (rank == 0): | ||
touched_blocks = w.GetResult() | ||
doAnalysis(reader, touched_blocks, var) | ||
Full python example is here: | ||
https://github.com/ornladios/ADIOS2/blob/master/testing/adios2/bindings/python/TestQuery.py | ||
|
||
This example generates data, the query file (in xml) and runs the query, all in python. | ||
|
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
Oops, something went wrong.