CODARcode / MGARD

MGARD: MultiGrid Adaptive Reduction of Data
Apache License 2.0
37 stars 25 forks source link

Allow zero length huffman codes #154

Closed kmorel closed 3 years ago

kmorel commented 3 years ago

The previous versions of huffman_encoding and huffman_decoding assumed that the length of every code is greater than 0. If it was not, then either function would crash (primarily from a failed assert).

Zero length huffman codes do happen when there is only 1 code. (If there is only 1 code, then that code contains no information and thus uses 0 bits.) This can when the buffer contains all the same value (for example, calling it with an array of all zeros). It can also happen when the buffer contains only values outside the range of encodable values (which I've seen in small test arrays with a sufficiently small quantum).

Are either of these cases practical? Not really. But they can happen, and the MGARD library shouldn't crash in those cases.

qliu21 commented 3 years ago

@ben-e-whitney the fPIC related issue still persists. Maybe you can look into this?

ben-e-whitney commented 3 years ago

I believe that the cached version of MOAB, compiled without -fPIC, is still being used. The workflows last ran six days ago. If no one activates them for another day or two, the cache should be cleared. If that doesn't happen, or if people keep on pushing changes, I will figure out how to clear the cache manually.