Commit adfc31dc authored by William F Godoy's avatar William F Godoy
Browse files

Adapted heat transfer test to support MemorySelection

parent 07c1896c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ the MPI_COMM_WORLD and create two partitions of the processes.
        =======================================-->
    
    <io name="readerOutput">
        <engine type="BPFile">
        <engine type="BP3">
        </engine>
    </io>
</adios-config>
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ int main(int argc, char *argv[])
        {
            // if not defined by user, we can change the default settings
            // BPFile is the default engine
            inIO.SetEngine("BPFile");
            inIO.SetEngine("BP3");
            inIO.SetParameters({{"num_threads", "1"}});

            // ISO-POSIX file output is the default transport (called "File")
+10 −9
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@

#include "IO.h"

#include <iostream>
#include <string>

#include <adios2.h>
@@ -30,8 +29,10 @@ IO::IO(const Settings &s, MPI_Comm comm)
    if (!bpio.InConfigFile())
    {
        // if not defined by user, we can change the default settings
        // BP3 is the default engine
        bpio.SetEngine("BP3");
        // BPFile is the default engine
        bpio.SetEngine("BPFile");
        bpio.SetParameters({{"num_threads", "1"}});

        // ISO-POSIX file output is the default transport (called "File")
        // Passing parameters to the transport
        bpio.AddTransport("File", {{"Library", "POSIX"}});
@@ -49,8 +50,7 @@ IO::IO(const Settings &s, MPI_Comm comm)

    if (bpio.EngineType() == "BP3")
    {
        varT.SetMemorySelection(
            {adios2::Dims{1, 1}, adios2::Dims{s.ndx + 2, s.ndy + 2}});
        varT.SetMemorySelection({{1, 1}, {s.ndx + 2, s.ndy + 2}});
    }

    // Promise that we are not going to change the variable sizes nor add new
@@ -65,21 +65,22 @@ IO::~IO() { bpWriter.Close(); }
void IO::write(int step, const HeatTransfer &ht, const Settings &s,
               MPI_Comm comm)
{
    bpWriter.BeginStep();
    // using PutDeferred() you promise the pointer to the data will be intact
    // until the end of the output step.
    // We need to have the vector object here not to destruct here until the end
    // of function.

    std::cout << "Engine type: " << bpWriter.Type() << "\n";
    // added support for MemorySelection
    if (bpWriter.Type() == "BP3")
    {
        bpWriter.BeginStep();
        bpWriter.Put<double>(varT, ht.data());
        bpWriter.EndStep();
    }
    else
    {
        bpWriter.BeginStep();
        std::vector<double> v = ht.data_noghost();
        bpWriter.Put<double>(varT, v.data());
    }
        bpWriter.EndStep();
    }
}
+5 −2
Original line number Diff line number Diff line
@@ -68,8 +68,11 @@ void SstWriter::PutSyncCommon(Variable<T> &variable, const T *values)
            m_BP3Serializer->ResizeBuffer(
                dataSize, "in call to variable " + variable.m_Name +
                              " Put adios2::Mode::Sync");
        m_BP3Serializer->PutVariableMetadata(variable, blockInfo);
        m_BP3Serializer->PutVariablePayload(variable, blockInfo);
        const bool sourceRowMajor = helper::IsRowMajor(m_IO.m_HostLanguage);
        m_BP3Serializer->PutVariableMetadata(variable, blockInfo,
                                             sourceRowMajor);
        m_BP3Serializer->PutVariablePayload(variable, blockInfo,
                                            sourceRowMajor);
        variable.m_BlocksInfo.clear();
    }
    else
+0 −1
Original line number Diff line number Diff line
@@ -118,7 +118,6 @@ void WriteAggRead1D8(const std::string substreams)
            // fill in the variable with values from starting index to
            // starting index + count
            bpWriter.BeginStep();

            bpWriter.Put(var_iString, currentTestData.S1);
            bpWriter.Put(var_i8, currentTestData.I8.data());
            bpWriter.Put(var_i16, currentTestData.I16.data());
Loading