Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
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
29 changes: 29 additions & 0 deletions .github/workflows/draft-pdf.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: draft-pdf

on:
pull_request:
branches:
- main
- development

jobs:
paper:
runs-on: ubuntu-latest
name: Paper Draft
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Build draft PDF
uses: openjournals/openjournals-draft-action@master
with:
journal: joss
# This should be the path to the paper within your repo.
paper-path: paper/paper.md
- name: Upload
uses: actions/upload-artifact@v1
with:
name: paper
# This is the output path where Pandoc will write the compiled
# PDF. Note, this should be the same directory as the input
# paper.md
path: paper/paper.pdf
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ boxkit/depends/boost/*
.sphinx/build/*
!.sphinx/source/index.rst
!README.rst
!DESIGN.rst
3 changes: 3 additions & 0 deletions .pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[DESIGN]
disable=
duplicate-code
30 changes: 30 additions & 0 deletions DESIGN.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
##############################################
|icon| Software Design and Developer's Guide
##############################################

*****
API
*****

BoxKit API details here

*********
Library
*********

BoxKit library details here

*******
C-Box
*******

C++ backend detailes here

***************
Miscellaneous
***************

Miscellaneous details about how to develop frontend methods, etc.

.. |icon| image:: ./media/book.svg
:width: 25
116 changes: 71 additions & 45 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,87 +1,113 @@
.. |icon| image:: ./media/icon.svg
:width: 30

=============
|icon| BoxKit
=============
###############
|icon| BoxKit
###############

|Code style: black|

|FlashX| |FlowX| |Minimal| |Publish|

BoxKit is a library that provides building blocks to parallelize and scale data science, high performance computing, and machine learning applications for block-structured datasets. Spatial data from simulations and experiments can be accessed and managed using tools available in this library when working with more data analysis oriented packages like SciKit (https://github.com/scikit-learn/scikit-learn) and FlowNet (https://github.com/NVIDIA/flownet2-pytorch)
BoxKit is a library that provides building blocks to parallelize and
scale data science, high performance computing, and machine learning
applications for block-structured datasets. Spatial data from
simulations and experiments can be accessed and managed using tools
available in this library when working with more data analysis oriented
packages like SciKit (https://github.com/scikit-learn/scikit-learn) and
FlowNet (https://github.com/NVIDIA/flownet2-pytorch)

Installation
============
**************
Installation
**************

Stable releases of BoxKit are hosted on Python Package Index website (`<https://pypi.org/project/BoxKit/>`_) and can be installed by executing,
Stable releases of BoxKit are hosted on Python Package Index website
(https://pypi.org/project/BoxKit/) and can be installed by executing,

::
.. code::

pip install BoxKit --user

export CXX=$(CPP_COMPILER)
pip install BoxKit --user --install-option="--enable-testing" --install-option="--with-cbox"

Note that ``pip`` should point to ``python3+`` installation package ``pip3``.

Upgrading and uninstallation is easily managed through this interface using,
Note that ``pip`` should point to ``python3+`` installation package
``pip3``.

Upgrading and uninstallation is easily managed through this interface
using,

::
.. code::

pip install --upgrade BoxKit --user
pip install --upgrade BoxKit --user --install-option="--enable-testing" --install-option="--with-cbox"
pip uninstall BoxKit

There maybe situations where users may want to install BoxKit in development mode $\\textemdash$ to design new features, debug, or customize classes/methods to their needs. This can be easily accomplished using the ``setup`` script located in the project root directory and executing,
There maybe situations where users may want to install BoxKit in
development mode $\\textemdash$ to design new features, debug, or
customize classes/methods to their needs. This can be easily
accomplished using the ``setup`` script located in the project root
directory and executing,

::
.. code::

./setup develop

Development mode enables testing of features/updates directly from the source code and is an effective method for debugging. Note that the ``setup`` script relies on ``click``, which can be installed using,
Development mode enables testing of features/updates directly from the
source code and is an effective method for debugging. Note that the
``setup`` script relies on ``click``, which can be installed using,

::
.. code::

pip install click

Usage
=====
pip install click

BoxKit is undergoing active development and therefore design changes are frequent, however, the library is divided into two broad categories:
*******
Usage
*******

- **Create**: Containing interface for classes/methods to store spatial data in a rectangular/cubic frame, along with auxillary tools to manage irregular geometries composed of unstructured triangular mesh.
BoxKit is undergoing active development and therefore design changes are
frequent, however, the library is divided into two broad categories:

- **Utilities**: Containing interface for classes/method to improve memory managment of data on NUMA nodes.
- **Create**: Containing interface for classes/methods to store spatial
data in a rectangular/cubic frame, along with auxillary tools to
manage irregular geometries composed of unstructured triangular mesh.

We are currently setting up use cases for BoxKit, and will update this section when we are able to demonstrate proof-of-concept.
- **Utilities**: Containing interface for classes/method to improve
memory managment of data on NUMA nodes.

Citation
========
We are currently setting up use cases for BoxKit, and will update this
section when we are able to demonstrate proof-of-concept.

::
**********
Citation
**********

@software{akash_dhruv_2022_7255632,
author = {Akash Dhruv},
title = {akashdhruv/BoxKit: October 2022},
month = oct,
year = 2022,
publisher = {Zenodo},
version = {22.10},
doi = {10.5281/zenodo.7255632},
url = {https://doi.org/10.5281/zenodo.7255632}
}
.. code::

Help & Support
==============
@software{akash_dhruv_2022_7255632,
author = {Akash Dhruv},
title = {akashdhruv/BoxKit: October 2022},
month = oct,
year = 2022,
publisher = {Zenodo},
version = {22.10},
doi = {10.5281/zenodo.7255632},
url = {https://doi.org/10.5281/zenodo.7255632}
}

Please file an issue on the repository page
****************
Help & Support
****************

Please file an issue on the repository page

.. |Code style: black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black

.. |FlashX| image:: https://github.com/akashdhruv/BoxKit/workflows/FlashX/badge.svg

.. |FlowX| image:: https://github.com/akashdhruv/BoxKit/workflows/FlowX/badge.svg

.. |Minimal| image:: https://github.com/akashdhruv/BoxKit/workflows/Minimal/badge.svg

.. |Publish| image:: https://github.com/akashdhruv/BoxKit/workflows/Publish/badge.svg

.. |icon| image:: ./media/icon.svg
:width: 30
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__ = "3.0"
__version__ = "2023.06"
__authors__ = "Akash Dhruv"
__license__ = "Apache License"
__copyright__ = "Copyright (c) Akash Dhruv 2021. All Rights Reserved."
Expand Down
18 changes: 11 additions & 7 deletions boxkit/api/_mean.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def mean_temporal(datasets, varlist, backend="serial", nthreads=1, monitor=False
if isinstance(varlist, str):
varlist = [varlist]

# TODO: Add more error handling here to account
# TODO: Add more error handling here to account # pylint: disable=fixme
# for consistency between multiple datasets
#
# Handle errors, compute level of the first
Expand All @@ -33,6 +33,13 @@ def mean_temporal(datasets, varlist, backend="serial", nthreads=1, monitor=False
# Create an mean dataset
mean_dataset = datasets[0].clone(storage="numpy-memmap")

# loop over varlist append values to
# add it to the mean dataset and perform mean
for varkey in varlist:
mean_dataset.addvar(varkey)

sample_size = len(datasets)

# Create a block list for reduction, first add
# blocks from average_dataset and then loop over
# datasets to add blocks from their respective blocklist
Expand All @@ -42,12 +49,8 @@ def mean_temporal(datasets, varlist, backend="serial", nthreads=1, monitor=False
for block, blk_list in zip(dataset.blocklist, blk_reduce_list):
blk_list.append(block)

# loop over varlist append values to
# add it to the mean dataset and perform mean
for varkey in varlist:
mean_dataset.addvar(varkey)

for varkey in varlist:
if monitor:
time_reduction = library.Timer("[boxkit.mean_temporal.mean_blk_list]")

Expand All @@ -58,7 +61,9 @@ def mean_temporal(datasets, varlist, backend="serial", nthreads=1, monitor=False
# pass list of parallel objects
(blk_list for blk_list in blk_reduce_list),
varkey,
sample_size,
)

if monitor:
del time_reduction

Expand All @@ -68,12 +73,11 @@ def mean_temporal(datasets, varlist, backend="serial", nthreads=1, monitor=False
return mean_dataset


def mean_blk_list(blk_list, varkey):
def mean_blk_list(blk_list, varkey, sample_size):
"""
Reduce dataset / compute average
"""
mean_blk = blk_list[0]
sample_size = len(blk_list[1:])

for work_blk in blk_list[1:]:
mean_blk[varkey] = mean_blk[varkey] + work_blk[varkey] / sample_size
26 changes: 13 additions & 13 deletions boxkit/api/_mergeblocks.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
"""Module with implemenetation of api methods"""

import sys

from .. import library
from .. import api
from ..library import Action
from boxkit import library # pylint: disable=cyclic-import
from boxkit import api # pylint: disable=cyclic-import
from boxkit.library import Action # pylint: disable=cyclic-import


def mergeblocks(
dataset, varlist, nthreads=1, batch="auto", monitor=False, backend="serial"
):
): # pylint: disable=too-many-arguments disable=too-many-locals
"""
Reshaped dataset at a level
"""
Expand All @@ -34,9 +32,15 @@ def mergeblocks(
)

# Compute number of blocks in each direction
nblockx = int((dataset.xmax - dataset.xmin) / dataset.blocklist[0].dx / dataset.nxb)
nblocky = int((dataset.ymax - dataset.ymin) / dataset.blocklist[0].dy / dataset.nyb)
nblockz = int((dataset.zmax - dataset.zmin) / dataset.blocklist[0].dz / dataset.nzb)
nblockx = round(
(dataset.xmax - dataset.xmin) / dataset.blocklist[0].dx / dataset.nxb
)
nblocky = round(
(dataset.ymax - dataset.ymin) / dataset.blocklist[0].dy / dataset.nyb
)
nblockz = round(
(dataset.zmax - dataset.zmin) / dataset.blocklist[0].dz / dataset.nzb
)

nblockx, nblocky, nblockz = [
value if value > 0 else 1 for value in [nblockx, nblocky, nblockz]
Expand Down Expand Up @@ -76,10 +80,6 @@ def mergeblocks(
if monitor:
resources.display()

print(
f"[mem_dataset]: {round(sys.getsizeof(dataset._data.variables[varlist[0]][:])/(2**20),2)} MB"
)

map_blk_to_merged_dset.nthreads = nthreads
map_blk_to_merged_dset.monitor = monitor
map_blk_to_merged_dset.backend = backend
Expand Down
2 changes: 1 addition & 1 deletion boxkit/api/_read.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def read_dataset(
force_memmap=False,
nthreads=1,
backend="serial",
):
): # pylint: disable=too-many-arguments disable=too-many-locals
"""
Create a dataset from a file

Expand Down
4 changes: 2 additions & 2 deletions boxkit/api/_regionprops.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import itertools
import skimage.measure as skimage_measure

from .. import api
from ..library import Action
from boxkit import api # pylint: disable=cyclic-import
from boxkit.library import Action # pylint: disable=cyclic-import


def regionprops(dataset, lsetkey, backend="serial", nthreads=1, monitor=False):
Expand Down
Loading