From be53df8f83aece7aa65b8a1e4f2d9b486071de6b Mon Sep 17 00:00:00 2001 From: manauref Date: Sat, 16 Apr 2022 17:15:46 -0700 Subject: [PATCH 1/3] Fix helloBPTimeWriter Python example. --- .../hello/bpTimeWriter/helloBPTimeWriter.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/examples/hello/bpTimeWriter/helloBPTimeWriter.py b/examples/hello/bpTimeWriter/helloBPTimeWriter.py index 7cadf886eb..8b735c45d7 100644 --- a/examples/hello/bpTimeWriter/helloBPTimeWriter.py +++ b/examples/hello/bpTimeWriter/helloBPTimeWriter.py @@ -19,28 +19,35 @@ # 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') + +fileID = bpIO.AddTransport('File', {'Library': 'fstream'}) # 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])) - bpFileWriter.Put(bpArray, myArray) + time[0] = t + bpFileWriter.Put(bpTimeStep, time) + bpFileWriter.Put(bpArray, myArray) #, adios2.Mode.Sync) bpFileWriter.EndStep() bpFileWriter.Close() From fb2979682a370e3c2686185719fc34a7587089d2 Mon Sep 17 00:00:00 2001 From: manauref Date: Sat, 16 Apr 2022 23:42:11 -0700 Subject: [PATCH 2/3] Correct formating in example helloBPTimeWriter.py --- examples/hello/bpTimeWriter/helloBPTimeWriter.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/hello/bpTimeWriter/helloBPTimeWriter.py b/examples/hello/bpTimeWriter/helloBPTimeWriter.py index 8b735c45d7..32d783a8fc 100644 --- a/examples/hello/bpTimeWriter/helloBPTimeWriter.py +++ b/examples/hello/bpTimeWriter/helloBPTimeWriter.py @@ -31,8 +31,8 @@ fileID = bpIO.AddTransport('File', {'Library': 'fstream'}) # Variables -bpArray = bpIO.DefineVariable("bpArray", myArray, [size * nx], [rank * nx], [nx], - adios2.ConstantDims) +bpArray = bpIO.DefineVariable("bpArray", myArray, [size * nx], [rank * nx], + [nx], adios2.ConstantDims) bpTimeStep = bpIO.DefineVariable("bpTimeStep", time) # Engine @@ -47,7 +47,7 @@ if rank == 0: time[0] = t bpFileWriter.Put(bpTimeStep, time) - bpFileWriter.Put(bpArray, myArray) #, adios2.Mode.Sync) + bpFileWriter.Put(bpArray, myArray) bpFileWriter.EndStep() bpFileWriter.Close() From 857994d6058c2cb256bc558471fc31044c5a5c10 Mon Sep 17 00:00:00 2001 From: manauref Date: Sun, 17 Apr 2022 11:45:02 -0700 Subject: [PATCH 3/3] Remove unnecessary specification of engine and transport in Python TimeWriter example. --- examples/hello/bpTimeWriter/helloBPTimeWriter.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/examples/hello/bpTimeWriter/helloBPTimeWriter.py b/examples/hello/bpTimeWriter/helloBPTimeWriter.py index 32d783a8fc..680a5c0942 100644 --- a/examples/hello/bpTimeWriter/helloBPTimeWriter.py +++ b/examples/hello/bpTimeWriter/helloBPTimeWriter.py @@ -26,9 +26,6 @@ # IO bpIO = adios.DeclareIO("BPN2N") -bpIO.SetEngine('bp3') - -fileID = bpIO.AddTransport('File', {'Library': 'fstream'}) # Variables bpArray = bpIO.DefineVariable("bpArray", myArray, [size * nx], [rank * nx],