Skip to content
Snippets Groups Projects
Commit 30ea62d4 authored by William F Godoy's avatar William F Godoy
Browse files

Enable memory runtime parameters using XML config file

Picking up config.xml from examples/heatTransfer/write/config.xml from
./build/bin/heatTransfer_write_adios2
parent b63784ba
No related branches found
No related tags found
1 merge request!190Memory
...@@ -16,6 +16,8 @@ if(ADIOS2_HAVE_MPI) ...@@ -16,6 +16,8 @@ if(ADIOS2_HAVE_MPI)
PRIVATE ${MPI_C_INCLUDE_PATH} PRIVATE ${MPI_C_INCLUDE_PATH}
) )
target_link_libraries(heatTransfer_write_adios2 adios2 ${MPI_C_LIBRARIES}) target_link_libraries(heatTransfer_write_adios2 adios2 ${MPI_C_LIBRARIES})
target_compile_definitions(heatTransfer_write_adios2 PRIVATE
-DDEFAULT_CONFIG=${CMAKE_CURRENT_SOURCE_DIR}/config.xml)
if(ADIOS2_HAVE_ADIOS1) if(ADIOS2_HAVE_ADIOS1)
find_package(ADIOS1 REQUIRED) find_package(ADIOS1 REQUIRED)
......
...@@ -14,6 +14,13 @@ ...@@ -14,6 +14,13 @@
#include <adios2.h> #include <adios2.h>
#define str_helper(X) #X
#define str(X) str_helper(X)
#ifndef DEFAULT_CONFIG
#define DEFAULT_CONFIG config.xml
#endif
#define DEFAULT_CONFIG_STR str(DEFAULT_CONFIG)
static int rank_saved; static int rank_saved;
adios2::ADIOS *ad = nullptr; adios2::ADIOS *ad = nullptr;
std::shared_ptr<adios2::Engine> bpWriter; std::shared_ptr<adios2::Engine> bpWriter;
...@@ -24,7 +31,8 @@ IO::IO(const Settings &s, MPI_Comm comm) ...@@ -24,7 +31,8 @@ IO::IO(const Settings &s, MPI_Comm comm)
{ {
rank_saved = s.rank; rank_saved = s.rank;
m_outputfilename = s.outputfile + ".bp"; m_outputfilename = s.outputfile + ".bp";
ad = new adios2::ADIOS("config.xml", comm, adios2::DebugON); ad = new adios2::ADIOS(std::string(DEFAULT_CONFIG_STR), comm,
adios2::DebugON);
// Define method for engine creation // Define method for engine creation
......
<?xml version="1.0"?> <?xml version="1.0"?>
<!-- Config XML file fo the heatTransfer_write_adios2 executable from <!-- Config XML file fo the heatTransfer_write_adios2 executable in .
IO_adios2.cpp --> build/bin from IO_adios2.cpp -->
<adios-config> <adios-config>
<io name="output"> <io name="output">
<engine type="BPFileWriter"> <engine type="BPFileWriter">
<!-- for vectorized memory operations --> <!-- for vectorized memory operations, make sure your system
<parameter key="Threads" value="1"/> enables threads-->
<parameter key="Threads" value="2"/>
<!-- Microseconds (default), Milliseconds, Seconds, <!-- Microseconds (default), Milliseconds, Seconds,
Minutes, Hours --> Minutes, Hours -->
...@@ -17,12 +18,15 @@ ...@@ -17,12 +18,15 @@
(applications might choose an optimal value) --> (applications might choose an optimal value) -->
<!--<parameter key="InitialBufferSize" value="16Kb"/> --> <!--<parameter key="InitialBufferSize" value="16Kb"/> -->
<!-- XXKb, XXMb, or XXXGb supported, default=Unlimited or <!-- XXKb, XXMb, or XXXGb supported, default=Unlimited (until
maximum at each time step fails), maximum at each time step
(applications might choose an optimal value) --> (applications might choose an optimal value) -->
<!-- <parameter key="MaxBufferSize" value="50Mb"/> --> <!-- <parameter key="MaxBufferSize" value="2Gb"/> -->
<!-- exponential growth factor > 1, default = 1.05 --> <!-- exponential growth factor > 1, default = 1.05
1.05 is good for a few large variables, for many small
variables increase the value to 1.5 to 2
(optimal value is application dependent)-->
<parameter key="BufferGrowthFactor" value="1.05"/> <parameter key="BufferGrowthFactor" value="1.05"/>
</engine> </engine>
...@@ -34,7 +38,8 @@ ...@@ -34,7 +38,8 @@
<!-- For read/write, Microseconds (default), Milliseconds, Seconds, <!-- For read/write, Microseconds (default), Milliseconds, Seconds,
Minutes, Hours. open/close always in Microseconds --> Minutes, Hours. open/close always in Microseconds -->
<parameter key="ProfileUnits" value="Milliseconds"/> <parameter key="ProfileUnits" value="Microseconds"/>
</transport> </transport>
</io> </io>
</adios-config> </adios-config>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment