Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bruteforce parallel implementation not working #4

Closed
wariobrega opened this issue Apr 4, 2018 · 1 comment
Closed

bruteforce parallel implementation not working #4

wariobrega opened this issue Apr 4, 2018 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@wariobrega
Copy link
Contributor

wariobrega commented Apr 4, 2018

BruteforceSearch in algorithms/Bruteforce_search.py does not work when parallel=True is set.
Error message:

"""
Traceback (most recent call last):
File "/home/local/MENDEL/d.capocefalo/miniconda3/envs/pyntacle/lib/python3.6/multiprocessing/pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "/home/local/MENDEL/d.capocefalo/Programming/pyntacle/algorithms/bruteforce_search.py", line 202, in crunch_fragmentation_combinations
kppset_score_pairs[allS] = type_func(temp_graph)
TypeError: func_wrapper() got multiple values for argument 'graph'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/local/MENDEL/d.capocefalo/Programming/pyntacle/pyntacle_tests.py", line 46, in
bf = BruteforceSearch.fragmentation(mat, kpp_size=2, kpp_type=KPNEGchoices.dF, parallel=True, ncores=2)
File "/home/local/MENDEL/d.capocefalo/Programming/pyntacle/tools/misc/graph_routines.py", line 80, in func_wrapper
return func(graph, *args, **kwargs)
File "/home/local/MENDEL/d.capocefalo/Programming/pyntacle/tools/misc/kpsearch_utils.py", line 97, in func_wrapper
return func(graph, kpp_size, kpp_type,max_distances, *args, **kwargs)
File "/home/local/MENDEL/d.capocefalo/Programming/pyntacle/algorithms/bruteforce_search.py", line 106, in fragmentation
final_set = BruteforceSearch.__bruteforce_fragmentation_parallel(graph=graph, kpp_size=kpp_size, kpp_type=kpp_type, ncores=ncores, max_distances=max_distances, implementation=implementation) #this is equivalent to the kppset_score_pairs
File "/home/local/MENDEL/d.capocefalo/Programming/pyntacle/algorithms/bruteforce_search.py", line 233, in __bruteforce_fragmentation_parallel
for partial_result in pool.imap_unordered(partial(BruteforceSearch.crunch_fragmentation_combinations, graph=graph, kpp_type=kpp_type, implementation=implementation, max_distances=max_distances), allS):
File "/home/local/MENDEL/d.capocefalo/miniconda3/envs/pyntacle/lib/python3.6/multiprocessing/pool.py", line 735, in next
raise value
TypeError: func_wrapper() got multiple values for argument 'graph'
"""

This is possibly c aused by the fact that the_pool.imap_unordered_ multiprocessing function (line 236) spawn several KeyPlayer functions and that the decorator of these functions interfere with the pooling.

Any idea on how to fix this?

@wariobrega wariobrega added the bug Something isn't working label Apr 4, 2018
@mazzalab
Copy link
Owner

mazzalab commented Apr 6, 2018

solved, making not partial the called methods by _pool.imap_unordered function

@mazzalab mazzalab closed this as completed Apr 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants