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

pmap parallel error #1651

Open
groponp opened this issue Mar 27, 2024 · 6 comments
Open

pmap parallel error #1651

groponp opened this issue Mar 27, 2024 · 6 comments

Comments

@groponp
Copy link

groponp commented Mar 27, 2024

Hi,

I'm trying to use the pmap method :
In [7]: pt.version
Out[7]: '2.0.5'

traj = pt.iterload("04_MD/MD_r1.dcd", "files/MD_QwikMD.psf")
pt.pmap(pt.radgyr, traj, n_cores=4)

error:

TypeError Traceback (most recent call last)
in
----> 1 pt.pmap(pt.radgyr, traj, n_cores=4)

~/miniconda3/envs/cpptraj/lib/python3.7/site-packages/pytraj/parallel/multiprocess.py in pmap(func, traj, *args, **kwargs)
228 def pmap(func=None, traj=None, *args, **kwargs):
229 if func != NH_order_parameters:
--> 230 return _pmap(func, traj, *args, **kwargs)
231 else:
232 if 'n_cores' in kwargs.keys():

~/miniconda3/envs/cpptraj/lib/python3.7/site-packages/pytraj/parallel/multiprocess.py in _pmap(func, traj, *args, **kwargs)
218 progress_params=progress_params)
219
--> 220 data = p.map(pfuncs, [rank for rank in range(n_cores)])
221 p.close()
222

~/miniconda3/envs/cpptraj/lib/python3.7/multiprocessing/pool.py in map(self, func, iterable, chunksize)
266 in a list that is returned.
267 '''
--> 268 return self._map_async(func, iterable, mapstar, chunksize).get()
269
270 def starmap(self, func, iterable, chunksize=None):

~/miniconda3/envs/cpptraj/lib/python3.7/multiprocessing/pool.py in get(self, timeout)
655 return self._value
656 else:
--> 657 raise self._value
658
659 def _set(self, i, obj):

~/miniconda3/envs/cpptraj/lib/python3.7/multiprocessing/pool.py in _handle_tasks(taskqueue, put, outqueue, pool, cache)
429 break
430 try:
--> 431 put(task)
432 except Exception as e:
433 job, idx = task[:2]

~/miniconda3/envs/cpptraj/lib/python3.7/multiprocessing/connection.py in send(self, obj)
204 self._check_closed()
205 self._check_writable()
--> 206 self._send_bytes(_ForkingPickler.dumps(obj))
207
208 def recv_bytes(self, maxlength=None):

~/miniconda3/envs/cpptraj/lib/python3.7/multiprocessing/reduction.py in dumps(cls, obj, protocol)
49 def dumps(cls, obj, protocol=None):
50 buf = io.BytesIO()
---> 51 cls(buf, protocol).dump(obj)
52 return buf.getbuffer()
53

~/miniconda3/envs/cpptraj/lib/python3.7/site-packages/pytraj/trajectory/c_traj/c_trajectory.cpython-37m-x86_64-linux-gnu.so in pytraj.trajectory.c_traj.c_trajectory.TrajectoryCpptraj.reduce_cython()

TypeError: no default reduce due to non-trivial cinit

@hainm
Copy link
Contributor

hainm commented Mar 28, 2024

it seems related to cython with python version.
@groponp Can you please try pytraj with python 3.11 instead?

conda install conda-forge::ambertools

@groponp
Copy link
Author

groponp commented Apr 1, 2024

Dear @hainm, thanks so much for your answer !

I would can try it.

@groponp
Copy link
Author

groponp commented Apr 1, 2024

@hainm I want to asked you, too. Is autoimage enable to use him with pmap?. Now when I use pmap, Have always I that contrast against serial calculation ?

@hainm
Copy link
Contributor

hainm commented Apr 2, 2024

@hainm I want to asked you, too. Is autoimage enable to use him with pmap?. Now when I use pmap, Have always I that contrast against serial calculation ?

Dear @groponp , what do you mean about "him" in this question?

@groponp
Copy link
Author

groponp commented Apr 2, 2024

I'm sorry I have a mistake , I want to say use with pmap,

@hainm
Copy link
Contributor

hainm commented Apr 2, 2024

I'm sorry I have a mistake , I want to say use with pmap,

@groponp I don't think so. pmap only works with method having register_map decorator: https://github.com/Amber-MD/pytraj/blob/a318898a88d3506305d2e409ccd1344e452b2a40/pytraj/all_actions.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants