Output reading tools and scripts¶
To read *.bp with MATLAB set the environment variable
MATLABPATH to the directory of your ADIOS2 install.
In the MATLAB script you can import the data using the functions
data = adiosread('bp_file_path','variable_path_in_bp_file'); % do something with data
Example scripts (to come?)¶
To read *.bp with Python you need an ADIOS2 install configured with the flag
This ADIOS2 setting typically only works with the GNU compiler, so if you run XGC with ADIOS2 built using another compiler you may have to make a separate build of ADIOS2 for reading in Python.
To read ADIOS2 data in Python you can set the environment variable
PYTHONPATH and use import.
However, if you have separate ADIOS2 installs for running XGC and reading ADIOS2 data in Python there can be a conflict. The following works on Traverse where XGC is built with the PGI Compiler and we have a separate ADIOS2 build with the GNU compiler for Python.
import os if os.environ['XGC_PLATFORM'].lower() == 'traverse': from ctypes import * cdll.LoadLibrary("PATH_TO_INSTALL/adios2-gcc/lib64/libadios2_core.so.2") import adios2
To read data in Python it is possible to do:
with adios2.open("bp_file_path", "r") as fh: data = fh.read("variable_path_in_bp_file")
The read data will typically be a Numpy array with the corresponding dimensions to the XGC variable. However, depending on how the variable is stored in XGC it is sometimes necessary to read it by stepping to obtain all data:
import numpy as np import adios2 data_list =  with adios2.open("bp_file_path", "r") as fh: for fstep in fh: data_list.append(fstep.read("variable_path_in_bp_file")) data = np.array(data_list)
Example scripts (to come)¶
Scripts? Jupyter Notebooks?