Skip to content

Commit

Permalink
Merge pull request #138 from pyiron/pympipool
Browse files Browse the repository at this point in the history
Compatibility to the latest changes in pympipool
  • Loading branch information
jan-janssen authored Sep 15, 2023
2 parents 20c137f + fbb56fd commit f2d3f0c
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 50 deletions.
4 changes: 2 additions & 2 deletions .ci_support/environment-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ dependencies:
- mpich
- numpy =1.23.5
- mpi4py =3.1.4
- pympipool =0.6.2
- pympipool =0.7.0
- ase =3.22.1
- scipy =1.11.2
- scipy =1.11.2
4 changes: 2 additions & 2 deletions .ci_support/environment-openmpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ dependencies:
- openmpi
- numpy =1.23.5
- mpi4py =3.1.4
- pympipool =0.6.2
- pympipool =0.7.0
- ase =3.22.1
- scipy =1.11.2
- scipy =1.11.2
2 changes: 1 addition & 1 deletion pylammpsmpi/mpi/lmpmpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import numpy as np
import sys
from lammps import lammps
from pympipool import (
from pympipool.shared import (
interface_connect,
interface_send,
interface_shutdown,
Expand Down
49 changes: 17 additions & 32 deletions pylammpsmpi/wrapper/concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
# Distributed under the terms of "New BSD License", see the LICENSE file.

import os
import socket
from concurrent.futures import Future
from queue import Queue
from pympipool import RaisingThread, cancel_items_in_queue, interface_bootup
from pympipool.shared import (
RaisingThread,
interface_bootup,
cancel_items_in_queue,
MpiExecInterface,
)


__author__ = "Sarath Menon, Jan Janssen"
Expand All @@ -26,30 +30,23 @@ def execute_async(
cmdargs=None,
cores=1,
oversubscribe=False,
enable_flux_backend=False,
enable_slurm_backend=False,
cwd=None,
queue_adapter=None,
queue_adapter_kwargs=None,
):
executable = os.path.join(
os.path.dirname(os.path.abspath(__file__)), "../mpi", "lmpmpi.py"
os.path.dirname(os.path.abspath(__file__)), "..", "mpi", "lmpmpi.py"
)
cmds = ["python", executable]
if cmdargs is not None:
command_lst = ["python", executable] + cmdargs
else:
command_lst = ["python", executable]
cmds.extend(cmdargs)
interface = interface_bootup(
command_lst=command_lst,
cwd=cwd,
cores=cores,
gpus_per_core=0,
oversubscribe=oversubscribe,
enable_flux_backend=enable_flux_backend,
enable_slurm_backend=enable_slurm_backend,
queue_adapter=queue_adapter,
queue_type=None,
queue_adapter_kwargs=queue_adapter_kwargs,
command_lst=cmds,
connections=MpiExecInterface(
cwd=cwd,
cores=cores,
threads_per_core=1,
gpus_per_core=0,
oversubscribe=oversubscribe,
),
)
while True:
task_dict = future_queue.get()
Expand All @@ -67,23 +64,15 @@ def __init__(
self,
cores=8,
oversubscribe=False,
enable_flux_backend=False,
enable_slurm_backend=False,
working_directory=".",
cmdargs=None,
queue_adapter=None,
queue_adapter_kwargs=None,
):
self.cores = cores
self.working_directory = working_directory
self._future_queue = Queue()
self._process = None
self._oversubscribe = oversubscribe
self._enable_flux_backend = enable_flux_backend
self._enable_slurm_backend = enable_slurm_backend
self._cmdargs = cmdargs
self._queue_adapter = queue_adapter
self._queue_adapter_kwargs = queue_adapter_kwargs
self._start_process()

def _start_process(self):
Expand All @@ -94,11 +83,7 @@ def _start_process(self):
"cmdargs": self._cmdargs,
"cores": self.cores,
"oversubscribe": self._oversubscribe,
"enable_flux_backend": self._enable_flux_backend,
"enable_slurm_backend": self._enable_slurm_backend,
"cwd": self.working_directory,
"queue_adapter": self._queue_adapter,
"queue_adapter_kwargs": self._queue_adapter_kwargs,
},
)
self._process.start()
Expand Down
10 changes: 0 additions & 10 deletions pylammpsmpi/wrapper/extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,31 +244,21 @@ def __init__(
self,
cores=1,
oversubscribe=False,
enable_flux_backend=False,
enable_slurm_backend=False,
working_directory=".",
client=None,
mode="local",
cmdargs=None,
queue_adapter=None,
queue_adapter_kwargs=None,
):
self.cores = cores
self.working_directory = working_directory
self.oversubscribe = oversubscribe
self.enable_flux_backend = enable_flux_backend
self.enable_slurm_backend = enable_slurm_backend
self.client = client
self.mode = mode
self.lmp = LammpsConcurrent(
cores=self.cores,
oversubscribe=self.oversubscribe,
enable_flux_backend=self.enable_flux_backend,
enable_slurm_backend=self.enable_slurm_backend,
working_directory=self.working_directory,
cmdargs=cmdargs,
queue_adapter=queue_adapter,
queue_adapter_kwargs=queue_adapter_kwargs,
)

def __getattr__(self, name):
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
keywords='lammps, mpi4py',
packages=find_packages(exclude=["*tests*"]),
install_requires=[
"mpi4py==3.1.4", "pympipool==0.6.2", "numpy==1.23.5"
"mpi4py==3.1.4", "pympipool==0.7.0", "numpy==1.23.5"
],
extras_require={
"ase": ["ase==3.22.1", "scipy==1.11.2"],
Expand Down
1 change: 0 additions & 1 deletion tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def setUpClass(cls):
cls.lmp = LammpsBase(
cores=1,
oversubscribe=False,
enable_flux_backend=False,
working_directory=".",
cmdargs=["-cite", cls.citation_file]
)
Expand Down
1 change: 0 additions & 1 deletion tests/test_concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def setUpClass(cls):
cls.lmp = LammpsConcurrent(
cores=1,
oversubscribe=False,
enable_flux_backend=False,
working_directory=".",
cmdargs=["-cite", cls.citation_file]
)
Expand Down

0 comments on commit f2d3f0c

Please sign in to comment.