| 1 |
From: |
| 2 |
Subject: Debian changes |
| 3 |
|
| 4 |
The Debian packaging of numpy-rms is maintained in git, using a workflow |
| 5 |
similar to the one described in dgit-maint-merge(7). |
| 6 |
The Debian delta is represented by this one combined patch; there isn't a |
| 7 |
patch queue that can be represented as a quilt series. |
| 8 |
|
| 9 |
A detailed breakdown of the changes is available from their canonical |
| 10 |
representation -- git commits in the packaging repository. |
| 11 |
For example, to see the changes made by the Debian maintainer in the first |
| 12 |
upload of upstream version 1.2.3, you could use: |
| 13 |
|
| 14 |
% git clone https://git.dgit.debian.org/numpy-rms |
| 15 |
% cd numpy-rms |
| 16 |
% git log --oneline 1.2.3..debian/1.2.3-1 -- . ':!debian' |
| 17 |
|
| 18 |
(If you have dgit, use `dgit clone numpy-rms`, rather than plain `git clone`.) |
| 19 |
|
| 20 |
We don't use debian/source/options single-debian-patch because it has bugs. |
| 21 |
Therefore, NMUs etc. may nevertheless have made additional patches. |
| 22 |
|
| 23 |
--- |
| 24 |
|
| 25 |
diff --git a/numpy_rms/_rms.c b/numpy_rms/_rms.c |
| 26 |
index 0e2046a..98fd17f 100644 |
| 27 |
--- a/numpy_rms/_rms.c |
| 28 |
+++ b/numpy_rms/_rms.c |
| 29 |
@@ -9,7 +9,7 @@ void rms_scalar(const float *a, int window_size, float *rms_output, size_t outpu |
| 30 |
void rms(const float *a, int window_size, float *rms_output, size_t output_length) { |
| 31 |
#if defined(__x86_64__) || defined(_M_X64) |
| 32 |
rms_avx2(a, window_size, rms_output, output_length); |
| 33 |
- #elif defined(__arm__) || defined(__aarch64__) |
| 34 |
+ #elif defined(__aarch64__) || defined(__ARM_NEON) || defined(__ARM_NEON__) |
| 35 |
rms_neon(a, window_size, rms_output, output_length); |
| 36 |
#else |
| 37 |
rms_scalar(a, window_size, rms_output, output_length); |
| 38 |
@@ -65,7 +65,7 @@ void rms_avx2(const float *a, int window_size, float *rms_output, size_t output_ |
| 39 |
} |
| 40 |
|
| 41 |
// NEON implementation |
| 42 |
-#elif defined(__arm__) || defined(__aarch64__) |
| 43 |
+#elif defined(__aarch64__) || defined(__ARM_NEON) || defined(__ARM_NEON__) |
| 44 |
#include <arm_neon.h> |
| 45 |
|
| 46 |
// NB! The length of a must be >= output_length * window_size |
| 47 |
diff --git a/tests/test_rms.py b/tests/test_rms.py |
| 48 |
index 2ca5b72..bec0f77 100644 |
| 49 |
--- a/tests/test_rms.py |
| 50 |
+++ b/tests/test_rms.py |
| 51 |
@@ -1,11 +1,15 @@ |
| 52 |
import numpy as np |
| 53 |
import pytest |
| 54 |
-from numpy.testing import assert_array_almost_equal |
| 55 |
+from numpy.testing import assert_allclose |
| 56 |
|
| 57 |
import numpy_rms |
| 58 |
from numpy_rms.fallback import rms_numpy |
| 59 |
|
| 60 |
|
| 61 |
+def assert_rms_close(actual, desired): |
| 62 |
+ assert_allclose(actual, desired, rtol=1e-6, atol=1e-6) |
| 63 |
+ |
| 64 |
+ |
| 65 |
def test_rms_large_array(benchmark): |
| 66 |
arr = np.arange(100_000_000, dtype=np.float32) |
| 67 |
rms = benchmark(numpy_rms.rms, arr, window_size=5000) |
| 68 |
@@ -21,7 +25,7 @@ def test_rms_2d_mono(): |
| 69 |
assert rms.shape == (1, 10) |
| 70 |
assert rms_numpy_fallback.shape == (1, 10) |
| 71 |
assert rms[0, 0] == 1.0 |
| 72 |
- assert_array_almost_equal(rms, rms_numpy_fallback) |
| 73 |
+ assert_rms_close(rms, rms_numpy_fallback) |
| 74 |
|
| 75 |
|
| 76 |
def test_rms_2d_stereo(): |
| 77 |
@@ -33,7 +37,7 @@ def test_rms_2d_stereo(): |
| 78 |
assert rms_numpy_fallback.shape == (2, 10) |
| 79 |
assert rms[0, 0] == 1.0 |
| 80 |
assert rms[1, 1] == 2.0 |
| 81 |
- assert_array_almost_equal(rms, rms_numpy_fallback) |
| 82 |
+ assert_rms_close(rms, rms_numpy_fallback) |
| 83 |
|
| 84 |
|
| 85 |
def test_rms_numpy_fallback_large_array(benchmark): |
| 86 |
@@ -49,7 +53,7 @@ def test_not_divisible_by_window_size(): |
| 87 |
rms = numpy_rms.rms(arr, window_size=16) |
| 88 |
rms_numpy_fallback = rms_numpy(arr, window_size=16) |
| 89 |
assert rms.shape == rms_numpy_fallback.shape |
| 90 |
- assert_array_almost_equal(rms, rms_numpy_fallback) |
| 91 |
+ assert_rms_close(rms, rms_numpy_fallback) |
| 92 |
|
| 93 |
|
| 94 |
def test_rms_window_size_not_divisible_by_8(): |
| 95 |
@@ -57,7 +61,7 @@ def test_rms_window_size_not_divisible_by_8(): |
| 96 |
rms = numpy_rms.rms(arr, window_size=13) |
| 97 |
rms_numpy_fallback = rms_numpy(arr, window_size=13) |
| 98 |
assert rms.shape == rms_numpy_fallback.shape |
| 99 |
- assert_array_almost_equal(rms, rms_numpy_fallback) |
| 100 |
+ assert_rms_close(rms, rms_numpy_fallback) |
| 101 |
|
| 102 |
|
| 103 |
def test_rms_window_size_smaller_than_8(): |
| 104 |
@@ -65,7 +69,7 @@ def test_rms_window_size_smaller_than_8(): |
| 105 |
rms = numpy_rms.rms(arr, window_size=4) |
| 106 |
rms_numpy_fallback = rms_numpy(arr, window_size=4) |
| 107 |
assert rms.shape == rms_numpy_fallback.shape |
| 108 |
- assert_array_almost_equal(rms, rms_numpy_fallback) |
| 109 |
+ assert_rms_close(rms, rms_numpy_fallback) |
| 110 |
|
| 111 |
|
| 112 |
def test_rms_window_size_none(): |