Skip to content

Commit

Permalink
Merge pull request #33 from vhewes/dev
Browse files Browse the repository at this point in the history
merge in development branch
  • Loading branch information
vhewes authored May 23, 2023
2 parents 5779c47 + 5113f46 commit 8e34f9d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
26 changes: 13 additions & 13 deletions pynuml/io/file.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,8 @@ def data_partition(self) -> None:
comm = MPI.COMM_WORLD
rank = comm.Get_rank()
nprocs = comm.Get_size()
self._starts = np.zeros(nprocs, dtype=np.int)
self._counts = np.zeros(nprocs, dtype=np.int)
self._starts = np.zeros(nprocs, dtype=int)
self._counts = np.zeros(nprocs, dtype=int)

if rank == 0:
if self._use_seq_cnt:
Expand Down Expand Up @@ -283,7 +283,7 @@ def data_partition(self) -> None:
# a dataset have the same event ID. It is also possible some event
# IDs contain no data. First, we accumulate numbers of events
# across all groups
evt_size = np.zeros(num_events, dtype=np.int)
evt_size = np.zeros(num_events, dtype=int)
if self._use_seq_cnt:
for group, datasets in self._groups:
seq_cnt = self._whole_seq_cnt[group]
Expand Down Expand Up @@ -361,10 +361,10 @@ def data_partition(self) -> None:
# All processes participate the collective communication, scatter.
# Root distributes start and count to all processes. Note only root process
# uses self._starts and self._counts.
start_count = np.empty([nprocs, 2], dtype=np.int)
start_count = np.empty([nprocs, 2], dtype=int)
start_count[:, 0] = self._starts[:]
start_count[:, 1] = self._counts[:]
recvbuf = np.empty(2, dtype=np.int)
recvbuf = np.empty(2, dtype=int)
comm.Scatter(start_count, recvbuf, root=0)
self._my_start = recvbuf[0]
self._my_count = recvbuf[1]
Expand Down Expand Up @@ -407,9 +407,9 @@ def calc_bound_seq(self, group):
rank = comm.Get_rank()
nprocs = comm.Get_size()

displ = np.zeros([nprocs], dtype=np.int)
count = np.zeros([nprocs], dtype=np.int)
bounds = np.zeros([nprocs, 2], dtype=np.int)
displ = np.zeros([nprocs], dtype=int)
count = np.zeros([nprocs], dtype=int)
bounds = np.zeros([nprocs, 2], dtype=int)

all_evt_seq = None
if rank == 0:
Expand All @@ -428,7 +428,7 @@ def calc_bound_seq(self, group):
displ[i] = bounds[i, 0]
count[i] = bounds[i, 1] - bounds[i, 0] + 1

lower_upper = np.empty([2], dtype=np.int)
lower_upper = np.empty([2], dtype=int)

# root distributes start and end indices to all processes
comm.Scatter(bounds, lower_upper, root=0)
Expand Down Expand Up @@ -456,9 +456,9 @@ def calc_bound_seq_cnt(self, group):
rank = comm.Get_rank()
nprocs = comm.Get_size()

displ = np.zeros([nprocs], dtype=np.int)
count = np.zeros([nprocs], dtype=np.int)
seq_cnt = np.zeros([nprocs, 2], dtype=np.int)
displ = np.zeros([nprocs], dtype=int)
count = np.zeros([nprocs], dtype=int)
seq_cnt = np.zeros([nprocs, 2], dtype=int)

all_seq_cnt = None
if rank == 0:
Expand Down Expand Up @@ -491,7 +491,7 @@ def calc_bound_seq_cnt(self, group):
count[:] = seq_cnt[:, 1] * 2

# root distributes seq_cnt to all processes
my_seq_cnt = np.empty([2], dtype=np.int)
my_seq_cnt = np.empty([2], dtype=int)
comm.Scatter(seq_cnt, my_seq_cnt, root=0)

# self._seq_cnt[group][:, 0] is the event ID
Expand Down
2 changes: 1 addition & 1 deletion pynuml/io/out.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def __call__(self, name: str, obj: Any) -> None:
ds = self.f.create_dataset(f"/{name}", shape=(), dtype=ctype, data=data)
del ctype, fields, data, ds

def write_metadata(metadata: dict[str, Any]) -> None:
def write_metadata(self, metadata: dict[str, Any]) -> None:
for key, val in metadata.items():
self.f[key] = val

Expand Down
4 changes: 2 additions & 2 deletions pynuml/process/hitgraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def columns(self) -> dict[str, list[str]]:
@property
def metadata(self):
metadata = { 'planes': self.planes }
if laleller is not None:
metadata['classes'] = labeller.labels[:-1]
if self.labeller is not None:
metadata['classes'] = self.labeller.labels[:-1]
return metadata

def __call__(self, evt: 'pynuml.io.Event') -> tuple[str, Any]:
Expand Down

0 comments on commit 8e34f9d

Please sign in to comment.