$ python ./test_adios.py """ import adios as ad import numpy as np import sys ## Writing print "\n>>> Writing ...\n" config = "config.xml" if len(sys.argv) > 1: config = sys.argv[1] ad.init(config) fd = ad.open("temperature", "adios_test.bp", "w") NX = 10 size = 2 groupsize = 4 + 4 + 8 * size * NX t = np.array(range(NX*size), dtype=np.float64) tt = t.reshape((size, NX)) ad.set_group_size(fd, groupsize) ad.write_int(fd, "NX", NX) ad.write_int(fd, "size", size) ad.write(fd, "temperature", tt) ad.close(fd) ad.finalize()
#!/usr/bin/env python """ Example: $ python ./test_adios.py """ import adios as ad import numpy as np ## Writing print "\n>>> Writing ...\n" ad.init("config.xml") fd = ad.open("temperature", "adios_test.bp", "w") NX = 10 size = 2 groupsize = 4 + 4 + 8 * size * NX t = np.array(range(NX*size), dtype=np.float64) tt = t.reshape((size, NX)) ad.set_group_size(fd, groupsize) ad.write_int(fd, "NX", NX) ad.write_int(fd, "size", size) ad.write(fd, "temperature", tt) ad.close(fd) ad.finalize() ## Reading print "\n>>> Reading ...\n"
#!/usr/bin/env python import adios import numpy as np adios.init("config.xml") fd = adios.open("temperature", "adios_test.bp", "w") NX = 10 size = 1 rank = 0 groupsize = 4 + 4 + 4 + 8 * 1 * NX t = np.array(range(NX), dtype=np.float64) adios.set_group_size(fd, groupsize) adios.write_int(fd, "NX", NX) adios.write_int(fd, "size", size) adios.write_int(fd, "rank", rank) adios.write(fd, "temperature", t) adios.close(fd) adios.finalize()