Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
373 changes: 197 additions & 176 deletions LICENSE

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Copyright (c) 2023 UChicago Argonne, LLC and contributors. All rights reserved.

Title: BoxKit (SF-23-0)
Title: BoxKit (SF-23-067)

By: Argonne National Laboratory ARGONNE NATIONAL LABORATORY, WITH A
FACILITY IN THE STATE OF ILLINOIS, IS OWNED BY THE UNITED STATES
Expand Down
2 changes: 1 addition & 1 deletion boxkit/__meta__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Metadata for BoxKit package"""

__pkgname__ = "BoxKit"
__version__ = "2023.06.5"
__version__ = "2023.06.7"
__authors__ = "Akash Dhruv"
__license__ = "Apache License"
__copyright__ = "Copyright (c) Akash Dhruv 2023. All Rights Reserved."
Expand Down
46 changes: 24 additions & 22 deletions boxkit/resources/read/_flash.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,24 @@ def read_flash(

# Create block attributes
block_attributes = get_blk_attributes(
(lblock for lblock in range(nblocks)), inputfile, nxb, nyb, nzb
(lblock for lblock in range(nblocks)),
inputfile["block size"][:],
inputfile["bounding box"][:],
inputfile["refine level"][:],
inputfile["node type"][:],
inputfile["processor number"][:],
nxb,
nyb,
nzb,
)

return data_attributes, block_attributes


@Action
def get_blk_attributes(lblock, inputfile, nxb, nyb, nzb):
def get_blk_attributes(
lblock, block_size, bounding_box, refine_level, node_type, proc_num, nxb, nyb, nzb
): # pylint: disable=too-many-arguments
"""
lblock: block number
inputfile: HDF5 file handle
Expand All @@ -87,27 +97,19 @@ def get_blk_attributes(lblock, inputfile, nxb, nyb, nzb):
block_dict
"""
block_dict = {
"dx": inputfile["block size"][lblock][0] / nxb,
"dy": (
1.0
if inputfile["block size"][lblock][1] == 0.0
else inputfile["block size"][lblock][1] / nyb
),
"dz": (
1.0
if inputfile["block size"][lblock][2] == 0.0
else inputfile["block size"][lblock][2] / nzb
),
"xmin": inputfile["bounding box"][lblock][0][0],
"ymin": inputfile["bounding box"][lblock][1][0],
"zmin": inputfile["bounding box"][lblock][2][0],
"xmax": inputfile["bounding box"][lblock][0][1],
"ymax": inputfile["bounding box"][lblock][1][1],
"zmax": inputfile["bounding box"][lblock][2][1],
"dx": block_size[lblock][0] / nxb,
"dy": (1.0 if block_size[lblock][1] == 0.0 else block_size[lblock][1] / nyb),
"dz": (1.0 if block_size[lblock][2] == 0.0 else block_size[lblock][2] / nzb),
"xmin": bounding_box[lblock][0][0],
"ymin": bounding_box[lblock][1][0],
"zmin": bounding_box[lblock][2][0],
"xmax": bounding_box[lblock][0][1],
"ymax": bounding_box[lblock][1][1],
"zmax": bounding_box[lblock][2][1],
"tag": lblock,
"level": inputfile["refine level"][lblock],
"leaf": bool(inputfile["node type"][lblock] == 1),
"inputproc": inputfile["processor number"][lblock],
"level": refine_level[lblock],
"leaf": bool(node_type[lblock] == 1),
"inputproc": proc_num[lblock],
}

return block_dict
16 changes: 15 additions & 1 deletion tests/acadia/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
"""Run the test suite."""

import os
import io
import sys
import contextlib
import unittest
from datetime import date


def main():
Expand All @@ -12,7 +16,17 @@ def main():
for test in tests:
suite.addTest(unittest.defaultTestLoader.loadTestsFromName(test))

res = unittest.TextTestRunner().run(suite).wasSuccessful()
with io.StringIO() as buf:
with contextlib.redirect_stdout(buf):
res = unittest.TextTestRunner(stream=buf).run(suite).wasSuccessful()

print(buf.getvalue())

with open(
f"{os.path.dirname(__file__)}/archive/{str(date.today())}.log", "w"
) as bufOut:
print(buf.getvalue(), file=bufOut)

rc = 0 if res else 1
sys.exit(rc)

Expand Down
40 changes: 40 additions & 0 deletions tests/acadia/archive/2023-06-27.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@

-------------------------Running: boiling.TestBoiling.test_data_pointers_3D-------------------------

boiling.TestBoiling.test_data_pointers_3D: 0.058s
.
-------------------------Running: boiling.TestBoiling.test_mergeblocks_3D-------------------------

[cpu_count]: 8 [cpu_avail]: 2 [mem_avail]: 8.17 GB [cpu_usage]: 78.1% [mem_usage]: 48.9%
run-loky:boxkit.api._mergeblocks.map_blk_to_merged_dset
[boxkit.mergeblocks.map_dataset_block]: 0.305s
[boxkit.mergeblocks]: 0.327s
boiling.TestBoiling.test_mergeblocks_3D: 0.478s
.
-------------------------Running: boiling.TestBoiling.test_neighbors_3D-------------------------

boiling.TestBoiling.test_neighbors_3D: 0.096s
.
-------------------------Running: boiling.TestBoiling.test_regionprops_3D-------------------------

run-loky:boxkit.api._regionprops.skimage_props_blk
boxkit.regionprops: 2.187s
boiling.TestBoiling.test_regionprops_3D: 2.26s
.
-------------------------Running: boiling.TestBoiling.test_slice_3D-------------------------

boiling.TestBoiling.test_slice_3D: 0.061s
.
-------------------------Running: heater.TestHeater.test_neighbors_oneblk_2D-------------------------

heater.TestHeater.test_neighbors_oneblk_2D: 0.002s
.
-------------------------Running: heater.TestHeater.test_regionprops_oneblk_2D-------------------------

heater.TestHeater.test_regionprops_oneblk_2D: 0.05s
.
----------------------------------------------------------------------
Ran 7 tests in 3.006s

OK

16 changes: 15 additions & 1 deletion tests/sedona/__main__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
"""Run the test suite."""

import os
import io
import sys
import contextlib
import unittest
from datetime import date


def main():
Expand All @@ -12,7 +16,17 @@ def main():
for test in tests:
suite.addTest(unittest.defaultTestLoader.loadTestsFromName(test))

res = unittest.TextTestRunner().run(suite).wasSuccessful()
with io.StringIO() as buf:
with contextlib.redirect_stdout(buf):
res = unittest.TextTestRunner(stream=buf).run(suite).wasSuccessful()

print(buf.getvalue())

with open(
f"{os.path.dirname(__file__)}/archive/{str(date.today())}.log", "w"
) as bufOut:
print(buf.getvalue(), file=bufOut)

rc = 0 if res else 1
sys.exit(rc)

Expand Down
83 changes: 83 additions & 0 deletions tests/sedona/archive/2023-06-27.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@

-------------------------Running: boiling.TestBoiling.test_data_pointers_3D-------------------------

boiling.TestBoiling.test_data_pointers_3D: 0.615s
.
-------------------------Running: boiling.TestBoiling.test_mean_temporal_3D-------------------------

[boxkit.mean_temporal.mean_blk_list]: 1.823s
[boxkit.mean_temporal]: 1.992s
[cpu_count]: 24 [cpu_avail]: 20 [mem_avail]: 25.85 GB [cpu_usage]: 18.6% [mem_usage]: 17.3%
run-loky:boxkit.api._mergeblocks.map_blk_to_merged_dset
[boxkit.mergeblocks.map_dataset_block]: 0.231s
[boxkit.mergeblocks]: 0.261s
boiling.TestBoiling.test_mean_temporal_3D: 2.888s
.
-------------------------Running: boiling.TestBoiling.test_mergeblocks_3D-------------------------

[cpu_count]: 24 [cpu_avail]: 21 [mem_avail]: 25.87 GB [cpu_usage]: 15.6% [mem_usage]: 17.2%
run-loky:boxkit.api._mergeblocks.map_blk_to_merged_dset
[boxkit.mergeblocks.map_dataset_block]: 0.218s
[boxkit.mergeblocks]: 0.239s
boiling.TestBoiling.test_mergeblocks_3D: 0.372s
.
-------------------------Running: boiling.TestBoiling.test_neighbors_3D-------------------------

boiling.TestBoiling.test_neighbors_3D: 0.904s
.
-------------------------Running: boiling.TestBoiling.test_regionprops_3D-------------------------

run-loky:boxkit.api._regionprops.skimage_props_blk
run-loky:boxkit.api._regionprops.skimage_props_blk
run-loky:boxkit.api._regionprops.skimage_props_blk
run-loky:boxkit.api._regionprops.skimage_props_blk
run-loky:boxkit.api._regionprops.skimage_props_blk
run-loky:boxkit.api._regionprops.skimage_props_blk
boxkit.regionprops: 2.388s
boiling.TestBoiling.test_regionprops_3D: 3.34s
.
-------------------------Running: boiling.TestBoiling.test_slice_3D-------------------------

boiling.TestBoiling.test_slice_3D: 0.661s
.
-------------------------Running: heater.TestHeater.test_neighbors_oneblk_2D-------------------------

heater.TestHeater.test_neighbors_oneblk_2D: 0.037s

.
-------------------------Running: heater.TestHeater.test_regionprops_blocks_2D-------------------------

heater.TestHeater.test_regionprops_blocks_2D: 1.602s

.
-------------------------Running: heater.TestHeater.test_regionprops_oneblk_2D-------------------------

heater.TestHeater.test_regionprops_oneblk_2D: 0.185s

.
-------------------------Running: application.TestApplication.test_flowx-------------------------

run-loky:flowx.imbound._interface.utils._shapely_search._search_block
Search time: 2.0188839435577393
[fill guardcells time]: 0.024975061416625977
.
-------------------------Running: astrophysics.TestAstrophysics.test_read_nthreads_12_3D-------------------------

run-loky:boxkit.resources.read._flash.get_blk_attributes
Dataset:
- type : <class 'boxkit.library._dataset.Dataset'>
- file : <HDF5 file "25m_3d_32km_hdf5_plt_cnt_1000" (mode r)>
- keys : ['dens', 'temp', 'velx', 'vely', 'ye ', 'fe54', 'fe56', 'o16 ', 'si28', 'entr', 'enuc', 'cr48', 'cr56', 'fe52', 'ni56', 'pres', 'c12 ', 's32 ', 'gpot', 'gamc', 'dtbn', 'velz']
- dtype : [<class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>, <class 'h5pickle.Dataset'>]
- bound(z-y-x) : [-10000000000.0, 10000000000.0] x [-10000000000.0, 10000000000.0] x [-10000000000.0, 10000000000.0]
- shape(z-y-x) : 8 x 8 x 8
- guard(z-y-x) : 0 x 0 x 0
- nblocks : 90200
- dtype : {'dens': <class 'h5pickle.Dataset'>, 'temp': <class 'h5pickle.Dataset'>, 'velx': <class 'h5pickle.Dataset'>, 'vely': <class 'h5pickle.Dataset'>, 'ye ': <class 'h5pickle.Dataset'>, 'fe54': <class 'h5pickle.Dataset'>, 'fe56': <class 'h5pickle.Dataset'>, 'o16 ': <class 'h5pickle.Dataset'>, 'si28': <class 'h5pickle.Dataset'>, 'entr': <class 'h5pickle.Dataset'>, 'enuc': <class 'h5pickle.Dataset'>, 'cr48': <class 'h5pickle.Dataset'>, 'cr56': <class 'h5pickle.Dataset'>, 'fe52': <class 'h5pickle.Dataset'>, 'ni56': <class 'h5pickle.Dataset'>, 'pres': <class 'h5pickle.Dataset'>, 'c12 ': <class 'h5pickle.Dataset'>, 's32 ': <class 'h5pickle.Dataset'>, 'gpot': <class 'h5pickle.Dataset'>, 'gamc': <class 'h5pickle.Dataset'>, 'dtbn': <class 'h5pickle.Dataset'>, 'velz': <class 'h5pickle.Dataset'>}
astrophysics.TestAstrophysics.test_read_nthreads_12_3D: 4.612s
.
----------------------------------------------------------------------
Ran 11 tests in 17.356s

OK

1 change: 1 addition & 0 deletions tests/sedona/astrophysics.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ def test_read_nthreads_12_3D(self):
for filename in self.filenames
]
for dataset in dataframes:
print(dataset)
dataset.purge()

def tearDown(self):
Expand Down