mapFolding 0.11.2__py3-none-any.whl → 0.11.4__py3-none-any.whl
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.
- mapFolding/__init__.py +0 -13
- mapFolding/basecamp.py +2 -3
- mapFolding/beDRY.py +2 -145
- mapFolding/datatypes.py +0 -3
- mapFolding/oeis.py +0 -3
- mapFolding/someAssemblyRequired/RecipeJob.py +14 -121
- mapFolding/someAssemblyRequired/{Z0Z_makeSomeModules.py → Z0Z_makeAllModules.py} +109 -114
- mapFolding/someAssemblyRequired/__init__.py +4 -30
- mapFolding/someAssemblyRequired/_toolIfThis.py +7 -8
- mapFolding/someAssemblyRequired/_toolkitContainers.py +9 -129
- mapFolding/someAssemblyRequired/infoBooth.py +20 -0
- mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py +17 -18
- mapFolding/someAssemblyRequired/toolkitNumba.py +4 -46
- mapFolding/someAssemblyRequired/transformationTools.py +11 -181
- mapFolding/theSSOT.py +9 -4
- {mapfolding-0.11.2.dist-info → mapfolding-0.11.4.dist-info}/METADATA +1 -4
- {mapfolding-0.11.2.dist-info → mapfolding-0.11.4.dist-info}/RECORD +24 -27
- {mapfolding-0.11.2.dist-info → mapfolding-0.11.4.dist-info}/WHEEL +1 -1
- tests/conftest.py +2 -77
- tests/test_computations.py +11 -18
- tests/test_tasks.py +2 -1
- mapFolding/infoBooth.py +0 -96
- mapFolding/someAssemblyRequired/synthesizeNumbaJob.py +0 -315
- mapFolding/syntheticModules/numbaCount.py +0 -202
- mapFolding/theDao.py +0 -243
- {mapfolding-0.11.2.dist-info → mapfolding-0.11.4.dist-info}/entry_points.txt +0 -0
- {mapfolding-0.11.2.dist-info → mapfolding-0.11.4.dist-info}/licenses/LICENSE +0 -0
- {mapfolding-0.11.2.dist-info → mapfolding-0.11.4.dist-info}/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: mapFolding
|
|
3
|
-
Version: 0.11.
|
|
3
|
+
Version: 0.11.4
|
|
4
4
|
Summary: Map folding algorithm with code transformation framework for optimizing numerical computations
|
|
5
5
|
Author-email: Hunter Hogan <HunterHogan@pm.me>
|
|
6
6
|
License: CC-BY-NC-4.0
|
|
@@ -33,8 +33,6 @@ Description-Content-Type: text/markdown
|
|
|
33
33
|
License-File: LICENSE
|
|
34
34
|
Requires-Dist: astToolkit
|
|
35
35
|
Requires-Dist: autoflake
|
|
36
|
-
Requires-Dist: cytoolz
|
|
37
|
-
Requires-Dist: more_itertools
|
|
38
36
|
Requires-Dist: numba_progress
|
|
39
37
|
Requires-Dist: numba
|
|
40
38
|
Requires-Dist: numpy
|
|
@@ -42,7 +40,6 @@ Requires-Dist: platformdirs
|
|
|
42
40
|
Requires-Dist: python_minifier
|
|
43
41
|
Requires-Dist: sympy
|
|
44
42
|
Requires-Dist: tomli
|
|
45
|
-
Requires-Dist: typeshed_client
|
|
46
43
|
Requires-Dist: Z0Z_tools
|
|
47
44
|
Provides-Extra: testing
|
|
48
45
|
Requires-Dist: mypy; extra == "testing"
|
|
@@ -1,15 +1,13 @@
|
|
|
1
|
-
mapFolding/__init__.py,sha256=
|
|
2
|
-
mapFolding/basecamp.py,sha256=
|
|
3
|
-
mapFolding/beDRY.py,sha256=
|
|
1
|
+
mapFolding/__init__.py,sha256=5aecz_WZCLtBsArV68h30OEQxrylPPm0oVfQMt0N94A,1948
|
|
2
|
+
mapFolding/basecamp.py,sha256=3MMWSN8eW4W_dZe_q7Vs5yqmazNFoml0VpcJNY2feho,8243
|
|
3
|
+
mapFolding/beDRY.py,sha256=kQrgBhJkXEy-J-Zyu4RHILK6gRm72a7cON7a1LewgwI,14004
|
|
4
4
|
mapFolding/daoOfMapFolding.py,sha256=ncTIiBfTsM8SNVx9qefZ0bBcBtviWLSk4iPv3Z9nGiE,5442
|
|
5
5
|
mapFolding/dataBaskets.py,sha256=crfmmYJGeJ7QLCzuYi4rtVOtzCDRoOiTNfPfHbc6Foo,5620
|
|
6
|
-
mapFolding/datatypes.py,sha256
|
|
6
|
+
mapFolding/datatypes.py,sha256=dqOAa2RbiGcsRl9X4qo4tdMamgOoZVnewrMjY4mHXS4,773
|
|
7
7
|
mapFolding/filesystemToolkit.py,sha256=O9VQ0tSXlrGUhU3qN7uWxOTAZfuQb3fcRkTrfRZrGXo,9854
|
|
8
|
-
mapFolding/
|
|
9
|
-
mapFolding/oeis.py,sha256=5vNuZSq--Q-rFXtDvLMuoNhh5yLqFZugvXNxy4fs02U,17064
|
|
8
|
+
mapFolding/oeis.py,sha256=ifs9Uu4uqgKCd46aHuCqhyXt2JXLMcPmmWRFuXIBACg,16926
|
|
10
9
|
mapFolding/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
11
|
-
mapFolding/
|
|
12
|
-
mapFolding/theSSOT.py,sha256=BVqgXki5qY-d1Kf-AnO2-KeMbMZx805Y0hh8qM7BcxE,1297
|
|
10
|
+
mapFolding/theSSOT.py,sha256=7CyB3FnDWyNovTuUPRvSIfF7GxQc3aZoIsIwF1-4OyE,1456
|
|
13
11
|
mapFolding/reference/__init__.py,sha256=GKcSgYE49NcTISx-JZbELXyq-eRkMeTL5g4DXInWFw0,2206
|
|
14
12
|
mapFolding/reference/flattened.py,sha256=QK1xG9SllqCoi68e86Hyl9d9ATUAAFNpTQI-3zmcp5I,16072
|
|
15
13
|
mapFolding/reference/hunterNumba.py,sha256=iLfyqwGdAh6c5GbapnKsWhAsNsR3O-fyGGHAdohluLw,7258
|
|
@@ -22,35 +20,34 @@ mapFolding/reference/total_countPlus1vsPlusN.py,sha256=yJZAVLVdoXqHag2_N6_6CT-Q6
|
|
|
22
20
|
mapFolding/reference/jobsCompleted/__init__.py,sha256=TU93ZGUW1xEkT6d9mQFn_rp5DvRy0ZslEB2Q6MF5ZDc,2596
|
|
23
21
|
mapFolding/reference/jobsCompleted/[2x19]/p2x19.py,sha256=_tvYtfzMWVo2VtUbIAieoscb4N8FFflgTdW4-ljBUuA,19626
|
|
24
22
|
mapFolding/reference/jobsCompleted/p2x19/p2x19.py,sha256=eZEw4Me4ocTt6VXoK2-Sbd5SowZtxRIbN9dZmc7OCVg,6395
|
|
25
|
-
mapFolding/someAssemblyRequired/RecipeJob.py,sha256=
|
|
26
|
-
mapFolding/someAssemblyRequired/
|
|
27
|
-
mapFolding/someAssemblyRequired/__init__.py,sha256=
|
|
28
|
-
mapFolding/someAssemblyRequired/_toolIfThis.py,sha256=
|
|
29
|
-
mapFolding/someAssemblyRequired/_toolkitContainers.py,sha256=
|
|
23
|
+
mapFolding/someAssemblyRequired/RecipeJob.py,sha256=ZSgTC_12cyPkmZukxnrtVRUNy66DrcIwgopiXkJGFw0,4343
|
|
24
|
+
mapFolding/someAssemblyRequired/Z0Z_makeAllModules.py,sha256=SUBoo2vNlynWbImuuPc_StIRCwuH4yqx3z_KAClRSo4,30837
|
|
25
|
+
mapFolding/someAssemblyRequired/__init__.py,sha256=gDITQjODN8-0UET1ycF1Tmps6qviXv-mE1nG92o7VMY,2771
|
|
26
|
+
mapFolding/someAssemblyRequired/_toolIfThis.py,sha256=h1ueRlUU6Rb4vZCa3KtxFjUSrULRl-GkPp8NrosWdzM,3012
|
|
27
|
+
mapFolding/someAssemblyRequired/_toolkitContainers.py,sha256=3GywGZCAi16CsThTkS8kKWSPhUDfU3cybjQBQOPnfqs,9669
|
|
30
28
|
mapFolding/someAssemblyRequired/getLLVMforNoReason.py,sha256=9RPU6vK_eUg64GtVFI_nZnvUryXw8gfHJs9NyDYHIvg,2745
|
|
31
|
-
mapFolding/someAssemblyRequired/
|
|
32
|
-
mapFolding/someAssemblyRequired/
|
|
33
|
-
mapFolding/someAssemblyRequired/toolkitNumba.py,sha256=
|
|
34
|
-
mapFolding/someAssemblyRequired/transformationTools.py,sha256=
|
|
29
|
+
mapFolding/someAssemblyRequired/infoBooth.py,sha256=xgsXaCoy3EDOppIZtGQD32Oxx0gD4xcEF6j0o1hRvFQ,708
|
|
30
|
+
mapFolding/someAssemblyRequired/makeJobTheorem2Numba.py,sha256=csxagvDr89U5fBOSxD6KB6JJh5UVWF8IFGzogIMh1qY,13928
|
|
31
|
+
mapFolding/someAssemblyRequired/toolkitNumba.py,sha256=M-X3ymf2AlssitKcaLYbijW-K3dI-RSEUMhTU4Iyh9I,6612
|
|
32
|
+
mapFolding/someAssemblyRequired/transformationTools.py,sha256=kL3pDENALrayrDRa7gv64IPG-o7tBw8MYnqM0_xJvIQ,7868
|
|
35
33
|
mapFolding/syntheticModules/__init__.py,sha256=evVFqhCGa-WZKDiLcnQWjs-Bj34eRnfSLqz_d7dFYZY,83
|
|
36
34
|
mapFolding/syntheticModules/countParallel.py,sha256=OK_IB9w4yy9MMAiGvkei5ezPm_00v2nYjPrQZ_IlELg,7733
|
|
37
35
|
mapFolding/syntheticModules/daoOfMapFolding.py,sha256=cfWPABtXyCxJ0BwPI7rhfLh_2UYV_XKAL8lJ4GLNXaQ,5896
|
|
38
36
|
mapFolding/syntheticModules/dataPacking.py,sha256=m_eOZ7sMXIQ9jY5EvC3qgitQTY60n6rksy0ACMJOIC8,2292
|
|
39
37
|
mapFolding/syntheticModules/initializeCount.py,sha256=nWSlJMMfIM3DvZxMn6ISQusUJqRYAjKQyLF5hwLEdBQ,3119
|
|
40
|
-
mapFolding/syntheticModules/numbaCount.py,sha256=HOuCGqykFvYwa-WPkj1qGsZOzJV3ZYxeoZZmIUFY_Wo,13503
|
|
41
38
|
mapFolding/syntheticModules/theorem2.py,sha256=9jrbZNNX4BWYZW1S0JjvRY2k7RU7I1RNUMV7JdCt1ZY,3017
|
|
42
39
|
mapFolding/syntheticModules/theorem2Numba.py,sha256=-cKjNyxgUMFhEyFVs0VJ7hw4LfrV0WSNK5tPYbQ1oNU,3369
|
|
43
40
|
mapFolding/syntheticModules/theorem2Trimmed.py,sha256=DHW3NxBdtABQYBKm2WRvfQ5kzc2_UwGI2h4ePuYEJoM,2685
|
|
44
|
-
mapfolding-0.11.
|
|
41
|
+
mapfolding-0.11.4.dist-info/licenses/LICENSE,sha256=NxH5Y8BdC-gNU-WSMwim3uMbID2iNDXJz7fHtuTdXhk,19346
|
|
45
42
|
tests/__init__.py,sha256=5VhHf0JJ2_DSh58zJ0rR5UkpoCon-0IkdljspTCzZ04,1950
|
|
46
|
-
tests/conftest.py,sha256=
|
|
47
|
-
tests/test_computations.py,sha256=
|
|
43
|
+
tests/conftest.py,sha256=eumQRoDuWVrhsjDxWXGhW0N7lH0ZZ9XD-5q81bWFqOs,10874
|
|
44
|
+
tests/test_computations.py,sha256=HNpfs9Yz3rdfJInD15Jwd6DYsSR5TCwnR5EW0n7KbeI,5682
|
|
48
45
|
tests/test_filesystem.py,sha256=imlcetleJc4G9pDZTgS1j8UAs7ADbRxXVuNPecJAvqc,2964
|
|
49
46
|
tests/test_oeis.py,sha256=uxvwmgbnylSDdsVJfuAT0LuYLbIVFwSgdLxHm-xUGBM,5043
|
|
50
47
|
tests/test_other.py,sha256=DT7YE82YCHrSjdxhpY4UJnXmZvDm1b4e1QpZV3LyzcM,3747
|
|
51
|
-
tests/test_tasks.py,sha256
|
|
52
|
-
mapfolding-0.11.
|
|
53
|
-
mapfolding-0.11.
|
|
54
|
-
mapfolding-0.11.
|
|
55
|
-
mapfolding-0.11.
|
|
56
|
-
mapfolding-0.11.
|
|
48
|
+
tests/test_tasks.py,sha256=pEDukf2SVTOMEsn82JpAWKQzn1ZCTlkhLzQ5hYLg2yY,2780
|
|
49
|
+
mapfolding-0.11.4.dist-info/METADATA,sha256=eI0cbwa3GpjwLHlQcCdmVabDC9xseyTQqSR9vexJEv8,7712
|
|
50
|
+
mapfolding-0.11.4.dist-info/WHEEL,sha256=DnLRTWE75wApRYVsjgc6wsVswC54sMSJhAEd4xhDpBk,91
|
|
51
|
+
mapfolding-0.11.4.dist-info/entry_points.txt,sha256=F3OUeZR1XDTpoH7k3wXuRb3KF_kXTTeYhu5AGK1SiOQ,146
|
|
52
|
+
mapfolding-0.11.4.dist-info/top_level.txt,sha256=1gP2vFaqPwHujGwb3UjtMlLEGN-943VSYFR7V4gDqW8,17
|
|
53
|
+
mapfolding-0.11.4.dist-info/RECORD,,
|
tests/conftest.py
CHANGED
|
@@ -56,14 +56,10 @@ See the examples in `test_computations.py` for guidance on adapting these fixtur
|
|
|
56
56
|
"""
|
|
57
57
|
|
|
58
58
|
from collections.abc import Callable, Generator, Sequence
|
|
59
|
-
from mapFolding import getLeavesTotal, validateListDimensions, makeDataContainer
|
|
59
|
+
from mapFolding import getLeavesTotal, validateListDimensions, makeDataContainer
|
|
60
60
|
from mapFolding.oeis import oeisIDsImplemented, settingsOEIS
|
|
61
|
-
from
|
|
62
|
-
from pathlib import Path, PurePosixPath
|
|
63
|
-
from types import ModuleType
|
|
61
|
+
from pathlib import Path
|
|
64
62
|
from typing import Any
|
|
65
|
-
import importlib
|
|
66
|
-
import importlib.util
|
|
67
63
|
import numpy
|
|
68
64
|
import pytest
|
|
69
65
|
import random
|
|
@@ -238,77 +234,6 @@ def oeisID_1random() -> str:
|
|
|
238
234
|
"""Return one random valid OEIS ID."""
|
|
239
235
|
return random.choice(oeisIDsImplemented)
|
|
240
236
|
|
|
241
|
-
@pytest.fixture
|
|
242
|
-
def useThisDispatcher() -> Generator[Callable[..., None], Any, None]:
|
|
243
|
-
"""A fixture providing a context manager for temporarily replacing the dispatcher.
|
|
244
|
-
|
|
245
|
-
Returns
|
|
246
|
-
A context manager for patching the dispatcher
|
|
247
|
-
"""
|
|
248
|
-
import mapFolding.infoBooth as infoBooth
|
|
249
|
-
|
|
250
|
-
# Store original property method
|
|
251
|
-
original_dispatcher_property = infoBooth.PackageInformation.dispatcher
|
|
252
|
-
|
|
253
|
-
def patchDispatcher(callableTarget: Callable[..., Any]) -> None:
|
|
254
|
-
"""Patch the dispatcher property to return the target callable."""
|
|
255
|
-
# Create a new property that returns the target callable
|
|
256
|
-
def patched_dispatcher(self: infoBooth.PackageInformation) -> Callable[..., Any]:
|
|
257
|
-
def wrapper(state: Any) -> Any:
|
|
258
|
-
return callableTarget(state)
|
|
259
|
-
return wrapper
|
|
260
|
-
|
|
261
|
-
# Replace the property with our patched version
|
|
262
|
-
infoBooth.PackageInformation.dispatcher = property(patched_dispatcher) # type: ignore
|
|
263
|
-
|
|
264
|
-
yield patchDispatcher
|
|
265
|
-
|
|
266
|
-
# Restore the original property
|
|
267
|
-
infoBooth.PackageInformation.dispatcher = original_dispatcher_property # type: ignore
|
|
268
|
-
|
|
269
|
-
def getAlgorithmDispatcher() -> Callable[..., Any]:
|
|
270
|
-
moduleImported: ModuleType = importlib.import_module(The.logicalPathModuleSourceAlgorithm)
|
|
271
|
-
dispatcherCallable = getattr(moduleImported, The.sourceCallableDispatcher)
|
|
272
|
-
return dispatcherCallable
|
|
273
|
-
|
|
274
|
-
@pytest.fixture
|
|
275
|
-
def useAlgorithmSourceDispatcher(useThisDispatcher: Callable[..., Any]) -> Generator[None, None, None]:
|
|
276
|
-
"""Temporarily patches getDispatcherCallable to return the algorithm dispatcher."""
|
|
277
|
-
useThisDispatcher(importLogicalPath2Callable(The.logicalPathModuleSourceAlgorithm, The.sourceCallableDispatcher))
|
|
278
|
-
yield
|
|
279
|
-
|
|
280
|
-
@pytest.fixture
|
|
281
|
-
def syntheticDispatcherFixture(useThisDispatcher: Callable[..., Any], pathTmpTesting: Path) -> Callable[..., Any]:
|
|
282
|
-
"""Generate synthetic Numba-optimized dispatcher module and patch the dispatcher"""
|
|
283
|
-
from mapFolding.someAssemblyRequired.toolkitNumba import makeNumbaFlow
|
|
284
|
-
|
|
285
|
-
TESTINGrecipeFlow = RecipeSynthesizeFlow(
|
|
286
|
-
pathPackage=PurePosixPath(pathTmpTesting.absolute()),
|
|
287
|
-
logicalPathFlowRoot=None,
|
|
288
|
-
moduleDispatcher="test_dispatcher",
|
|
289
|
-
# Figure out dynamic flow control to synthesized modules https://github.com/hunterhogan/mapFolding/issues/4
|
|
290
|
-
# dispatcherCallable="dispatcherSynthetic",
|
|
291
|
-
)
|
|
292
|
-
|
|
293
|
-
# Generate optimized module in test directory
|
|
294
|
-
makeNumbaFlow(TESTINGrecipeFlow)
|
|
295
|
-
|
|
296
|
-
# Import synthesized dispatcher
|
|
297
|
-
importlibSpecificationDispatcher = importlib.util.spec_from_file_location(
|
|
298
|
-
TESTINGrecipeFlow.moduleDispatcher,
|
|
299
|
-
Path(TESTINGrecipeFlow.pathFilenameDispatcher),
|
|
300
|
-
)
|
|
301
|
-
if importlibSpecificationDispatcher is None or importlibSpecificationDispatcher.loader is None:
|
|
302
|
-
raise ImportError("Failed to load synthetic dispatcher module")
|
|
303
|
-
|
|
304
|
-
moduleSpecificationDispatcher = importlib.util.module_from_spec(importlibSpecificationDispatcher)
|
|
305
|
-
importlibSpecificationDispatcher.loader.exec_module(moduleSpecificationDispatcher)
|
|
306
|
-
callableDispatcherSynthetic = getattr(moduleSpecificationDispatcher, TESTINGrecipeFlow.callableDispatcher)
|
|
307
|
-
|
|
308
|
-
# Patch dispatcher and return callable
|
|
309
|
-
useThisDispatcher(callableDispatcherSynthetic)
|
|
310
|
-
return callableDispatcherSynthetic
|
|
311
|
-
|
|
312
237
|
def uniformTestMessage(expected: Any, actual: Any, functionName: str, *arguments: Any) -> str:
|
|
313
238
|
"""Format assertion message for any test comparison."""
|
|
314
239
|
return (f"\nTesting: `{functionName}({', '.join(str(parameter) for parameter in arguments)})`\n"
|
tests/test_computations.py
CHANGED
|
@@ -85,13 +85,14 @@ All tests leverage standardized utilities like `standardizedEqualToCallableRetur
|
|
|
85
85
|
that provide consistent, informative error messages and simplify test validation.
|
|
86
86
|
"""
|
|
87
87
|
|
|
88
|
-
from typing import Literal
|
|
89
88
|
from mapFolding import countFolds, getFoldsTotalKnown, oeisIDfor_n
|
|
89
|
+
from mapFolding.dataBaskets import MapFoldingState
|
|
90
90
|
from mapFolding.oeis import settingsOEIS
|
|
91
|
-
from mapFolding.someAssemblyRequired.RecipeJob import
|
|
92
|
-
from mapFolding.
|
|
91
|
+
from mapFolding.someAssemblyRequired.RecipeJob import RecipeJobTheorem2Numba
|
|
92
|
+
from mapFolding.syntheticModules.initializeCount import initializeGroupsOfFolds
|
|
93
93
|
from pathlib import Path, PurePosixPath
|
|
94
94
|
from tests.conftest import standardizedEqualToCallableReturn, registrarRecordsTmpObject
|
|
95
|
+
from typing import Literal
|
|
95
96
|
import importlib.util
|
|
96
97
|
import multiprocessing
|
|
97
98
|
import pytest
|
|
@@ -99,41 +100,33 @@ import pytest
|
|
|
99
100
|
if __name__ == '__main__':
|
|
100
101
|
multiprocessing.set_start_method('spawn')
|
|
101
102
|
|
|
102
|
-
|
|
103
|
-
standardizedEqualToCallableReturn(getFoldsTotalKnown(mapShapeTestParallelization), countFolds, mapShapeTestParallelization, None, 'maximum', None)
|
|
103
|
+
# TODO test synthesis
|
|
104
104
|
|
|
105
105
|
@pytest.mark.parametrize('flow', ['daoOfMapFolding', 'theorem2', 'theorem2Trimmed', 'theorem2numba'])
|
|
106
106
|
def test_flowControl(mapShapeTestCountFolds: tuple[int, ...], flow: Literal['daoOfMapFolding'] | Literal['theorem2'] | Literal['theorem2numba']) -> None:
|
|
107
107
|
standardizedEqualToCallableReturn(getFoldsTotalKnown(mapShapeTestCountFolds), countFolds, None, None, None, None, mapShapeTestCountFolds, None, None, flow)
|
|
108
108
|
|
|
109
|
-
def test_algorithmSourceSequential(mapShapeTestCountFolds: tuple[int, ...], useAlgorithmSourceDispatcher: None) -> None:
|
|
110
|
-
standardizedEqualToCallableReturn(getFoldsTotalKnown(mapShapeTestCountFolds), countFolds, mapShapeTestCountFolds)
|
|
111
|
-
|
|
112
109
|
def test_aOFn_calculate_value(oeisID: str) -> None:
|
|
113
110
|
for n in settingsOEIS[oeisID]['valuesTestValidation']:
|
|
114
111
|
standardizedEqualToCallableReturn(settingsOEIS[oeisID]['valuesKnown'][n], oeisIDfor_n, oeisID, n)
|
|
115
112
|
|
|
116
|
-
def test_syntheticParallel(syntheticDispatcherFixture: None, mapShapeTestParallelization: tuple[int, ...]) -> None:
|
|
117
|
-
standardizedEqualToCallableReturn(getFoldsTotalKnown(mapShapeTestParallelization), countFolds, mapShapeTestParallelization, None, 'maximum')
|
|
118
|
-
|
|
119
|
-
def test_syntheticSequential(syntheticDispatcherFixture: None, mapShapeTestCountFolds: tuple[int, ...]) -> None:
|
|
120
|
-
standardizedEqualToCallableReturn(getFoldsTotalKnown(mapShapeTestCountFolds), countFolds, mapShapeTestCountFolds)
|
|
121
|
-
|
|
122
113
|
@pytest.mark.parametrize('pathFilenameTmpTesting', ['.py'], indirect=True)
|
|
123
114
|
def test_writeJobNumba(oneTestCuzTestsOverwritingTests: tuple[int, ...], pathFilenameTmpTesting: Path) -> None:
|
|
124
115
|
from mapFolding.someAssemblyRequired.toolkitNumba import SpicesJobNumba
|
|
125
|
-
from mapFolding.someAssemblyRequired.
|
|
126
|
-
|
|
116
|
+
from mapFolding.someAssemblyRequired.makeJobTheorem2Numba import makeJobNumba
|
|
117
|
+
mapShape = oneTestCuzTestsOverwritingTests
|
|
118
|
+
state = MapFoldingState(mapShape)
|
|
119
|
+
state = initializeGroupsOfFolds(state)
|
|
127
120
|
|
|
128
121
|
pathFilenameModule = pathFilenameTmpTesting.absolute()
|
|
129
122
|
pathFilenameFoldsTotal = pathFilenameModule.with_suffix('.foldsTotalTesting')
|
|
130
123
|
registrarRecordsTmpObject(pathFilenameFoldsTotal)
|
|
131
124
|
|
|
132
|
-
jobTest =
|
|
125
|
+
jobTest = RecipeJobTheorem2Numba(state
|
|
133
126
|
, pathModule=PurePosixPath(pathFilenameModule.parent)
|
|
134
127
|
, moduleIdentifier=pathFilenameModule.stem
|
|
135
128
|
, pathFilenameFoldsTotal=PurePosixPath(pathFilenameFoldsTotal))
|
|
136
|
-
spices = SpicesJobNumba()
|
|
129
|
+
spices = SpicesJobNumba(useNumbaProgressBar=False)
|
|
137
130
|
makeJobNumba(jobTest, spices)
|
|
138
131
|
|
|
139
132
|
Don_Lapre_Road_to_Self_Improvement = importlib.util.spec_from_file_location("__main__", pathFilenameModule)
|
tests/test_tasks.py
CHANGED
|
@@ -6,7 +6,8 @@ from Z0Z_tools.pytestForYourUse import PytestFor_defineConcurrencyLimit
|
|
|
6
6
|
import multiprocessing
|
|
7
7
|
import pytest
|
|
8
8
|
|
|
9
|
-
# When to use multiprocessing.set_start_method
|
|
9
|
+
# When to use multiprocessing.set_start_method
|
|
10
|
+
# https://github.com/hunterhogan/mapFolding/issues/6
|
|
10
11
|
if __name__ == '__main__':
|
|
11
12
|
multiprocessing.set_start_method('spawn')
|
|
12
13
|
|
mapFolding/infoBooth.py
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
from collections.abc import Callable
|
|
2
|
-
from importlib import import_module as importlib_import_module
|
|
3
|
-
from mapFolding import ComputationState, PackageSettings
|
|
4
|
-
from types import ModuleType
|
|
5
|
-
import dataclasses
|
|
6
|
-
|
|
7
|
-
@dataclasses.dataclass
|
|
8
|
-
class PackageInformation(PackageSettings):
|
|
9
|
-
"""
|
|
10
|
-
In _all_ of the root directory and "syntheticModules", the _only_ `PackageInformation` that are used are:
|
|
11
|
-
The.concurrencyPackage
|
|
12
|
-
The.dispatcher
|
|
13
|
-
"""
|
|
14
|
-
|
|
15
|
-
logicalPathModuleDispatcher: str | None = None
|
|
16
|
-
"""Logical import path to the module containing the dispatcher function."""
|
|
17
|
-
|
|
18
|
-
callableDispatcher: str | None = None
|
|
19
|
-
"""Name of the function within the dispatcher module that will be called."""
|
|
20
|
-
|
|
21
|
-
concurrencyPackage: str | None = None
|
|
22
|
-
"""Package to use for concurrent execution (e.g., 'multiprocessing', 'numba')."""
|
|
23
|
-
|
|
24
|
-
# "Evaluate When Packaging" and "Evaluate When Installing" https://github.com/hunterhogan/mapFolding/issues/18
|
|
25
|
-
dataclassIdentifier: str = dataclasses.field(default='ComputationState', metadata={'evaluateWhen': 'packaging'})
|
|
26
|
-
"""Name of the dataclass used to track computation state."""
|
|
27
|
-
|
|
28
|
-
dataclassInstance: str = dataclasses.field(default='state', metadata={'evaluateWhen': 'packaging'})
|
|
29
|
-
"""Default variable name for instances of the computation state dataclass."""
|
|
30
|
-
|
|
31
|
-
dataclassInstanceTaskDistributionSuffix: str = dataclasses.field(default='Parallel', metadata={'evaluateWhen': 'packaging'})
|
|
32
|
-
"""Suffix added to dataclassInstance for parallel task distribution."""
|
|
33
|
-
|
|
34
|
-
dataclassModule: str = dataclasses.field(default='beDRY', metadata={'evaluateWhen': 'packaging'})
|
|
35
|
-
"""Module containing the computation state dataclass definition."""
|
|
36
|
-
|
|
37
|
-
datatypePackage: str = dataclasses.field(default='numpy', metadata={'evaluateWhen': 'packaging'})
|
|
38
|
-
"""Package providing the numeric data types used in computation."""
|
|
39
|
-
|
|
40
|
-
sourceAlgorithm: str = dataclasses.field(default='theDao', metadata={'evaluateWhen': 'packaging'})
|
|
41
|
-
"""Module containing the reference implementation of the algorithm."""
|
|
42
|
-
|
|
43
|
-
sourceCallableDispatcher: str = dataclasses.field(default='doTheNeedful', metadata={'evaluateWhen': 'packaging'})
|
|
44
|
-
"""Name of the function that dispatches computation in the source algorithm."""
|
|
45
|
-
|
|
46
|
-
sourceCallableInitialize: str = dataclasses.field(default='countInitialize', metadata={'evaluateWhen': 'packaging'})
|
|
47
|
-
"""Name of the function that initializes computation in the source algorithm."""
|
|
48
|
-
|
|
49
|
-
sourceCallableParallel: str = dataclasses.field(default='countParallel', metadata={'evaluateWhen': 'packaging'})
|
|
50
|
-
"""Name of the function that performs parallel computation in the source algorithm."""
|
|
51
|
-
|
|
52
|
-
sourceCallableSequential: str = dataclasses.field(default='countSequential', metadata={'evaluateWhen': 'packaging'})
|
|
53
|
-
"""Name of the function that performs sequential computation in the source algorithm."""
|
|
54
|
-
|
|
55
|
-
sourceConcurrencyManagerIdentifier: str = dataclasses.field(default='submit', metadata={'evaluateWhen': 'packaging'})
|
|
56
|
-
"""Method name used to submit tasks to the concurrency manager."""
|
|
57
|
-
|
|
58
|
-
sourceConcurrencyManagerNamespace: str = dataclasses.field(default='concurrencyManager', metadata={'evaluateWhen': 'packaging'})
|
|
59
|
-
"""Variable name used for the concurrency manager instance."""
|
|
60
|
-
|
|
61
|
-
sourceConcurrencyPackage: str = dataclasses.field(default='multiprocessing', metadata={'evaluateWhen': 'packaging'})
|
|
62
|
-
"""Default package used for concurrency in the source algorithm."""
|
|
63
|
-
|
|
64
|
-
dataclassInstanceTaskDistribution: str = dataclasses.field(default=None, metadata={'evaluateWhen': 'packaging'}) # pyright: ignore[reportAssignmentType]
|
|
65
|
-
"""Variable name for the parallel distribution instance of the computation state."""
|
|
66
|
-
|
|
67
|
-
logicalPathModuleDataclass: str = dataclasses.field(default=None, metadata={'evaluateWhen': 'packaging'}) # pyright: ignore[reportAssignmentType]
|
|
68
|
-
"""Fully qualified import path to the module containing the computation state dataclass."""
|
|
69
|
-
|
|
70
|
-
logicalPathModuleSourceAlgorithm: str = dataclasses.field(default=None, metadata={'evaluateWhen': 'packaging'}) # pyright: ignore[reportAssignmentType]
|
|
71
|
-
"""Fully qualified import path to the module containing the source algorithm."""
|
|
72
|
-
|
|
73
|
-
@property
|
|
74
|
-
def dispatcher(self) -> Callable[['ComputationState'], 'ComputationState']:
|
|
75
|
-
""" _The_ callable that connects `countFolds` to the logic that does the work."""
|
|
76
|
-
logicalPath: str = self.logicalPathModuleDispatcher or self.logicalPathModuleSourceAlgorithm
|
|
77
|
-
identifier: str = self.callableDispatcher or self.sourceCallableDispatcher
|
|
78
|
-
moduleImported: ModuleType = importlib_import_module(logicalPath)
|
|
79
|
-
return getattr(moduleImported, identifier)
|
|
80
|
-
|
|
81
|
-
def __post_init__(self) -> None:
|
|
82
|
-
if self.dataclassInstanceTaskDistribution is None: # pyright: ignore[reportUnnecessaryComparison]
|
|
83
|
-
self.dataclassInstanceTaskDistribution = self.dataclassInstance + self.dataclassInstanceTaskDistributionSuffix
|
|
84
|
-
|
|
85
|
-
if self.logicalPathModuleDataclass is None: # pyright: ignore[reportUnnecessaryComparison]
|
|
86
|
-
self.logicalPathModuleDataclass = '.'.join([self.packageName, self.dataclassModule])
|
|
87
|
-
if self.logicalPathModuleSourceAlgorithm is None: # pyright: ignore[reportUnnecessaryComparison]
|
|
88
|
-
self.logicalPathModuleSourceAlgorithm = '.'.join([self.packageName, self.sourceAlgorithm])
|
|
89
|
-
|
|
90
|
-
class raiseIfNoneGitHubIssueNumber3(Exception): pass
|
|
91
|
-
|
|
92
|
-
logicalPathModuleDispatcherHARDCODED: str = 'mapFolding.syntheticModules.numbaCount'
|
|
93
|
-
callableDispatcherHARDCODED: str = 'doTheNeedful'
|
|
94
|
-
concurrencyPackageHARDCODED = 'multiprocessing'
|
|
95
|
-
|
|
96
|
-
The = PackageInformation(logicalPathModuleDispatcher=logicalPathModuleDispatcherHARDCODED, callableDispatcher=callableDispatcherHARDCODED, concurrencyPackage=concurrencyPackageHARDCODED)
|