Skip to content

Commit

Permalink
Merge branch 'master' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
kiyo-masui committed Nov 8, 2017
2 parents 52df571 + e5e2bfe commit 9aaa318
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 16 deletions.
6 changes: 2 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: python
os: linux
# To test filter plugins, need hdf5 1.8.11+, present in Trusty but not Precise.
#dist: trusty
dist: trusty
# Required to get Trusty.
#sudo: true
python:
Expand All @@ -18,9 +18,7 @@ install:
- "pip install -U pip virtualenv"
# Ensures the system hdf5 headers/libs will be used whatever its version
- "export HDF5_DIR=/usr/lib"
# Force Cython to be istalled before h5py.
- "pip install Cython>=0.19"
- "pip install --no-binary=h5py -r requirements.txt"
- "pip install -r requirements.txt"
# Installing the plugin to arbitrary directory to check the install script.
- "python setup.py install --h5plugin --h5plugin-dir ~/hdf5/lib"
# Ensure it's installable and usable in virtualenv
Expand Down
20 changes: 15 additions & 5 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,12 @@ As a bonus, Bitshuffle ships with a dynamically loaded version of
`h5py`'s LZF compression filter, such that the filter can be transparently
used outside of python and in command line utilities such as ``h5dump``.

.. [1] Chosen to fit comfortably within L1 cache as well as be well matched window of the LZF compression library.
.. [1] Chosen to fit comfortably within L1 cache as well as be well matched
window of the LZF compression library.
.. [2] Over applying bitshuffle to the full dataset then applying LZ4 compression, this has the tremendous advantage that the block is already in the L1 cache.
.. [2] Over applying bitshuffle to the full dataset then applying LZ4
compression, this has the tremendous advantage that the block is
already in the L1 cache.
.. _`dynamically loaded filters`: http://www.hdfgroup.org/HDF5/doc/Advanced/DynamicallyLoadedFilters/HDF5DynamicallyLoadedFilters.pdf

Expand Down Expand Up @@ -92,9 +95,11 @@ Comparing Bitshuffle to other compression algorithms and HDF5 filters:
Installation for Python
-----------------------

Installation requires python 2.7+ or 3.3+, HDF5 1.8 or later, HDF5 for python,
Numpy and Cython. To use the dynamically loaded HDF5 filter requires HDF5
1.8.11 or later.
Installation requires python 2.7+ or 3.3+, HDF5 1.8.4 or later, HDF5 for python
(h5py), Numpy and Cython. Bitshuffle must be linked against the same version of
HDF5 as h5py, which in practice means h5py must be built from source_ rather
than pre-built wheels [3]_. To use the dynamically loaded HDF5 filter requires
HDF5 1.8.11 or later.

To install::

Expand All @@ -113,6 +118,11 @@ If you get an error about missing source files when building the extensions,
try upgrading setuptools. There is a weird bug where setuptools prior to 0.7
doesn't work properly with Cython in some cases.

.. _source: http://docs.h5py.org/en/latest/build.html#source-installation

.. [3] Typically you will be able to install Bitshuffle, but there will be
errors when creating and reading datasets.
Usage from Python
-----------------
Expand Down
2 changes: 1 addition & 1 deletion bitshuffle/h5.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def create_dataset(parent, name, shape, dtype, chunks=None, maxshape=None,

tmp_shape = maxshape if maxshape is not None else shape
# Validate chunk shape
chunks_larger = (-numpy.array([ i>=j
chunks_larger = (numpy.array([ not i>=j
for i,j in zip(tmp_shape,chunks) if i is not None])).any()
if isinstance(chunks, tuple) and chunks_larger:
errmsg = ("Chunk shape must not be greater than data shape in any "
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# order matter
# Order matters
setuptools>=0.7
Cython>=0.19
numpy>=1.6.1
h5py>=2.4.0
h5py>=2.4.0 --no-binary=h5py
12 changes: 8 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
# I didn't import unicode_literals. They break setuptools or Cython in python
# 2.7, but python 3 seems to be happy with them.

from distutils import ccompiler
from distutils import spawn
import glob
import os
from os import path
Expand Down Expand Up @@ -247,17 +245,21 @@ def finalize_options(self):
print("\n#################################")
print("# Compiling with OpenMP support #")
print("#################################\n")
self.libraries += ['gomp']
# More portable to pass -fopenmp to linker.
# self.libraries += ['gomp']
for e in self.extensions:
if '-fopenmp' not in e.extra_compile_args:
e.extra_compile_args += ['-fopenmp']
if '-fopenmp' not in e.extra_link_args:
e.extra_link_args += ['-fopenmp']

# Required only by old version of setuptools < 18.0
from Cython.Build import cythonize
self.extensions = cythonize(self.extensions)
for ext in self.extensions:
ext._needs_stub = False


# Don't install numpy/cython/hdf5 if not needed
for cmd in ["sdist", "clean",
"--help", "--help-commands", "--version"]:
Expand All @@ -269,6 +271,7 @@ def finalize_options(self):

with open('requirements.txt') as f:
requires = f.read().splitlines()
requires = [r.split()[0] for r in requires]

# TODO hdf5 support should be an "extra". Figure out how to set this up.
setup(
Expand All @@ -290,6 +293,7 @@ def finalize_options(self):
description="Bitshuffle filter for improving typed data compression.",
license="MIT",
url="https://github.com/kiyo-masui/bitshuffle",
download_url="https://github.com/kiyo-masui/bitshuffle/tarball/%s" % VERSION,
download_url=("https://github.com/kiyo-masui/bitshuffle/tarball/%s"
% VERSION),
keywords=['compression', 'hdf5', 'numpy'],
)

0 comments on commit 9aaa318

Please sign in to comment.