-
Notifications
You must be signed in to change notification settings - Fork 862
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optionally use crc32c library (#429)
* Optionally use crc32c library - If crc32c library with native implementation is not presented, use the current implementation. - If crc32c library is presented try to use SSE instructions or a software implementation in C ("auto" mode) - Don't add crc32c to the requirements list to make the dependency optional. * Fix bug with using native crc32c implementation - Use native crc32c without masking because it will be done by caller - Add tests - Add crc32c as a testing dependency * Rewrite tests for crc32c module
- Loading branch information
1 parent
3e35c9b
commit 67d0746
Showing
5 changed files
with
35 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,7 +51,8 @@ def run(self): | |
|
||
test_requirements = [ | ||
'pytest', | ||
'matplotlib' | ||
'matplotlib', | ||
'crc32c', | ||
] | ||
|
||
setup( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import unittest | ||
from tensorboardX.crc32c import _crc32c, _crc32c_native, crc32c | ||
|
||
|
||
class CRC32CTest(unittest.TestCase): | ||
def test_crc32c(self): | ||
data = b'abcd' | ||
assert crc32c(data) == 0x92c80a31 | ||
|
||
def test_crc32c_python(self): | ||
data = b'abcd' | ||
assert _crc32c(data) == 0x92c80a31 | ||
|
||
def test_crc32c_native(self): | ||
if _crc32c_native is None: | ||
return | ||
data = b'abcd' | ||
assert _crc32c_native(data) == 0x92c80a31 |