Skip to content

Commit

Permalink
Michelp/binarywheels (#82)
Browse files Browse the repository at this point in the history
* binary wheels.

* binary wheels.

* bump setup for wheels.

* bump setup for wheels.

* bump setup for wheels.

* cleanup manylinux

* bump

* pdoc gen
  • Loading branch information
michelp authored Jan 22, 2021
1 parent cd45926 commit c8b51cd
Show file tree
Hide file tree
Showing 10 changed files with 152 additions and 48 deletions.
15 changes: 15 additions & 0 deletions Dockerfile-manylinux
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
ARG BASE_CONTAINER=quay.io/pypa/manylinux2010_x86_64
FROM ${BASE_CONTAINER}

RUN yum install -y cmake make gcc git openmpi-devel llvm-devel

ARG SS_RELEASE=v4.0.3
ARG SS_COMPACT=0

WORKDIR /build
RUN git clone https://github.com/DrTimothyAldenDavis/GraphBLAS.git --depth 1 --branch $SS_RELEASE

WORKDIR /build/GraphBLAS/build
RUN cmake .. -DGBCOMPACT=${SS_COMPACT} && make -j8 && make install
RUN ldconfig
RUN /bin/rm -Rf /build
28 changes: 26 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,26 @@ library. Once you have these installed, pygraphblas can be installed
with:

python setup.py install

An installation script for Ubuntu 18.04 is provided in the `install-ubuntu.sh` file.

There are two ways to download precompiled binaries of pygraphblas
with SuiteSparse included. One way is to use `pip install
pygraphblas` on an Intel Linux machine. This will download a package
compatible with most modern linux distributions. This also works in a
Docker container on Mac.

There are also pre-build docker images based on Ubuntu 20.04 that have
a pre-compiled SuiteSparse and pygraphblas installed. These come in
two flavors `minimal` which is the Ipython interpreter-only, and
`notebook` which comes with a complete Jupyter Notebook server. These
containers also work on Mac.

An installation script for Ubuntu 18.04 is provided in the
`install-ubuntu.sh` file.

NOTE: DO NOT USE THESE PRE-COMPILED BINARIES FOR BENCHMARKING
SUITESPARSE. These binaries are not guaranteed to be idealy compiled
for your environment. You must build your own binaries on your own
platforms if you intend to do ANY valid benchmarking.

## Docker

Expand Down Expand Up @@ -151,3 +169,9 @@ referred to as "plus_times". This is the common operation of
multiplying two matrices containing real numbers, the corresponding row
and column entries are multipled and the results are summed for the
final value.

## Code of Conduct

Everyone interacting in the pygraphblas project's codebases, issue
trackers, chat rooms, and mailing lists is expected to follow the [PSF
Code of Conduct](https://www.python.org/psf/conduct/).
1 change: 0 additions & 1 deletion docs/pygraphblas/gviz.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ <h1 class="title">Module <code>pygraphblas.gviz</code></h1>
&#34;&#34;&#34;
from graphviz import Digraph, Source
from PIL import Image, ImageDraw
from IPython.display import display


__all__ = [
Expand Down
42 changes: 42 additions & 0 deletions docs/pygraphblas/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -817,6 +817,42 @@ <h2 class="section-title" id="header-classes">Types</h2>
<td>In-place Matrix Element-Wise Intersection</td>
<td>type default DIV combiner</td>
</tr>
<tr>
<td>A ==
B</td>
<td>Compare Element-Wise Union</td>
<td>type default EQ operator</td>
</tr>
<tr>
<td>A !=
B</td>
<td>Compare Element-Wise Union</td>
<td>type default NE operator</td>
</tr>
<tr>
<td>A &lt;
B</td>
<td>Compare Element-Wise Union</td>
<td>type default LT operator</td>
</tr>
<tr>
<td>A &gt;
B</td>
<td>Compare Element-Wise Union</td>
<td>type default GT operator</td>
</tr>
<tr>
<td>A &lt;=
B</td>
<td>Compare Element-Wise Union</td>
<td>type default LE operator</td>
</tr>
<tr>
<td>A &gt;=
B</td>
<td>Compare Element-Wise Union</td>
<td>type default GE operator</td>
</tr>
</tbody>
</table>
<p>Note that all the above operator syntax is mearly sugar over
Expand Down Expand Up @@ -856,6 +892,12 @@ <h2 class="section-title" id="header-classes">Types</h2>
A *= B | In-place Matrix Element-Wise Intersection | type default TIMES combiner
A / B | Matrix Element-Wise Intersection | type default DIV combiner
A /= B | In-place Matrix Element-Wise Intersection | type default DIV combiner
A == B | Compare Element-Wise Union | type default EQ operator
A != B | Compare Element-Wise Union | type default NE operator
A &lt; B | Compare Element-Wise Union | type default LT operator
A &gt; B | Compare Element-Wise Union | type default GT operator
A &lt;= B | Compare Element-Wise Union | type default LE operator
A &gt;= B | Compare Element-Wise Union | type default GE operator

Note that all the above operator syntax is mearly sugar over
various combinations of calling `Matrix.mxm`, `Matrix.mxv`,
Expand Down
48 changes: 48 additions & 0 deletions docs/pygraphblas/matrix.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ <h1 class="title">Module <code>pygraphblas.matrix</code></h1>
A *= B | In-place Matrix Element-Wise Intersection | type default TIMES combiner
A / B | Matrix Element-Wise Intersection | type default DIV combiner
A /= B | In-place Matrix Element-Wise Intersection | type default DIV combiner
A == B | Compare Element-Wise Union | type default EQ operator
A != B | Compare Element-Wise Union | type default NE operator
A &lt; B | Compare Element-Wise Union | type default LT operator
A &gt; B | Compare Element-Wise Union | type default GT operator
A &lt;= B | Compare Element-Wise Union | type default LE operator
A &gt;= B | Compare Element-Wise Union | type default GE operator

Note that all the above operator syntax is mearly sugar over
various combinations of calling `Matrix.mxm`, `Matrix.mxv`,
Expand Down Expand Up @@ -2287,6 +2293,42 @@ <h2 class="section-title" id="header-classes">Types</h2>
<td>In-place Matrix Element-Wise Intersection</td>
<td>type default DIV combiner</td>
</tr>
<tr>
<td>A ==
B</td>
<td>Compare Element-Wise Union</td>
<td>type default EQ operator</td>
</tr>
<tr>
<td>A !=
B</td>
<td>Compare Element-Wise Union</td>
<td>type default NE operator</td>
</tr>
<tr>
<td>A &lt;
B</td>
<td>Compare Element-Wise Union</td>
<td>type default LT operator</td>
</tr>
<tr>
<td>A &gt;
B</td>
<td>Compare Element-Wise Union</td>
<td>type default GT operator</td>
</tr>
<tr>
<td>A &lt;=
B</td>
<td>Compare Element-Wise Union</td>
<td>type default LE operator</td>
</tr>
<tr>
<td>A &gt;=
B</td>
<td>Compare Element-Wise Union</td>
<td>type default GE operator</td>
</tr>
</tbody>
</table>
<p>Note that all the above operator syntax is mearly sugar over
Expand Down Expand Up @@ -2326,6 +2368,12 @@ <h2 class="section-title" id="header-classes">Types</h2>
A *= B | In-place Matrix Element-Wise Intersection | type default TIMES combiner
A / B | Matrix Element-Wise Intersection | type default DIV combiner
A /= B | In-place Matrix Element-Wise Intersection | type default DIV combiner
A == B | Compare Element-Wise Union | type default EQ operator
A != B | Compare Element-Wise Union | type default NE operator
A &lt; B | Compare Element-Wise Union | type default LT operator
A &gt; B | Compare Element-Wise Union | type default GT operator
A &lt;= B | Compare Element-Wise Union | type default LE operator
A &gt;= B | Compare Element-Wise Union | type default GE operator

Note that all the above operator syntax is mearly sugar over
various combinations of calling `Matrix.mxm`, `Matrix.mxv`,
Expand Down
9 changes: 9 additions & 0 deletions manylinux-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
cffi
numpy
scipy
numba
pytest
setuptools
contextvars
matplotlib
graphviz
1 change: 0 additions & 1 deletion pygraphblas/gviz.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"""
from graphviz import Digraph, Source
from PIL import Image, ImageDraw
from IPython.display import display


__all__ = [
Expand Down
6 changes: 6 additions & 0 deletions pygraphblas/matrix.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@ class Matrix:
A *= B | In-place Matrix Element-Wise Intersection | type default TIMES combiner
A / B | Matrix Element-Wise Intersection | type default DIV combiner
A /= B | In-place Matrix Element-Wise Intersection | type default DIV combiner
A == B | Compare Element-Wise Union | type default EQ operator
A != B | Compare Element-Wise Union | type default NE operator
A < B | Compare Element-Wise Union | type default LT operator
A > B | Compare Element-Wise Union | type default GT operator
A <= B | Compare Element-Wise Union | type default LE operator
A >= B | Compare Element-Wise Union | type default GE operator
Note that all the above operator syntax is mearly sugar over
various combinations of calling `Matrix.mxm`, `Matrix.mxv`,
Expand Down
47 changes: 4 additions & 43 deletions setup-local.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,49 +1,10 @@
#!/bin/bash

# this script is to setup a locally installed copy of SuiteSparse and
# pygraphblas into a local venv style virtual environment.

# you will need
# apt-get update && apt-get install -yq cmake make wget libpython3-dev python3-pip libreadline-dev llvm-10-dev git python3-virtualenv

SS_RELEASE=v4.0.0draft5
SS_BURBLE=0
SS_COMPACT=1

mkdir -p local/build
cd local/build
git clone https://github.com/DrTimothyAldenDavis/GraphBLAS.git --depth 1 --branch ${SS_RELEASE}

cd GraphBLAS
cmake . -DGB_BURBLE=${SS_BURBLE} -DGBCOMPACT=${SS_COMPACT} && make -j8 && make DESTDIR=.. install

cd ..

python3 -m virtualenv --python=python3 venv

git clone https://github.com/Graphegon/pygraphblas.git --depth 1 --branch Graphegon/${SS_RELEASE}
git clone https://github.com/Graphegon/pygraphblas.git --depth 1 --branch main
cd pygraphblas

cat <<'EOF' >> libpatch.diff
diff --git a/pygraphblas/build.py b/pygraphblas/build.py
index 72b42e3..f448892 100644
--- a/pygraphblas/build.py
+++ b/pygraphblas/build.py
@@ -40,6 +40,8 @@ def build_ffi():
"_pygraphblas",
source,
libraries=["graphblas"],
+ include_dirs=['../usr/local/include'],
+ library_dirs=['../usr/local/lib'],
extra_compile_args=[
"-std=c11",
"-lm",
EOF

git apply libpatch.diff

virtualenv --python=python3 venv
python3 -m virtualenv --python=python3 venv
. venv/bin/activate

pip3 install -r minimal-requirements.txt
python3 setup.py install
RUN pip3 install -r minimal-requirements.txt
RUN python3 setup.py install
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
packages=['pygraphblas'],
setup_requires=["pytest-runner", "cffi>=1.0.0"],
cffi_modules=["pygraphblas/build.py:ffibuilder"],
install_requires=["cffi>=1.0.0", "numpy>=1.15", "numba", "scipy"],
install_requires=["cffi>=1.0.0", "numpy>=1.15", "numba", "scipy", "graphviz", "matplotlib", "contextvars"],
# tests_require=["pytest","pytest-cov"],
# entry_points = {
# 'rdf.plugins.store': [
# 'graphblas = pygraphblas.rdflib:GraphBLASStore',
# ],
# }
)

0 comments on commit c8b51cd

Please sign in to comment.