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

TypeError: no default __reduce__ due to non-trivial __cinit__ pmap/watershell #1612

Open
krlitros87 opened this issue Aug 31, 2022 · 6 comments

Comments

@krlitros87
Copy link

Hi,
Some info:
I installed ambertools via conda as explained here: https://ambermd.org/GetAmber.php
Everything went well, without problems.

But when trying to run wathershell:
shell_anions = pt.pmap(pt.watershell, traj, solute_mask=' :1', solvent_mask=':Cl-', upper=10, image=False,n_cores=4)
I get the following error message:

Traceback (most recent call last):
File "/store1/navarro/PpGLR1/CA/wider/300mV/1/parallel.py", line 108, in
main()
File "/store1/navarro/PpGLR1/CA/wider/300mV/1/parallel.py", line 104, in main
shell_anions = pt.pmap(pt.watershell, traj, solute_mask=' :1', solvent_mask=':Cl-', upper=10, image=False,n_cores=4)
File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/site-packages/pytraj/parallel/multiprocess.py", line 229, in pmap
return _pmap(func, traj, *args, **kwargs)
File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/site-packages/pytraj/parallel/multiprocess.py", line 219, in _pmap
data = p.map(pfuncs, [rank for rank in range(n_cores)])
File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/multiprocessing/pool.py", line 367, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/multiprocessing/pool.py", line 774, in get
raise self._value
File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/multiprocessing/pool.py", line 540, in _handle_tasks
put(task)
File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/multiprocessing/connection.py", line 211, in send
self._send_bytes(_ForkingPickler.dumps(obj))
File "/home/navarro/miniconda3/envs/AmberTools22/lib/python3.10/multiprocessing/reduction.py", line 51, in dumps
cls(buf, protocol).dump(obj)
File "stringsource", line 2, in pytraj.trajectory.c_traj.c_trajectory.TrajectoryCpptraj.reduce_cython
TypeError: no default reduce due to non-trivial cinit

I haven't found a way to solve this problem, so any help is more than welcome.
Thanks!

@hainm
Copy link
Contributor

hainm commented Aug 31, 2022

@krlitros87

  • ha, I have never tried with python3.101. What's your platform? linux or macos?
  • shell_anions = pt.watershell(traj, solute_mask=' :1', solvent_mask=':Cl-', upper=10, image=False) -> does this work for you (not using pmap parallel)?

@krlitros87
Copy link
Author

krlitros87 commented Aug 31, 2022

@hainm I'm working on linux (Description: openSUSE Leap 15.3).
Yeah, watershell works fine without using pmap

for residue in range (2,471,1):
shell_anions = pt.watershell(traj, solute_mask=' :'+str(residue),solvent_mask=':Cl-', upper=10, image=False)
np.savetxt(str(residue)+'_anions.csv', shell_anions, delimiter=",")

@hainm
Copy link
Contributor

hainm commented Aug 31, 2022

For now, please not to use pmap since it takes time to debug/fix this issue. Cheers Carlos.

@krlitros87
Copy link
Author

Thank you @hainm. Do you think this will work on macOS? I don't understand what the problem could be, since this works for most of the people here

@hainm
Copy link
Contributor

hainm commented Aug 31, 2022

Do you think this will work on macOS?

Yes, I've tried with my macOS.

I don't understand what the problem could be,

It's kind of complicated and partially because of the cython version that was used to generate C code for pytraj.

@krlitros87
Copy link
Author

@hainm will it work if I try installing a different version on my env? In any case, I'm downloading everything to my MacBook, so I'll post an update asap

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