Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix helloBPTimeWriter Python example. #3167

Merged
merged 3 commits into from
Apr 17, 2022
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions examples/hello/bpTimeWriter/helloBPTimeWriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,27 +19,34 @@
# User data
myArray = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
nx = myArray.size
time = np.array([0.0])

# ADIOS
adios = adios2.ADIOS(comm, adios2.DebugON)

# IO
bpIO = adios.DeclareIO("BPN2N")
bpIO.SetEngine('bp3')
JasonRuonanWang marked this conversation as resolved.
Show resolved Hide resolved

fileID = bpIO.AddTransport('File', {'Library': 'fstream'})
JasonRuonanWang marked this conversation as resolved.
Show resolved Hide resolved

# Variables
bpArray = bpIO.DefineVariable("bpArray", [size * nx], [rank * nx], [nx],
adios2.ConstantDims, myArray)
bpTimeStep = bpIO.DefineVariable("bpTimeStep")
bpArray = bpIO.DefineVariable("bpArray", myArray, [size * nx], [rank * nx],
[nx], adios2.ConstantDims)
bpTimeStep = bpIO.DefineVariable("bpTimeStep", time)

# Engine
bpFileWriter = bpIO.Open("myArray.bp", adios2.OpenModeWrite)
bpFileWriter = bpIO.Open("myArray.bp", adios2.Mode.Write)
# Doesn't work: bpFileWriter = bpIO.Open("myArray.bp", adios2.OpenModeWrite)
# Doesn't work: bpFileWriter = bpIO.Open("myArray.bp", adiosOpenModeWrite,
# MPI.COMM_WORLD)


for t in range(0, 10):
bpFileWriter.BeginStep()
if rank == 0:
bpFileWriter.Put(bpTimeStep, np.array([t]))
time[0] = t
bpFileWriter.Put(bpTimeStep, time)
bpFileWriter.Put(bpArray, myArray)
bpFileWriter.EndStep()

Expand Down