Skip to content

Commit bf56470

Browse files
committed
release
0 parents  commit bf56470

File tree

322 files changed

+86938
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

322 files changed

+86938
-0
lines changed

.gitattributes

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+
PyNucleus/_version.py export-subst

Dockerfile

+89
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
2+
# VERSION: 0.1
3+
# DESCRIPTION: Dockerized PyNucleus build
4+
# AUTHOR: Christian Glusa
5+
6+
# Base docker image
7+
FROM debian:testing
8+
LABEL maintainer Christian Glusa
9+
10+
ENV LANG C.UTF-8
11+
12+
# based on recommendations from
13+
# https://docs.nersc.gov/development/shifter/how-to-use/
14+
15+
# add contrib and non-free debian repos
16+
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
17+
18+
# install packages needed for build
19+
RUN apt-get update && \
20+
DEBIAN_FRONTEND=noninteractive apt-get install -y \
21+
autoconf automake gcc g++ make gfortran wget zlib1g-dev libffi-dev \
22+
tk-dev \
23+
libssl-dev ca-certificates cmake \
24+
git less \
25+
libboost-dev \
26+
hdf5-tools \
27+
libsuitesparse-dev \
28+
libarpack2-dev \
29+
libmkl-avx2 libmkl-dev \
30+
--no-install-recommends \
31+
&& rm -rf /var/lib/apt/lists/*
32+
33+
ENV LD_LIBRARY_PATH /usr/local/lib
34+
35+
RUN echo "alias ls='ls --color=auto -FN'" >> /root/.bashrc
36+
37+
RUN mkdir /build/
38+
39+
# install python
40+
# Consider adding configure flags:
41+
# --enable-optimizations
42+
# --with-lto
43+
# --build="$gnuArch"
44+
# --enable-shared
45+
# --with-system-expat
46+
# --with-system-ffi
47+
ARG pythonVersion=3.8.2
48+
RUN cd /build && wget --no-check-certificate https://www.python.org/ftp/python/${pythonVersion}/Python-${pythonVersion}.tgz \
49+
&& tar xvzf Python-${pythonVersion}.tgz && cd /build/Python-${pythonVersion} \
50+
&& ./configure --enable-optimizations --with-pymalloc --enable-shared && make -j4 && make install && make clean && rm /build/Python-${pythonVersion}.tgz && rm -rf /build/Python-${pythonVersion}
51+
52+
# install mpich
53+
ARG mpichVersion=3.2
54+
RUN cd /build && wget --no-check-certificate https://www.mpich.org/static/downloads/${mpichVersion}/mpich-${mpichVersion}.tar.gz \
55+
&& tar xvzf mpich-${mpichVersion}.tar.gz && cd /build/mpich-${mpichVersion} \
56+
&& ./configure && make -j4 && make install && make clean && rm /build/mpich-${mpichVersion}.tar.gz && rm -rf /build/mpich-${mpichVersion}
57+
58+
# install mpi4py
59+
ARG mpi4pyVersion=3.0.3
60+
RUN cd /build && wget --no-check-certificate https://bitbucket.org/mpi4py/mpi4py/downloads/mpi4py-${mpi4pyVersion}.tar.gz \
61+
&& tar xvzf mpi4py-${mpi4pyVersion}.tar.gz && cd /build/mpi4py-${mpi4pyVersion} \
62+
&& python3 setup.py build && python3 setup.py install && rm -rf /build/mpi4py-${mpi4pyVersion}
63+
64+
# install parmetis
65+
ARG parmetisVersion=4.0.3
66+
RUN cd /build && wget --no-check-certificate http://glaros.dtc.umn.edu/gkhome/fetch/sw/parmetis/parmetis-${parmetisVersion}.tar.gz \
67+
&& tar xvzf parmetis-${parmetisVersion}.tar.gz && cd /build/parmetis-${parmetisVersion} \
68+
&& make config shared=1 && make -j4 && make install && make clean && rm /build/parmetis-${parmetisVersion}.tar.gz && rm -rf /build/parmetis-${parmetisVersion}
69+
70+
# install metis
71+
ARG metisVersion=5.1.0
72+
RUN cd /build && wget --no-check-certificate http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-${metisVersion}.tar.gz \
73+
&& tar xvzf metis-${metisVersion}.tar.gz && cd /build/metis-${metisVersion} \
74+
&& make config shared=1 && make -j4 && make install && make clean && rm /build/metis-${metisVersion}.tar.gz && rm -rf /build/metis-${metisVersion}
75+
76+
# delete build directory
77+
RUN rm -rf /build/
78+
79+
RUN /sbin/ldconfig
80+
81+
82+
83+
# copy code to container and build
84+
# we copy only the packages over, not any run scripts
85+
86+
COPY PyNucleus_* /home/pynucleus-build/
87+
COPY setup.py /home/pynucleus-build/
88+
COPY Makefile /home/pynucleus-build/
89+
RUN cd /home/pynucleus-build && python -m pip install .

LICENSE

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
Copyright 2021 National Technology & Engineering Solutions of Sandia,
2+
LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the
3+
U.S. Government retains certain rights in this software.
4+
5+
MIT License
6+
7+
Copyright (c) 2017-2021 Christian Glusa
8+
9+
Permission is hereby granted, free of charge, to any person obtaining
10+
a copy of this software and associated documentation files (the
11+
"Software"), to deal in the Software without restriction, including
12+
without limitation the rights to use, copy, modify, merge, publish,
13+
distribute, sublicense, and/or sell copies of the Software, and to
14+
permit persons to whom the Software is furnished to do so, subject to
15+
the following conditions:
16+
17+
The above copyright notice and this permission notice shall be
18+
included in all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
21+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23+
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25+
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

MANIFEST.in

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
2+
include versioneer.py
3+
include PyNucleus/_version.py

Makefile

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
PYTHON ?= python3
2+
VIRTUAL_ENV ?=
3+
ifeq ($(VIRTUAL_ENV),)
4+
FLAGS ?= --no-use-pep517 -e
5+
PIP_FLAGS ?= --user
6+
else
7+
PYTHON = python
8+
FLAGS ?= -e
9+
PIP_FLAGS ?=
10+
endif
11+
TEST_RESULTS ?= index.html
12+
13+
14+
install :
15+
$(PYTHON) -m pip install packageTools/. && \
16+
$(PYTHON) -m pip install base/. && \
17+
$(PYTHON) -m pip install metisCy/. && \
18+
$(PYTHON) -m pip install fem/. && \
19+
$(PYTHON) -m pip install multilevelSolver/. && \
20+
$(PYTHON) -m pip install nl/. && \
21+
$(PYTHON) -m pip install .
22+
23+
24+
clean :
25+
$(PYTHON) -m pip uninstall PyNucleus_packageTools PyNucleus_base PyNucleus_metisCy PyNucleus_fem PyNucleus_multilevelSolver PyNucleus_nl
26+
27+
dev : dev_packageTools dev_base dev_metisCy dev_fem dev_multilevelSolver dev_nl dev_package
28+
29+
dev_packageTools :
30+
@ echo "Entering directory \`packageTools/'"
31+
cd packageTools; $(PYTHON) -m pip install $(FLAGS) .
32+
dev_base_build :
33+
@ echo "Entering directory \`base'"
34+
cd base; $(PYTHON) -m pip install $(FLAGS) .
35+
dev_base :
36+
make dev_base_build
37+
$(PYTHON) -c "import PyNucleus_base" || (make clean_base && make dev_base_build)
38+
dev_metisCy_build :
39+
@ echo "Entering directory \`metisCy'"
40+
cd metisCy; $(PYTHON) -m pip install $(FLAGS) .
41+
dev_metisCy :
42+
make dev_metisCy_build
43+
$(PYTHON) -c "import PyNucleus_metisCy" || (make clean_metisCy && make dev_metisCy_build)
44+
dev_fem_build :
45+
@ echo "Entering directory \`fem'"
46+
cd fem; $(PYTHON) -m pip install $(FLAGS) .
47+
dev_fem :
48+
make dev_fem_build
49+
$(PYTHON) -c "import PyNucleus_fem" || (make clean_fem && make dev_fem_build)
50+
dev_multilevelSolver_build :
51+
@ echo "Entering directory \`multilevelSolver'"
52+
cd multilevelSolver; $(PYTHON) -m pip install $(FLAGS) .
53+
dev_multilevelSolver :
54+
make dev_multilevelSolver_build
55+
$(PYTHON) -c "import PyNucleus_multilevelSolver" || (make clean_multilevelSolver && make dev_multilevelSolver_build)
56+
dev_nl_build :
57+
@ echo "Entering directory \`nl'"
58+
cd nl; $(PYTHON) -m pip install $(FLAGS) .
59+
dev_nl :
60+
make dev_nl_build
61+
$(PYTHON) -c "import PyNucleus_nl" || (make clean_nl && make dev_nl_build)
62+
dev_package :
63+
$(PYTHON) -m pip install $(FLAGS) .
64+
65+
66+
67+
clean_dev: clean_package clean_packageTools clean_base clean_metisCy clean_fem clean_multilevelSolver clean_nl
68+
clean_packageTools :
69+
$(PYTHON) -m pip uninstall PyNucleus_packageTools -y
70+
clean_base :
71+
$(PYTHON) -m pip uninstall PyNucleus_base -y
72+
cd base/PyNucleus_base && \
73+
rm -f *.so *.c *.pyc && \
74+
rm -rf __pycache__
75+
cd base && rm -rf build __pycache__ *.egg-info
76+
clean_metisCy :
77+
$(PYTHON) -m pip uninstall PyNucleus_metisCy -y
78+
cd metisCy/PyNucleus_metisCy && \
79+
rm -f *.so *.c *.pyc && \
80+
rm -rf __pycache__
81+
cd metisCy && rm -rf build __pycache__ *.egg-info
82+
clean_fem :
83+
$(PYTHON) -m pip uninstall PyNucleus_fem -y
84+
cd fem/PyNucleus_fem && \
85+
rm -f *.so *.c *.pyc && \
86+
rm -rf __pycache__
87+
cd fem && rm -rf build __pycache__ *.egg-info
88+
clean_multilevelSolver :
89+
$(PYTHON) -m pip uninstall PyNucleus_multilevelSolver -y
90+
cd multilevelSolver/PyNucleus_multilevelSolver && \
91+
rm -f *.so *.c *.pyc && \
92+
rm -rf __pycache__
93+
cd multilevelSolver && rm -rf build __pycache__ *.egg-info
94+
clean_nl :
95+
$(PYTHON) -m pip uninstall PyNucleus_nl -y
96+
cd nl/PyNucleus_nl && \
97+
rm -rf *.so *.c *.pyc *.html __pycache__ kernelsCy.cpp adaptiveQuad.cpp
98+
cd nl && rm -rf build __pycache__ *.egg-info
99+
clean_package :
100+
$(PYTHON) -m pip uninstall PyNucleus -y
101+
102+
.PHONY: docs
103+
docs :
104+
cd docs && make
105+
sphinx-build -b html docs docs/build
106+
107+
clean_docs :
108+
cd docs; rm -rf build
109+
110+
createVirtualEnv:
111+
$(PYTHON) -m virtualenv --python=$(PYTHON) venv --system-site-packages
112+
113+
114+
list-tests:
115+
$(PYTHON) -m pytest --collect-only tests/ tests/test.py
116+
117+
.PHONY: tests
118+
tests:
119+
$(PYTHON) -m pytest -rA --html=$(TEST_RESULTS) --self-contained-html tests/ tests/test.py
120+
121+
docker:
122+
./build-docker.sh
123+
124+
docker-linux:
125+
./run-docker-linux.sh
126+
127+
docker-mac:
128+
./run-docker-mac.sh
129+
130+
131+
prereq:
132+
$(PYTHON) -m pip install $(PIP_FLAGS) Cython cython numpy scipy matplotlib pyyaml h5py pybind11 MeshPy tabulate modepy mpi4py scikit-sparse pyamg
133+
134+
prereq-extra:
135+
$(PYTHON) -m pip install $(PIP_FLAGS) pytest pytest-html pytest-xdist Sphinx sphinxcontrib-programoutput

PyNucleus/__init__.py

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
###################################################################################
2+
# Copyright 2021 National Technology & Engineering Solutions of Sandia, #
3+
# LLC (NTESS). Under the terms of Contract DE-NA0003525 with NTESS, the #
4+
# U.S. Government retains certain rights in this software. #
5+
# If you want to use this code, please refer to the README.rst and LICENSE files. #
6+
###################################################################################
7+
8+
9+
import importlib
10+
import pkgutil
11+
import sys
12+
13+
subpackages = {}
14+
for finder, name, ispkg in pkgutil.iter_modules():
15+
if ispkg and name.find('PyNucleus_') == 0:
16+
importName = name[len('PyNucleus_'):]
17+
module = importlib.import_module(name, 'PyNucleus')
18+
sys.modules['PyNucleus.'+importName] = module
19+
subpackages[importName] = module
20+
if "__all__" in module.__dict__:
21+
names = module.__dict__["__all__"]
22+
else:
23+
names = [name for name in module.__dict__ if not name.startswith('_')]
24+
locals().update({name: getattr(module, name) for name in names})
25+
26+
from . import _version
27+
__version__ = _version.get_versions()['version']

0 commit comments

Comments
 (0)