Skip to content

Commit

Permalink
Merge pull request #20 from cindytsai/libyt-dev
Browse files Browse the repository at this point in the history
Fix
  • Loading branch information
cindytsai authored May 31, 2024
2 parents 863fb09 + 82cabbd commit e8d018a
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 .
```
2 changes: 1 addition & 1 deletion yt_libyt/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.0.7"
__version__ = "0.0.8"
4 changes: 4 additions & 0 deletions yt_libyt/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"):
Expand Down Expand Up @@ -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
Expand Down
19 changes: 16 additions & 3 deletions yt_libyt/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit e8d018a

Please sign in to comment.