File: global_array_read_deferred.py

package info (click to toggle)
adios2 2.11.0%2Bdfsg1-6
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 39,984 kB
  • sloc: ansic: 250,306; cpp: 189,875; yacc: 18,929; f90: 15,117; python: 8,047; perl: 7,126; sh: 3,049; lisp: 1,106; xml: 1,011; lex: 948; makefile: 598
file content (26 lines) | stat: -rw-r--r-- 814 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/bin/env python3

# Demonstrating deferred read
# multiple f.read(...) can be scheduled and executed once by
# f.read_complete()
# which allows ADIOS to use more threads to read more data concurrently.

# Run this after running the example
# mpirun -n 4 ./bin/adios2_basics_globalArrayNDWrite_mpi

import adios2
import numpy

with adios2.FileReader("globalArray.bp") as f:
    v = f.inquire_variable("GlobalArray")
    print(f"Variable GlobalArray shape = {v.shape()}, steps = {v.steps()}")
    data = f.read(v, defer_read=True)
    print(
        f"WRONG before data is read: data size = {data.size} "
        f"min = {data.min()}, max = {data.max()}"
    )
    f.read_complete()
    print(
        f"CORRECT after data is read: data size = {data.size} "
        f"min = {data.min()}, max = {data.max()}"
    )