Skip to content

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
cgcgcg committed Nov 26, 2021
0 parents commit bf56470
Show file tree
Hide file tree
Showing 322 changed files with 86,938 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

PyNucleus/_version.py export-subst
89 changes: 89 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@

# VERSION: 0.1
# DESCRIPTION: Dockerized PyNucleus build
# AUTHOR: Christian Glusa

# Base docker image
FROM debian:testing
LABEL maintainer Christian Glusa

ENV LANG C.UTF-8

# based on recommendations from
# https://docs.nersc.gov/development/shifter/how-to-use/

# add contrib and non-free debian repos
RUN sed -i "s#deb http://deb.debian.org/debian testing main#deb http://deb.debian.org/debian testing main contrib non-free#g" /etc/apt/sources.list

# install packages needed for build
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y \
autoconf automake gcc g++ make gfortran wget zlib1g-dev libffi-dev \
tk-dev \
libssl-dev ca-certificates cmake \
git less \
libboost-dev \
hdf5-tools \
libsuitesparse-dev \
libarpack2-dev \
libmkl-avx2 libmkl-dev \
--no-install-recommends \
&& rm -rf /var/lib/apt/lists/*

ENV LD_LIBRARY_PATH /usr/local/lib

RUN echo "alias ls='ls --color=auto -FN'" >> /root/.bashrc

RUN mkdir /build/

# install python
# Consider adding configure flags:
# --enable-optimizations
# --with-lto
# --build="$gnuArch"
# --enable-shared
# --with-system-expat
# --with-system-ffi
ARG pythonVersion=3.8.2
RUN cd /build && wget --no-check-certificate https://www.python.org/ftp/python/${pythonVersion}/Python-${pythonVersion}.tgz \
&& tar xvzf Python-${pythonVersion}.tgz && cd /build/Python-${pythonVersion} \
&& ./configure --enable-optimizations --with-pymalloc --enable-shared && make -j4 && make install && make clean && rm /build/Python-${pythonVersion}.tgz && rm -rf /build/Python-${pythonVersion}

# install mpich
ARG mpichVersion=3.2
RUN cd /build && wget --no-check-certificate https://www.mpich.org/static/downloads/${mpichVersion}/mpich-${mpichVersion}.tar.gz \
&& tar xvzf mpich-${mpichVersion}.tar.gz && cd /build/mpich-${mpichVersion} \
&& ./configure && make -j4 && make install && make clean && rm /build/mpich-${mpichVersion}.tar.gz && rm -rf /build/mpich-${mpichVersion}

# install mpi4py
ARG mpi4pyVersion=3.0.3
RUN cd /build && wget --no-check-certificate https://bitbucket.org/mpi4py/mpi4py/downloads/mpi4py-${mpi4pyVersion}.tar.gz \
&& tar xvzf mpi4py-${mpi4pyVersion}.tar.gz && cd /build/mpi4py-${mpi4pyVersion} \
&& python3 setup.py build && python3 setup.py install && rm -rf /build/mpi4py-${mpi4pyVersion}

# install parmetis
ARG parmetisVersion=4.0.3
RUN cd /build && wget --no-check-certificate http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-${parmetisVersion}.tar.gz \
&& tar xvzf parmetis-${parmetisVersion}.tar.gz && cd /build/parmetis-${parmetisVersion} \
&& make config shared=1 && make -j4 && make install && make clean && rm /build/parmetis-${parmetisVersion}.tar.gz && rm -rf /build/parmetis-${parmetisVersion}

# install metis
ARG metisVersion=5.1.0
RUN cd /build && wget --no-check-certificate http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-${metisVersion}.tar.gz \
&& tar xvzf metis-${metisVersion}.tar.gz && cd /build/metis-${metisVersion} \
&& make config shared=1 && make -j4 && make install && make clean && rm /build/metis-${metisVersion}.tar.gz && rm -rf /build/metis-${metisVersion}

# delete build directory
RUN rm -rf /build/

RUN /sbin/ldconfig



# copy code to container and build
# we copy only the packages over, not any run scripts

COPY PyNucleus_* /home/pynucleus-build/
COPY setup.py /home/pynucleus-build/
COPY Makefile /home/pynucleus-build/
RUN cd /home/pynucleus-build && python -m pip install .
26 changes: 26 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Copyright 2021 National Technology & Engineering Solutions of Sandia,
LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the
U.S. Government retains certain rights in this software.

MIT License

Copyright (c) 2017-2021 Christian Glusa

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3 changes: 3 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

include versioneer.py
include PyNucleus/_version.py
135 changes: 135 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,135 @@
PYTHON ?= python3
VIRTUAL_ENV ?=
ifeq ($(VIRTUAL_ENV),)
FLAGS ?= --no-use-pep517 -e
PIP_FLAGS ?= --user
else
PYTHON = python
FLAGS ?= -e
PIP_FLAGS ?=
endif
TEST_RESULTS ?= index.html


install :
$(PYTHON) -m pip install packageTools/. && \
$(PYTHON) -m pip install base/. && \
$(PYTHON) -m pip install metisCy/. && \
$(PYTHON) -m pip install fem/. && \
$(PYTHON) -m pip install multilevelSolver/. && \
$(PYTHON) -m pip install nl/. && \
$(PYTHON) -m pip install .


clean :
$(PYTHON) -m pip uninstall PyNucleus_packageTools PyNucleus_base PyNucleus_metisCy PyNucleus_fem PyNucleus_multilevelSolver PyNucleus_nl

dev : dev_packageTools dev_base dev_metisCy dev_fem dev_multilevelSolver dev_nl dev_package

dev_packageTools :
@ echo "Entering directory \`packageTools/'"
cd packageTools; $(PYTHON) -m pip install $(FLAGS) .
dev_base_build :
@ echo "Entering directory \`base'"
cd base; $(PYTHON) -m pip install $(FLAGS) .
dev_base :
make dev_base_build
$(PYTHON) -c "import PyNucleus_base" || (make clean_base && make dev_base_build)
dev_metisCy_build :
@ echo "Entering directory \`metisCy'"
cd metisCy; $(PYTHON) -m pip install $(FLAGS) .
dev_metisCy :
make dev_metisCy_build
$(PYTHON) -c "import PyNucleus_metisCy" || (make clean_metisCy && make dev_metisCy_build)
dev_fem_build :
@ echo "Entering directory \`fem'"
cd fem; $(PYTHON) -m pip install $(FLAGS) .
dev_fem :
make dev_fem_build
$(PYTHON) -c "import PyNucleus_fem" || (make clean_fem && make dev_fem_build)
dev_multilevelSolver_build :
@ echo "Entering directory \`multilevelSolver'"
cd multilevelSolver; $(PYTHON) -m pip install $(FLAGS) .
dev_multilevelSolver :
make dev_multilevelSolver_build
$(PYTHON) -c "import PyNucleus_multilevelSolver" || (make clean_multilevelSolver && make dev_multilevelSolver_build)
dev_nl_build :
@ echo "Entering directory \`nl'"
cd nl; $(PYTHON) -m pip install $(FLAGS) .
dev_nl :
make dev_nl_build
$(PYTHON) -c "import PyNucleus_nl" || (make clean_nl && make dev_nl_build)
dev_package :
$(PYTHON) -m pip install $(FLAGS) .



clean_dev: clean_package clean_packageTools clean_base clean_metisCy clean_fem clean_multilevelSolver clean_nl
clean_packageTools :
$(PYTHON) -m pip uninstall PyNucleus_packageTools -y
clean_base :
$(PYTHON) -m pip uninstall PyNucleus_base -y
cd base/PyNucleus_base && \
rm -f *.so *.c *.pyc && \
rm -rf __pycache__
cd base && rm -rf build __pycache__ *.egg-info
clean_metisCy :
$(PYTHON) -m pip uninstall PyNucleus_metisCy -y
cd metisCy/PyNucleus_metisCy && \
rm -f *.so *.c *.pyc && \
rm -rf __pycache__
cd metisCy && rm -rf build __pycache__ *.egg-info
clean_fem :
$(PYTHON) -m pip uninstall PyNucleus_fem -y
cd fem/PyNucleus_fem && \
rm -f *.so *.c *.pyc && \
rm -rf __pycache__
cd fem && rm -rf build __pycache__ *.egg-info
clean_multilevelSolver :
$(PYTHON) -m pip uninstall PyNucleus_multilevelSolver -y
cd multilevelSolver/PyNucleus_multilevelSolver && \
rm -f *.so *.c *.pyc && \
rm -rf __pycache__
cd multilevelSolver && rm -rf build __pycache__ *.egg-info
clean_nl :
$(PYTHON) -m pip uninstall PyNucleus_nl -y
cd nl/PyNucleus_nl && \
rm -rf *.so *.c *.pyc *.html __pycache__ kernelsCy.cpp adaptiveQuad.cpp
cd nl && rm -rf build __pycache__ *.egg-info
clean_package :
$(PYTHON) -m pip uninstall PyNucleus -y

.PHONY: docs
docs :
cd docs && make
sphinx-build -b html docs docs/build

clean_docs :
cd docs; rm -rf build

createVirtualEnv:
$(PYTHON) -m virtualenv --python=$(PYTHON) venv --system-site-packages


list-tests:
$(PYTHON) -m pytest --collect-only tests/ tests/test.py

.PHONY: tests
tests:
$(PYTHON) -m pytest -rA --html=$(TEST_RESULTS) --self-contained-html tests/ tests/test.py

docker:
./build-docker.sh

docker-linux:
./run-docker-linux.sh

docker-mac:
./run-docker-mac.sh


prereq:
$(PYTHON) -m pip install $(PIP_FLAGS) Cython cython numpy scipy matplotlib pyyaml h5py pybind11 MeshPy tabulate modepy mpi4py scikit-sparse pyamg

prereq-extra:
$(PYTHON) -m pip install $(PIP_FLAGS) pytest pytest-html pytest-xdist Sphinx sphinxcontrib-programoutput
27 changes: 27 additions & 0 deletions PyNucleus/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
###################################################################################
# Copyright 2021 National Technology & Engineering Solutions of Sandia, #
# LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the #
# U.S. Government retains certain rights in this software. #
# If you want to use this code, please refer to the README.rst and LICENSE files. #
###################################################################################


import importlib
import pkgutil
import sys

subpackages = {}
for finder, name, ispkg in pkgutil.iter_modules():
if ispkg and name.find('PyNucleus_') == 0:
importName = name[len('PyNucleus_'):]
module = importlib.import_module(name, 'PyNucleus')
sys.modules['PyNucleus.'+importName] = module
subpackages[importName] = module
if "__all__" in module.__dict__:
names = module.__dict__["__all__"]
else:
names = [name for name in module.__dict__ if not name.startswith('_')]
locals().update({name: getattr(module, name) for name in names})

from . import _version
__version__ = _version.get_versions()['version']
Loading

0 comments on commit bf56470

Please sign in to comment.