Skip to content

Commit 34fd5fb

Browse files
authored
Try alternative xxhash implementation (#148)
* Try alternative xxhash implementation Hopefully it can compile on non-x86 arch * Pin formatting CI python version To work around python/mypy#13627 * Revert adding pypy to builds * Add includes in makefile as well
1 parent 2df65d5 commit 34fd5fb

File tree

7 files changed

+10
-7
lines changed

7 files changed

+10
-7
lines changed

.github/workflows/ci.yml

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
with:
1919
submodules: recursive
2020
- uses: actions/setup-python@v3
21+
with:
22+
python-version: 3.10.6
2123
- uses: pre-commit/[email protected]
2224
with:
2325
extra_args: --hook-stage manual --all-files

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
url = https://github.com/imneme/pcg-cpp.git
1313
[submodule "xxhash"]
1414
path = xxhash
15-
url = https://github.com/RedSpah/xxhash_cpp.git
15+
url = https://github.com/Cyan4973/xxHash.git

CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ target_include_directories(correctionlib
4444
PRIVATE
4545
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/rapidjson/include>
4646
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/cpp-peglib>
47-
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/xxhash/include>
47+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/xxhash>
4848
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/pcg-cpp/include>
4949
)
5050
target_compile_features(correctionlib PUBLIC cxx_std_17)

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ else
1010
PYLDFLAG=-Wl,-rpath,'$$ORIGIN/lib'
1111
endif
1212
OSXFLAG=$(shell uname|grep -q Darwin && echo "-undefined dynamic_lookup")
13-
CFLAGS=--std=c++17 -O3 -Wall -fPIC -Irapidjson/include -Ipybind11/include -Icpp-peglib $(PYINC) -Iinclude
13+
CFLAGS=--std=c++17 -O3 -Wall -fPIC -Irapidjson/include -Ipybind11/include -Icpp-peglib -Ixxhash -Ipcg-cpp/include $(PYINC) -Iinclude
1414
PREFIX ?= correctionlib
1515
STRVER=$(shell git describe --tags)
1616
MAJOR=$(shell git describe --tags|sed -n "s/v\([0-9]\+\)\..*/\1/p")

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ build-backend = "setuptools.build_meta"
1414
write_to = "src/correctionlib/version.py"
1515

1616
[tool.cibuildwheel]
17-
skip = ["cp311-*"]
17+
skip = ["pp*-*", "cp311-*"]
1818
test-extras = "test"
1919
test-command = "python -m pytest {package}/tests"
2020
# update skip when numpy wheels become available

src/correction.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
#include <cmath>
88
#include <random>
99
#include "correction.h"
10-
#include "xxhash.hpp"
10+
#define XXH_INLINE_ALL 1
11+
#include "xxhash.h"
1112
#include "pcg_random.hpp"
1213
#if __has_include(<zlib.h>)
1314
#include <zlib.h>
@@ -288,7 +289,7 @@ double HashPRNG::evaluate(const std::vector<Variable::Type>& values) const {
288289
}
289290
else { throw std::logic_error("I should not have ever seen a string"); }
290291
}
291-
gen.seed(xxh::xxhash<64>((const void*) seedData, nbytes));
292+
gen.seed(XXH64((const void*) seedData, nbytes, 0ul));
292293
switch (dist_) {
293294
case Distribution::stdflat:
294295
return std::uniform_real_distribution<>()(gen);

xxhash

Submodule xxhash updated 81 files

0 commit comments

Comments
 (0)