diff --git a/README.md b/README.md index c974b3f..6c0cff2 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,17 @@ This is a [`yt`](https://yt-project.org/) frontend for [`libyt`](https://github. * **yt**: https://yt-project.org/ * **libyt Repo**: https://github.com/yt-project/libyt * **libyt Doc**: https://libyt.readthedocs.io/en/latest/ + + +### Install + +- From PyPI: + ```bash + pip install yt-libyt + ``` +- From source: + ```bash + git clone https://github.com/data-exp-lab/yt_libyt.git + cd yt_libyt + pip install . + ``` diff --git a/yt_libyt/_version.py b/yt_libyt/_version.py index 6526deb..a73339b 100644 --- a/yt_libyt/_version.py +++ b/yt_libyt/_version.py @@ -1 +1 @@ -__version__ = "0.0.7" +__version__ = "0.0.8" diff --git a/yt_libyt/data_structures.py b/yt_libyt/data_structures.py index 9afea2b..c82ebdb 100644 --- a/yt_libyt/data_structures.py +++ b/yt_libyt/data_structures.py @@ -53,6 +53,7 @@ def __repr__(self): class libytHierarchy(GridIndex): grid = libytGrid libyt = None + # _preload_implemented = True # Not sure about this option def __init__(self, ds, dataset_type="libyt"): @@ -274,6 +275,9 @@ def _set_code_unit_attributes(self): setdefaultattr( self, "magnetic_unit", self.quan(self.libyt.param_yt["magnetic_unit"], "gauss") ) + setdefaultattr( + self, "velocity_unit", self.quan(self.libyt.param_yt["velocity_unit"], "cm/s") + ) def _parse_parameter_file(self): # dataset identifier diff --git a/yt_libyt/io.py b/yt_libyt/io.py index d1e9f9a..cc8db8e 100644 --- a/yt_libyt/io.py +++ b/yt_libyt/io.py @@ -289,12 +289,25 @@ def _read_fluid_selection(self, chunks, selector, fields, size): @staticmethod def _get_my_rank(): - from mpi4py import MPI + import libyt - comm = MPI.COMM_WORLD - return comm.Get_rank() + if libyt.libyt_info["SERIAL_MODE"] is False: + try: + from mpi4py import MPI + + comm = MPI.COMM_WORLD + return comm.Get_rank() + except ImportError: + raise ImportError("Need mpi4py in parallel mode (SERIAL_MODE = false)") + else: + return 0 def _distinguish_nonlocal_grids(self, chunks): + + if self.libyt.libyt_info["SERIAL_MODE"] is True: + # we don't need rma + return False, [], [], [] + # Split local and non-local grids. from mpi4py import MPI