counted-float 0.8.2__tar.gz → 0.8.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {counted_float-0.8.2 → counted_float-0.8.3}/PKG-INFO +15 -15
- {counted_float-0.8.2 → counted_float-0.8.3}/README.md +10 -10
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/__init__.py +2 -13
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/benchmarking/__init__.py +0 -2
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/benchmarking/_flops_benchmark_suite.py +9 -6
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/benchmarking/_flops_micro_benchmark.py +1 -6
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/benchmarking/_micro_benchmark.py +0 -3
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/benchmarking/_models.py +2 -2
- counted_float-0.8.3/counted_float/_core/compatibility/__init__.py +2 -0
- counted_float-0.8.3/counted_float/_core/compatibility/_numba.py +31 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/models/_flop_type.py +1 -1
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/models/_fpu_instruction.py +1 -1
- counted_float-0.8.3/counted_float/benchmarking/__init__.py +6 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/pyproject.toml +4 -10
- counted_float-0.8.2/counted_float/_core/_optional_deps.py +0 -49
- counted_float-0.8.2/counted_float/benchmarking/__init__.py +0 -14
- {counted_float-0.8.2 → counted_float-0.8.3}/.gitignore +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/LICENSE +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/__init__.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/benchmarking/_time_utils.py +0 -0
- /counted_float-0.8.2/counted_float/_core/_backwards_compat.py → /counted_float-0.8.3/counted_float/_core/compatibility/_strenum.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/__init__.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/_builtin_data.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/_context_managers.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/_counted_float.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/_global_counter.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/config/__init__.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/config/_config.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/config/_defaults.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/models/__init__.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/models/_base.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/models/_flop_counts.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/models/_flop_weights.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/models/_flops_benchmark_result.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/models/_fpu_specs.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/data/__init__.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/data/benchmarks/__init__.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/data/benchmarks/apple_m3_max.json +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/data/benchmarks/intel_i5_7200u.json +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/data/benchmarks/intel_i7_1265u.json +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/data/specs/__init__.py +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/data/specs/amd_zen4_r9_7900x.json +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/data/specs/intel_gen11_tiger_lake.json +0 -0
- {counted_float-0.8.2 → counted_float-0.8.3}/counted_float/config/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: counted-float
|
|
3
|
-
Version: 0.8.
|
|
3
|
+
Version: 0.8.3
|
|
4
4
|
Summary: Count floating-point operations in Python code & benchmark relative flop costs.
|
|
5
5
|
Project-URL: Source, https://github.com/bertpl/counted-float
|
|
6
6
|
Project-URL: Issues, https://github.com/bertpl/counted-float/issues
|
|
@@ -8,18 +8,18 @@ Project-URL: Roadmap, https://github.com/bertpl/counted-float/milestones
|
|
|
8
8
|
License-File: LICENSE
|
|
9
9
|
Requires-Python: >=3.10
|
|
10
10
|
Requires-Dist: backports-strenum>=1.3.1
|
|
11
|
+
Requires-Dist: numpy>=1.20
|
|
12
|
+
Requires-Dist: psutil>=5.0
|
|
11
13
|
Requires-Dist: pydantic>=2.0.0
|
|
12
|
-
Provides-Extra:
|
|
13
|
-
Requires-Dist: numba>=0.50; extra == '
|
|
14
|
-
Requires-Dist: numpy>=1.20; extra == 'benchmarking'
|
|
15
|
-
Requires-Dist: psutil>=5.0; extra == 'benchmarking'
|
|
14
|
+
Provides-Extra: numba
|
|
15
|
+
Requires-Dist: numba>=0.50; extra == 'numba'
|
|
16
16
|
Description-Content-Type: text/markdown
|
|
17
17
|
|
|
18
18
|
<!--START_SECTION:images-->
|
|
19
19
|

|
|
20
|
-

|
|
21
|
+

|
|
22
|
+

|
|
23
23
|
<!--END_SECTION:images-->
|
|
24
24
|
|
|
25
25
|
# counted-float
|
|
@@ -33,8 +33,8 @@ feasible or desirable.
|
|
|
33
33
|
|
|
34
34
|
The package contains two components:
|
|
35
35
|
- `counting`: provides a CountedFloat class & flop counting context managers to count flops of code blocks.
|
|
36
|
-
- `benchmarking`:
|
|
37
|
-
ballpark estimate of the relative cost of different operations on the target hardware.
|
|
36
|
+
- `benchmarking`: provides functionality to micro-benchmark floating point operations to get an empirical
|
|
37
|
+
ballpark estimate of the relative cost of different operations on the target hardware. Requires 'numba' optional dependency for accurate results.
|
|
38
38
|
|
|
39
39
|
# 1. Installation
|
|
40
40
|
|
|
@@ -43,11 +43,11 @@ The package contains two components:
|
|
|
43
43
|
Use you favorite package manager such as `uv` or `pip`:
|
|
44
44
|
|
|
45
45
|
```
|
|
46
|
-
pip install counted-float
|
|
47
|
-
pip install counted-float[
|
|
46
|
+
pip install counted-float # install without numba optional dependency
|
|
47
|
+
pip install counted-float[numba] # install with numba optional dependency
|
|
48
48
|
```
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
Numba is optional due to its relatively large size (40-50MB, including llvmlite), but without it, benchmarks will
|
|
50
|
+
not be reliable (but will still run, but not in jit-compiled form).
|
|
51
51
|
|
|
52
52
|
# 2. Counting Flops
|
|
53
53
|
|
|
@@ -243,7 +243,7 @@ The default weights that are configured in the package are the integer-rounded `
|
|
|
243
243
|
|
|
244
244
|
# 3. Benchmarking
|
|
245
245
|
|
|
246
|
-
If the package is installed with the optional `
|
|
246
|
+
If the package is installed with the optional `numba` dependency, it provides
|
|
247
247
|
the ability to micro-benchmark floating point operations as follows:
|
|
248
248
|
|
|
249
249
|
```
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<!--START_SECTION:images-->
|
|
2
2
|

|
|
3
|
-

|
|
4
|
+

|
|
5
|
+

|
|
6
6
|
<!--END_SECTION:images-->
|
|
7
7
|
|
|
8
8
|
# counted-float
|
|
@@ -16,8 +16,8 @@ feasible or desirable.
|
|
|
16
16
|
|
|
17
17
|
The package contains two components:
|
|
18
18
|
- `counting`: provides a CountedFloat class & flop counting context managers to count flops of code blocks.
|
|
19
|
-
- `benchmarking`:
|
|
20
|
-
ballpark estimate of the relative cost of different operations on the target hardware.
|
|
19
|
+
- `benchmarking`: provides functionality to micro-benchmark floating point operations to get an empirical
|
|
20
|
+
ballpark estimate of the relative cost of different operations on the target hardware. Requires 'numba' optional dependency for accurate results.
|
|
21
21
|
|
|
22
22
|
# 1. Installation
|
|
23
23
|
|
|
@@ -26,11 +26,11 @@ The package contains two components:
|
|
|
26
26
|
Use you favorite package manager such as `uv` or `pip`:
|
|
27
27
|
|
|
28
28
|
```
|
|
29
|
-
pip install counted-float
|
|
30
|
-
pip install counted-float[
|
|
29
|
+
pip install counted-float # install without numba optional dependency
|
|
30
|
+
pip install counted-float[numba] # install with numba optional dependency
|
|
31
31
|
```
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
Numba is optional due to its relatively large size (40-50MB, including llvmlite), but without it, benchmarks will
|
|
33
|
+
not be reliable (but will still run, but not in jit-compiled form).
|
|
34
34
|
|
|
35
35
|
# 2. Counting Flops
|
|
36
36
|
|
|
@@ -226,7 +226,7 @@ The default weights that are configured in the package are the integer-rounded `
|
|
|
226
226
|
|
|
227
227
|
# 3. Benchmarking
|
|
228
228
|
|
|
229
|
-
If the package is installed with the optional `
|
|
229
|
+
If the package is installed with the optional `numba` dependency, it provides
|
|
230
230
|
the ability to micro-benchmark floating point operations as follows:
|
|
231
231
|
|
|
232
232
|
```
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import counted_float.benchmarking as benchmarking
|
|
1
2
|
import counted_float.config as config
|
|
2
3
|
|
|
3
4
|
from ._core.counting import BuiltInData, CountedFloat, FlopCountingContext, PauseFlopCounting
|
|
@@ -12,6 +13,7 @@ from ._core.counting.models import (
|
|
|
12
13
|
)
|
|
13
14
|
|
|
14
15
|
__all__ = [
|
|
16
|
+
"benchmarking",
|
|
15
17
|
"config",
|
|
16
18
|
"CountedFloat",
|
|
17
19
|
"FlopCountingContext",
|
|
@@ -24,16 +26,3 @@ __all__ = [
|
|
|
24
26
|
"PauseFlopCounting",
|
|
25
27
|
"SystemInfo",
|
|
26
28
|
]
|
|
27
|
-
|
|
28
|
-
# -------------------------------------------------------------------------
|
|
29
|
-
# Optional [benchmarking] dependencies
|
|
30
|
-
# -------------------------------------------------------------------------
|
|
31
|
-
from ._core._optional_deps import FLAG_BENCHMARK_DEPS
|
|
32
|
-
|
|
33
|
-
if FLAG_BENCHMARK_DEPS:
|
|
34
|
-
import counted_float.benchmarking as benchmarking
|
|
35
|
-
|
|
36
|
-
__all__.append("benchmarking")
|
|
37
|
-
|
|
38
|
-
# delete variable again, we don't want to expose this
|
|
39
|
-
del FLAG_BENCHMARK_DEPS
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
from counted_float._core._optional_deps import requires_benchmark_deps
|
|
2
1
|
from counted_float._core.counting.models import FlopsBenchmarkResults
|
|
3
2
|
|
|
4
3
|
from ._flops_benchmark_suite import FlopsBenchmarkSuite
|
|
5
4
|
|
|
6
5
|
|
|
7
|
-
@requires_benchmark_deps
|
|
8
6
|
def run_flops_benchmark() -> FlopsBenchmarkResults:
|
|
9
7
|
"""Run the flops benchmark suite with default settings returns a FlopsBenchmarkResults object."""
|
|
10
8
|
return FlopsBenchmarkSuite().run()
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import platform
|
|
2
2
|
|
|
3
|
+
import numpy as np
|
|
3
4
|
import psutil
|
|
4
5
|
|
|
5
|
-
from counted_float._core.
|
|
6
|
+
from counted_float._core.compatibility import is_numba_installed, numba
|
|
6
7
|
from counted_float._core.counting.models import (
|
|
7
8
|
BenchmarkSettings,
|
|
8
9
|
FlopsBenchmarkDurations,
|
|
@@ -30,6 +31,13 @@ class FlopsBenchmarkSuite:
|
|
|
30
31
|
Run entire flops benchmarking suite and return the results as a FlopsBenchmarkResults object.
|
|
31
32
|
"""
|
|
32
33
|
|
|
34
|
+
# warn if needed
|
|
35
|
+
if not is_numba_installed():
|
|
36
|
+
print("========= WARNING =========")
|
|
37
|
+
print("'numba' was not found; results of this benchmark will be wildly inaccurate & unusable.")
|
|
38
|
+
print("Install this package with the numba optional dependency: 'pip install counted-float[numba]'")
|
|
39
|
+
print("========= WARNING =========")
|
|
40
|
+
|
|
33
41
|
# run actual benchmarks
|
|
34
42
|
benchmarks = self.get_flops_benchmarking_suite(size=array_size)
|
|
35
43
|
results_dict: dict[FlopType | None, Quantiles] = {
|
|
@@ -70,16 +78,11 @@ class FlopsBenchmarkSuite:
|
|
|
70
78
|
# Static methods
|
|
71
79
|
# -------------------------------------------------------------------------
|
|
72
80
|
@staticmethod
|
|
73
|
-
@requires_benchmark_deps
|
|
74
81
|
def get_flops_benchmarking_suite(size: int) -> dict[FlopType | None, FlopsMicroBenchmark]:
|
|
75
82
|
"""
|
|
76
83
|
Returns a benchmark for each FlopType + None (=baseline test), of requested array size.
|
|
77
84
|
"""
|
|
78
85
|
|
|
79
|
-
# --- late import of optional dependencies --------
|
|
80
|
-
import numba
|
|
81
|
-
import numpy as np
|
|
82
|
-
|
|
83
86
|
# --- define all test functions -------------------
|
|
84
87
|
@numba.njit(parallel=False)
|
|
85
88
|
def baseline(n: int, in_f1: np.ndarray, in_f2: np.ndarray, out_f: np.ndarray, out_i: np.ndarray):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import Callable
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import numpy as np
|
|
4
4
|
|
|
5
5
|
from ._micro_benchmark import MicroBenchmark
|
|
6
6
|
|
|
@@ -32,10 +32,7 @@ class FlopsMicroBenchmark(MicroBenchmark):
|
|
|
32
32
|
operations, so we can make representative estimates of the number of FLOPS executed by instrumented algorithms.
|
|
33
33
|
"""
|
|
34
34
|
|
|
35
|
-
@requires_benchmark_deps
|
|
36
35
|
def __init__(self, name: str, f: Callable, size: int):
|
|
37
|
-
import numpy as np # late import of optional dependency
|
|
38
|
-
|
|
39
36
|
super().__init__(name=name)
|
|
40
37
|
self.size = size
|
|
41
38
|
self.f = f
|
|
@@ -48,8 +45,6 @@ class FlopsMicroBenchmark(MicroBenchmark):
|
|
|
48
45
|
self.out_i: np.ndarray = np.zeros(size, dtype=int)
|
|
49
46
|
|
|
50
47
|
def _prepare_benchmark(self, n_operations: int):
|
|
51
|
-
import numpy as np # late import of optional dependency
|
|
52
|
-
|
|
53
48
|
self.n_operations = n_operations
|
|
54
49
|
# input arrays
|
|
55
50
|
self.in_f1 = 10 * np.random.rand(self.size)
|
{counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/benchmarking/_micro_benchmark.py
RENAMED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
from abc import ABC, abstractmethod
|
|
2
2
|
|
|
3
|
-
from counted_float._core._optional_deps import requires_benchmark_deps
|
|
4
|
-
|
|
5
3
|
from ._models import MicroBenchmarkResult, SingleRunResult
|
|
6
4
|
from ._time_utils import Timer, format_time_durations
|
|
7
5
|
|
|
@@ -25,7 +23,6 @@ class MicroBenchmark(ABC):
|
|
|
25
23
|
|
|
26
24
|
MAX_N_OPERATIONS_FACTOR = 10 # never adjust n_operations by more than this factor (up or down)
|
|
27
25
|
|
|
28
|
-
@requires_benchmark_deps
|
|
29
26
|
def __init__(self, name: str):
|
|
30
27
|
self.name = name
|
|
31
28
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
1
3
|
from counted_float._core.counting.models import MyBaseModel, Quantiles
|
|
2
4
|
|
|
3
5
|
|
|
@@ -19,8 +21,6 @@ class MicroBenchmarkResult(MyBaseModel):
|
|
|
19
21
|
|
|
20
22
|
def get_nsec_per_op_quantile(self, q: float) -> float:
|
|
21
23
|
"""Returns a specific quantile of all results in the 'benchmark_runs' category expressed as nsec/op."""
|
|
22
|
-
import numpy as np # late import of optional dependency
|
|
23
|
-
|
|
24
24
|
return float(np.quantile([el.nsecs_per_op() for el in self.benchmark_runs], q))
|
|
25
25
|
|
|
26
26
|
def summary_stats(self) -> Quantiles:
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
from collections.abc import Callable
|
|
2
|
+
|
|
3
|
+
try:
|
|
4
|
+
import numba
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
except ImportError:
|
|
8
|
+
# dummy decorator that will replace numba.jit and numba.njit
|
|
9
|
+
def dummy_decorator(*args, **kwargs):
|
|
10
|
+
# dummy decorator that does nothing and can be used with or without arguments
|
|
11
|
+
if len(args) == 1 and isinstance(args[0], Callable):
|
|
12
|
+
# decorator used without arguments
|
|
13
|
+
return args[0]
|
|
14
|
+
else:
|
|
15
|
+
# decorator used with arguments
|
|
16
|
+
def decorator(func):
|
|
17
|
+
return func
|
|
18
|
+
|
|
19
|
+
return decorator
|
|
20
|
+
|
|
21
|
+
# create a dummy numba object with numba.jit and numba.njit dummy decorators
|
|
22
|
+
class Numba:
|
|
23
|
+
__version__ = "0.0.0"
|
|
24
|
+
jit = dummy_decorator
|
|
25
|
+
njit = dummy_decorator
|
|
26
|
+
|
|
27
|
+
numba = Numba
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def is_numba_installed() -> bool:
|
|
31
|
+
return numba.__version__ != "0.0.0"
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "counted-float"
|
|
3
|
-
version = "0.8.
|
|
3
|
+
version = "0.8.3"
|
|
4
4
|
description = "Count floating-point operations in Python code & benchmark relative flop costs."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.10"
|
|
7
7
|
dependencies = [
|
|
8
8
|
"backports-strenum>=1.3.1",
|
|
9
9
|
"pydantic>=2.0.0",
|
|
10
|
+
"numpy>=1.20",
|
|
11
|
+
"psutil>=5.0",
|
|
10
12
|
]
|
|
11
13
|
|
|
12
14
|
[project.urls]
|
|
@@ -15,10 +17,8 @@ Issues = "https://github.com/bertpl/counted-float/issues"
|
|
|
15
17
|
Roadmap = "https://github.com/bertpl/counted-float/milestones"
|
|
16
18
|
|
|
17
19
|
[project.optional-dependencies]
|
|
18
|
-
|
|
20
|
+
numba = [
|
|
19
21
|
"numba>=0.50",
|
|
20
|
-
"numpy>=1.20",
|
|
21
|
-
"psutil>=5.0",
|
|
22
22
|
]
|
|
23
23
|
|
|
24
24
|
[build-system]
|
|
@@ -46,9 +46,3 @@ dev = [
|
|
|
46
46
|
"pytest>=8.0",
|
|
47
47
|
"pytest-cov>=6.0",
|
|
48
48
|
]
|
|
49
|
-
|
|
50
|
-
[tool.pytest.ini_options]
|
|
51
|
-
markers = [
|
|
52
|
-
"requires_benchmarking_deps: only run this test if benchmark options ARE installed",
|
|
53
|
-
"requires_no_benchmarking_deps: only run this test if benchmark options ARE NOT installed"
|
|
54
|
-
]
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
Module implementing boolean flags indicating whether optional dependencies are available & decorators to
|
|
3
|
-
safeguard execution of functions that require these dependencies.
|
|
4
|
-
"""
|
|
5
|
-
|
|
6
|
-
import functools
|
|
7
|
-
from typing import Callable
|
|
8
|
-
|
|
9
|
-
# -------------------------------------------------------------------------
|
|
10
|
-
# Flags
|
|
11
|
-
# -------------------------------------------------------------------------
|
|
12
|
-
try:
|
|
13
|
-
import numba
|
|
14
|
-
import numpy
|
|
15
|
-
import psutil
|
|
16
|
-
|
|
17
|
-
FLAG_BENCHMARK_DEPS = True
|
|
18
|
-
except ImportError:
|
|
19
|
-
FLAG_BENCHMARK_DEPS = False
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
# -------------------------------------------------------------------------
|
|
23
|
-
# Decorators
|
|
24
|
-
# -------------------------------------------------------------------------
|
|
25
|
-
def requires_benchmark_deps(fun: Callable) -> Callable:
|
|
26
|
-
"""
|
|
27
|
-
Decorator to mark a function that requires some deps to be installed.
|
|
28
|
-
|
|
29
|
-
USAGE:
|
|
30
|
-
|
|
31
|
-
@requires_benchmark_deps
|
|
32
|
-
def fun_that_needs_numba_or_numpy_or_psutil():
|
|
33
|
-
pass
|
|
34
|
-
|
|
35
|
-
This will ensure that the function - when it is called for the first time - will check if the required
|
|
36
|
-
dependencies are available. If not, an ImportError will be raised with an informative message.
|
|
37
|
-
"""
|
|
38
|
-
|
|
39
|
-
@functools.wraps(fun)
|
|
40
|
-
def wrapped_fun(*args, **kwargs):
|
|
41
|
-
if not FLAG_BENCHMARK_DEPS:
|
|
42
|
-
raise ImportError(
|
|
43
|
-
"This function requires counted_float to be installed with benchmark optional dependencies. "
|
|
44
|
-
+ "Please install this package as counted_float[benchmark]."
|
|
45
|
-
)
|
|
46
|
-
else:
|
|
47
|
-
return fun(*args, **kwargs)
|
|
48
|
-
|
|
49
|
-
return wrapped_fun
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
from counted_float._core._optional_deps import FLAG_BENCHMARK_DEPS
|
|
2
|
-
|
|
3
|
-
__all__ = []
|
|
4
|
-
|
|
5
|
-
if FLAG_BENCHMARK_DEPS:
|
|
6
|
-
from counted_float._core.benchmarking import FlopsBenchmarkResults, run_flops_benchmark
|
|
7
|
-
|
|
8
|
-
__all__ = [
|
|
9
|
-
"FlopsBenchmarkResults",
|
|
10
|
-
"run_flops_benchmark",
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
# delete variable again, we don't want to expose this
|
|
14
|
-
del FLAG_BENCHMARK_DEPS
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/_context_managers.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/config/_defaults.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/models/_flop_counts.py
RENAMED
|
File without changes
|
{counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/models/_flop_weights.py
RENAMED
|
File without changes
|
|
File without changes
|
{counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/counting/models/_fpu_specs.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/data/benchmarks/apple_m3_max.json
RENAMED
|
File without changes
|
{counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/data/benchmarks/intel_i5_7200u.json
RENAMED
|
File without changes
|
{counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/data/benchmarks/intel_i7_1265u.json
RENAMED
|
File without changes
|
|
File without changes
|
{counted_float-0.8.2 → counted_float-0.8.3}/counted_float/_core/data/specs/amd_zen4_r9_7900x.json
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|