Skip to content

Commit

Permalink
switch to cloud pickle
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-janssen committed May 22, 2023
1 parent ff84b9c commit ac1b072
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions .ci_support/environment-mpich.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
channels:
- conda-forge
dependencies:
- cloudpickle =2.2.1
- coveralls
- coverage
- codacy-coverage
Expand Down
1 change: 1 addition & 0 deletions .ci_support/environment-openmpi.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
channels:
- conda-forge
dependencies:
- cloudpickle =2.2.1
- coveralls
- coverage
- codacy-coverage
Expand Down
6 changes: 3 additions & 3 deletions pylammpsmpi/mpi/lmpmpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from ctypes import c_double, c_int
from mpi4py import MPI
import numpy as np
import pickle
import cloudpickle
import sys
import zmq
from lammps import lammps
Expand Down Expand Up @@ -492,7 +492,7 @@ def _gather_data_from_all_processors(data):
socket.connect("tcp://localhost:" + port_selected)
while True:
if MPI.COMM_WORLD.rank == 0:
input_dict = pickle.loads(socket.recv())
input_dict = cloudpickle.loads(socket.recv())
# with open('process.txt', 'a') as file:
# print('Input:', input_dict, file=file)
else:
Expand All @@ -505,4 +505,4 @@ def _gather_data_from_all_processors(data):
if MPI.COMM_WORLD.rank == 0 and output is not None:
# with open('process.txt', 'a') as file:
# print('Output:', output, file=file)
socket.send(pickle.dumps(output))
socket.send(cloudpickle.dumps(output))
6 changes: 3 additions & 3 deletions pylammpsmpi/utils/lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Distributed under the terms of "New BSD License", see the LICENSE file.

import os
import pickle
import cloudpickle
import subprocess
import zmq

Expand Down Expand Up @@ -75,7 +75,7 @@ def _send(self, command, data=None):
-------
None
"""
self._socket.send(pickle.dumps({"c": command, "d": data}))
self._socket.send(cloudpickle.dumps({"c": command, "d": data}))

def _receive(self):
"""
Expand All @@ -90,7 +90,7 @@ def _receive(self):
data : string
data from the command
"""
output = pickle.loads(self._socket.recv())
output = cloudpickle.loads(self._socket.recv())
return output

@property
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
keywords='lammps, mpi4py',
packages=find_packages(exclude=["*tests*"]),
install_requires=[
'mpi4py==3.1.4', "pyzmq==25.0.0"
"cloudpickle==2.2.1", "mpi4py==3.1.4", "pyzmq==25.0.0"
],
cmdclass=versioneer.get_cmdclass(),
)

0 comments on commit ac1b072

Please sign in to comment.