diff --git a/example/adios/karman.adios.xml b/example/adios/karman.adios.xml new file mode 100644 index 000000000..ebaa22f6c --- /dev/null +++ b/example/adios/karman.adios.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/example/adios/karman.xml b/example/adios/karman.xml new file mode 100644 index 000000000..1ffe1de62 --- /dev/null +++ b/example/adios/karman.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/Geometry.cpp.Rt b/src/Geometry.cpp.Rt index 33868fab8..ba0aaf8cd 100644 --- a/src/Geometry.cpp.Rt +++ b/src/Geometry.cpp.Rt @@ -4,6 +4,12 @@ #define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION #endif + +#ifdef ADIOS2_USE_MPI + #include +#endif + + variables = adioIO.AvailableVariables(); + + for (const auto variablePair : variables) + { + std::cout << "Name: " << variablePair.first; + + for (const auto ¶meter : variablePair.second) + { + std::cout << "\t" << parameter.first << ": " << parameter.second + << "\n"; + } + } + + /** Write variable for buffering */ + typedef std::uint8_t FTYPE; //TODO: this should be char_to_bool to save A LOT memory + + adios2::Variable Flags; + + if (true) + { + + + std::cout << reg.dy << " R " << reg.ny<< std::endl; + std::cout << crop.dy << " C " << crop.ny<< std::endl; + + size_t local_y0 = crop.dy - reg.dy; + size_t local_ny = crop.ny; + + std::cout << "I need Y: " << local_y0 << " COUNT "<< local_ny << std::endl; + + + std::vector FlagsBuffer((size_t)reg.nx*local_ny); + + // read only the chunk corresponding to our rank + // myFloats.data is pre-allocated + + + for (int z = reg.dz; z < reg.dz + reg.nz; z++) { + + size_t index = 0; + + adios2::StepStatus status = AdiosReader.BeginStep(adios2::StepMode::Read, 60.0f); + if (status != adios2::StepStatus::OK) + { + ERROR("ADIOS stream ended or broken - NZ > Number of steps avalible"); + break; + } + + Flags = adioIO.InquireVariable(n.attribute("Variable").value()); + + + + Flags.SetSelection({{0,local_y0}, {(size_t)reg.nx, local_ny}}); + + AdiosReader.Get(Flags, FlagsBuffer.data()); + + AdiosReader.EndStep(); + + size_t white = 0; + + + + + for (int x = reg.dx; x < reg.dx + reg.nx; x++) + for (int y = reg.dy; y < reg.dy + reg.ny; y++){ + if (crop.isIn(x, y, z)){ + const bool v = FlagsBuffer[index] == 1; + white = white + FlagsBuffer[index]; + if (v) Dot(x, y, z); + index++; + } + } + + std::cout << "I've read: MARKED: " << white << " ALL: " << index << std::endl; + + } + + } + AdiosReader.Close(); + /** + for (int x = reg.dx; x < reg.dx + reg.nx; x++) + for (int y = reg.dy; y < reg.dy + reg.ny; y++) + for (int z = reg.dz; z < reg.dz + reg.nz; z++) { + int v; + int ret = fscanf(f, "%d", &v); + if (ret == EOF) { + ERROR("File (%s) ended while reading\n", n.attribute("file").value()); + return -1; + } + if ((v != 0) && (crop.isIn(x, y, z))) + Dot(x, y, z); + } + **/ + + } else { pugi::xml_node node = fg_xml.find_child_by_attribute("Zone", "name", n.name()); if (node) { diff --git a/src/configure.ac b/src/configure.ac index d3139c1cd..8b98b622b 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -37,6 +37,16 @@ AC_ARG_WITH([hdf5-include], AC_HELP_STRING([--with-hdf5-include=hdf5], [specify the full path to your hdf5 installation (headers)])) +AC_ARG_WITH([adios_dir], + AC_HELP_STRING([--with-adios_dir=adios_dir], + [specify the directory containing bin/adios_config /usr/local/adios2]), + [ADIOS_DIR="$withval"]) + +AC_ARG_WITH([adios], + AC_HELP_STRING([--enable-adios], + [Enable ADIOS2 support (experimental)]), + [with_adios="$withval"]) + AC_ARG_ENABLE([graphics], AC_HELP_STRING([--enable-graphics], [make a GUI version])) @@ -383,6 +393,24 @@ if test "x${with_hdf5}" != "xno"; then fi fi +if test "x${with_adios}" != "xno"; then + adios2_config="${ADIOS_DIR}/bin/adios2-config" + AC_CHECK_PROG(adios2_config,${adios2_config},${adios2_config},adios2-config) + + AC_MSG_NOTICE([ADIOS2 config: ${adios2_config}]) + + AC_MSG_CHECKING([ADIOS2 embandinng: linker flags]) + LD=$(${adios2_config} --cxx-libs) + LDFLAGS="${LDFLAGS} ${LD}" + AC_MSG_RESULT(["${LD}"]) + + + AC_MSG_CHECKING([ADIOS2 embandinng: linker flags]) + LD=$(${adios2_config} --cxx-flags) + + CPPFLAGS="${CPPFLAGS} ${LD}" + AC_MSG_RESULT(["${LD}"]) +fi if test "x${with_python}" == "xyes"; then