Skip to content

Commit 2b70d7c

Browse files
committed
Update CLAUDE.md with comprehensive PyMoo development guide
- Add core architecture overview with design patterns - Include essential development commands (testing, compilation, docs) - Document the dual implementation system (Python/Cython) - Provide algorithm/problem implementation patterns - Explain the hybrid documentation system (Markdown→Jupyter) - Add performance considerations and testing guidelines
1 parent d89e955 commit 2b70d7c

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

pymoo/parallelization/joblib_utils.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
"""
2+
Joblib-based parallelization utilities for pymoo.
3+
"""
4+
5+
from . import joblib, requires_joblib
6+
7+
8+
@requires_joblib
9+
def create_joblib_parallelization(n_jobs=-1, backend='threading', **kwargs):
10+
"""
11+
Create a joblib-based parallelization runner.
12+
13+
Parameters
14+
----------
15+
n_jobs : int, default=-1
16+
Number of jobs to run in parallel. -1 uses all available processors.
17+
backend : str, default='threading'
18+
Parallelization backend ('threading', 'multiprocessing', 'loky').
19+
**kwargs
20+
Additional arguments passed to joblib.Parallel.
21+
22+
Returns
23+
-------
24+
Parallel
25+
Configured joblib.Parallel instance.
26+
"""
27+
return joblib.Parallel(n_jobs=n_jobs, backend=backend, **kwargs)
28+
29+
30+
@requires_joblib
31+
def starmap_joblib(func, iterable, n_jobs=-1, **kwargs):
32+
"""
33+
Apply function to iterable using joblib parallelization.
34+
35+
Parameters
36+
----------
37+
func : callable
38+
Function to apply to each element.
39+
iterable : iterable
40+
Iterable of arguments to pass to func.
41+
n_jobs : int, default=-1
42+
Number of parallel jobs.
43+
**kwargs
44+
Additional arguments for joblib.Parallel.
45+
46+
Returns
47+
-------
48+
list
49+
Results from parallel execution.
50+
"""
51+
parallel = create_joblib_parallelization(n_jobs=n_jobs, **kwargs)
52+
return parallel(joblib.delayed(func)(args) for args in iterable)

0 commit comments

Comments
 (0)