Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pylammpsmpi/lammps_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(self, cores=1, working_directory=".", client=None, mode="local"):
LammpsBase,
cores=self.cores,
working_directory=self.working_directory,
local=False,
actor=True,
)
self.lmp = fut.result()
Expand Down
16 changes: 14 additions & 2 deletions pylammpsmpi/utils/lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,29 @@


class LammpsBase:
def __init__(self, cores=8, working_directory="."):
def __init__(self, cores=8, working_directory=".", local=True):
self.cores = cores
self.working_directory = working_directory
self._process = None
self.local = local

def start_process(self):
executable = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "../mpi", "lmpmpi.py"
)
if self.local:
command_array = ["mpiexec", "-n", str(self.cores), "python", executable]
else:
command_array = [
"mpiexec",
"--oversubscribe",
"-n",
str(self.cores),
"python",
executable,
]
self._process = subprocess.Popen(
["mpiexec", "--oversubscribe", "-n", str(self.cores), "python", executable],
command_array,
stdout=subprocess.PIPE,
stderr=None,
stdin=subprocess.PIPE,
Expand Down