1# 2# Distributed under the OSI-approved Apache License, Version 2.0. See 3# accompanying file Copyright.txt for details. 4# 5# helloBPWriter.py : only works with MPI version 6# Created on: Feb 2, 2017 7# Author: William F Godoy godoywf@ornl.gov 8 9import numpy 10import adios2 11 12# User data 13myArray = numpy.array([0, 1., 2., 3., 4., 5., 6., 7., 8., 9.]) 14Nx = myArray.size 15 16# debug mode 17adios = adios2.ADIOS(adios2.DebugON) 18 19# ADIOS IO 20bpIO = adios.DeclareIO("BPFile_N2N") 21 22# ADIOS Variable name, shape, start, offset, constant dims 23ioArray = bpIO.DefineVariable( 24 "bpArray", myArray, [], [], [Nx], adios2.ConstantDims) 25 26# ADIOS Engine 27bpFileWriter = bpIO.Open("npArray.bp", adios2.Mode.Write) 28bpFileWriter.Put(ioArray, myArray, adios2.Mode.Sync) 29bpFileWriter.Close() 30