Closed kiyo-masui closed 7 years ago
Nose:
$ nosetests-3.5 tests/
....F..............F.......F........F.........F..F..........F
======================================================================
FAIL: test_trans_bit_elem_scal (bitshuffle.tests.test_ext.TestOddLengths)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_ext.py", line 486, in tearDown
self.assertTrue(np.all(out == ans))
AssertionError: False is not true
======================================================================
FAIL: test_03a_trans_bit_byte (bitshuffle.tests.test_ext.TestProfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_ext.py", line 70, in tearDown
self.assertTrue(np.all(ans == out.view(np.uint8)))
AssertionError: False is not true
======================================================================
FAIL: test_04e_trans_bit_elem_64 (bitshuffle.tests.test_ext.TestProfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_ext.py", line 70, in tearDown
self.assertTrue(np.all(ans == out.view(np.uint8)))
AssertionError: False is not true
======================================================================
FAIL: test_06g_untrans_bit_elem_64 (bitshuffle.tests.test_ext.TestProfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_ext.py", line 73, in tearDown
self.assertTrue(np.all(ans == out.view(np.uint8)))
AssertionError: False is not true
======================================================================
FAIL: test_09a_trans_bit_elem_scal_64 (bitshuffle.tests.test_ext.TestProfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_ext.py", line 70, in tearDown
self.assertTrue(np.all(ans == out.view(np.uint8)))
AssertionError: False is not true
======================================================================
FAIL: test_09d_untrans_bit_elem_scal_64 (bitshuffle.tests.test_ext.TestProfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_ext.py", line 73, in tearDown
self.assertTrue(np.all(ans == out.view(np.uint8)))
AssertionError: False is not true
======================================================================
FAIL: test_regression (bitshuffle.tests.test_regression.TestAll)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_regression.py", line 36, in test_regression
== g_orig[dset_name][:]))
AssertionError: False is not true
----------------------------------------------------------------------
Ran 61 tests in 2.139s
FAILED (failures=7)
[fedora@puiterwijk---zbyszek-ppc bitshuffle]$ PYTHONPATH=. nosetests-3.5 tests/
....F..............F.......F........F.........F..F..........F
======================================================================
FAIL: test_trans_bit_elem_scal (bitshuffle.tests.test_ext.TestOddLengths)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_ext.py", line 486, in tearDown
self.assertTrue(np.all(out == ans))
AssertionError: False is not true
======================================================================
FAIL: test_03a_trans_bit_byte (bitshuffle.tests.test_ext.TestProfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_ext.py", line 70, in tearDown
self.assertTrue(np.all(ans == out.view(np.uint8)))
AssertionError: False is not true
======================================================================
FAIL: test_04e_trans_bit_elem_64 (bitshuffle.tests.test_ext.TestProfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_ext.py", line 70, in tearDown
self.assertTrue(np.all(ans == out.view(np.uint8)))
AssertionError: False is not true
======================================================================
FAIL: test_06g_untrans_bit_elem_64 (bitshuffle.tests.test_ext.TestProfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_ext.py", line 73, in tearDown
self.assertTrue(np.all(ans == out.view(np.uint8)))
AssertionError: False is not true
======================================================================
FAIL: test_09a_trans_bit_elem_scal_64 (bitshuffle.tests.test_ext.TestProfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_ext.py", line 70, in tearDown
self.assertTrue(np.all(ans == out.view(np.uint8)))
AssertionError: False is not true
======================================================================
FAIL: test_09d_untrans_bit_elem_scal_64 (bitshuffle.tests.test_ext.TestProfile)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_ext.py", line 73, in tearDown
self.assertTrue(np.all(ans == out.view(np.uint8)))
AssertionError: False is not true
======================================================================
FAIL: test_regression (bitshuffle.tests.test_regression.TestAll)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/fedora/bitshuffle/build/lib.linux-ppc64-3.5/bitshuffle/tests/test_regression.py", line 36, in test_regression
== g_orig[dset_name][:]))
AssertionError: False is not true
----------------------------------------------------------------------
Ran 61 tests in 1.705s
FAILED (failures=7)
Okay, I'll need to think about it a bit more. I'm clearly missing something.
I suppose I should reference Blosc/c-blosc#181 here.
Hi, any update? We got an issue in BE ( AIX and s390x) platforms.
@kiyo-masui Actually this issue has been a blocker for releasing a new version of snappy-java, which includes bitshuffle APIs for Java. I appreciate your help.
Sorry for my slow reply, especially since it is blocking your release.
I haven't had time to work on this unfortunately. The status is as follows: there is a working patch in Blosc/c-blosc#181 but it is inadequate since you need to supply the endianness to the compiler by hand, and it adds a lot of extra computation for big-endian machines. This PR includes code that I think should work, but doesn't.
What needs to happen is for someone to compare the two patches against each other and figure out the issue with the code in this PR. I'm not sure when I'd be able to get to this. Anyone want to take a crack at it?
Thanks for the explanation. I understand the current situation.
I am trying to reproduce the problem on s390x now.
The patch in Blosc/c-blosc#181 emulates little endian's behavior on big endian, while the code in this PR produces outputs different from little endian's, although the outputs themselves are "correct" in that they are certain forms of transpose of the inputs and unshuffling restores the original inputs. I guess certain tests that assume little endian's bit-by-bit results can fail on big endian with the code in this PR.
What is the desired behavior? Is bitshuffle supposed to produce exactly the same shuffled results both on little endian and big endian? I think this is more desirable for data interchangeability across different-endian machines.
The desired behaviour is that of Blosc/c-blosc#181.
I think I might have just confused myself into thinking that what I wrote in this PR did the same thing. Reconsidering, I'm pretty sure I was wrong on this.
Okay, we need a portable way to do what was done in Blosc/c-blosc#181. Stack Overflow tells me I should detect endianness at runtime, not at compile time. That complicates making sure the solution is NOOP on little endian machines. Too keep branches out of the loops, I think we need 2 versions of the each of the functions that use TRANS_BIT_8X8
.
Also we need a portable and efficient version of bswap_64
. OSX and some other OS's don't seem to have byteswap.h.
Okay, I think this works.
It now swaps the bytes on BE machines. It uses the byte swap from byteswap.h on systems where that header is expected to be available, and otherwise uses a custom implementation. The custom implementation requires 15 instructions, compared to 18 instructions plus moving memory around for the rest of the algorithm. Bitshuffle will be about a factor of 2 slower on BE machines.
I did add a branch inside the loop, but, I've checked that the compiler (gcc 4.8) is able to optimize this away on my Mac. The assembly code it identical as before.
One thing that needs to happen is to expand and test the list of systems where byteswap.h should be present. Currently this is just #if defined (__linux__)
. I have no idea if this is always right (although seems to work on the Travis CI machines which are Ubuntu/Linaro).
Can someone test this on a BE machine?
Thanks much for the new patches, ... but can I work a little bit more on the BE version of TRANS_BIT_8X8
as we don't want to have additional overhead on BE?
Absolutely, that would be ideal!
I copy and pasted the code from http://www.hackersdelight.org/hdcodetxt/transpose8.c.txt. I was unable to dissect exactly how it works although it seems like it should be a fun problem.
At last now we know we don't have to worry about if (big_endian)
statements in the loop, as long as we keep it simple.
This is superseded by PR #58 .
Still fails.
py.test gives slightly nicer output. For example: