Skip to content

adios2 streaming memory leak or incorrect usage? #1604

@costeastefan

Description

@costeastefan

I wish to stream data using ADIOS2 backend in a non-blocking way, minimal working example below.
The memory usage keeps growing although I specified queue limit =1 and discard iterations when queue full. Am I using it wrong?

#include <openPMD/openPMD.hpp>
#include <algorithm>
#include <iostream>
#include <string>
#include <vector>
#include <memory>
#include <numeric>
#include<unistd.h>  // sleep(), for linux 

using std::cout;
using namespace openPMD;

int main(int argc, char* argv[]) {

	unsigned long i, j;
    std::vector<unsigned long> chunk;
    std::vector<std::vector<unsigned long>> chunks;

    // open file for streaming
    Series series = Series("samples/mwe.sst", Access::CREATE,
            R"(
            {
              "adios2": {
                "engine": {
                  "parameters": {
                    "DataTransport": "WAN",
                    "RendezvousReaderCount": "0",
                    "QueueLimit": "1",
                    "QueueFullPolicy": "Discard"
                  }
                }
              }
            })");

    unsigned long L=10000000; // data array length

    Datatype datatype = determineDatatype<unsigned long>();
	Dataset dataset = Dataset(datatype, {L});
	
    int N = 20; // No. of iterations

    for(i=0; i<N; i++) {

           cout << "Iteration: " << i << "\n";
    
           // prepare local data
           for(j=0; j<L; j++)
	        chunk.push_back(j+i*L);
    
          Iteration it = series.writeIterations()[i];
		
          MeshRecordComponent mesh = 
	          it.meshes["field"][MeshRecordComponent::SCALAR];
          mesh.resetDataset(dataset);
	           mesh.storeChunk(chunk, {0}, {L});
	           it.close();
	           chunk.clear();
	           sleep(1);
    	  }

    series.close();

    sleep(10);

    return 0;
}
// ...

Software Environment:

  • version of openPMD-api: 0.15.1
  • installed openPMD-api via: from source

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions