Skip to content

Add MacOS X tests #239

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
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
16 changes: 13 additions & 3 deletions .github/workflows/unittests-mpich.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ on:

jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
include:
- operating-system: macos-latest
python-version: '3.12'

- operating-system: ubuntu-latest
python-version: '3.12'

- operating-system: ubuntu-latest
python-version: '3.11'

- operating-system: ubuntu-latest
python-version: '3.10'

steps:
- uses: actions/checkout@v4
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/unittests-openmpi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ on:

jobs:
build:

runs-on: ubuntu-latest
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12']
include:
- operating-system: macos-latest
python-version: '3.12'

- operating-system: ubuntu-latest
python-version: '3.12'

- operating-system: ubuntu-latest
python-version: '3.11'

- operating-system: ubuntu-latest
python-version: '3.10'

steps:
- uses: actions/checkout@v4
Expand Down
5 changes: 4 additions & 1 deletion pylammpsmpi/wrapper/ase.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ def __init__(
log_file=None,
library=None,
diable_log_file=True,
hostname_localhost=False,
):
self._logger = logger
self._prism = None
Expand All @@ -45,7 +46,9 @@ def __init__(
)
else:
self._interactive_library = LammpsBase(
cores=self._cores, working_directory=working_directory
cores=self._cores,
working_directory=working_directory,
hostname_localhost=hostname_localhost,
)

def interactive_lib_command(self, command):
Expand Down
7 changes: 7 additions & 0 deletions pylammpsmpi/wrapper/concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def execute_async(
cmdargs=None,
cores=1,
oversubscribe=False,
hostname_localhost=False,
cwd=None,
):
executable = os.path.join(
Expand All @@ -46,6 +47,9 @@ def execute_async(
cores=cores,
oversubscribe=oversubscribe,
),
hostname_localhost=hostname_localhost,
prefix_name=None,
prefix_path=None,
)
while True:
task_dict = future_queue.get()
Expand All @@ -65,12 +69,14 @@ def __init__(
oversubscribe=False,
working_directory=".",
cmdargs=None,
hostname_localhost=False,
):
self.cores = cores
self.working_directory = working_directory
self._future_queue = Queue()
self._process = None
self._oversubscribe = oversubscribe
self._hostname_localhost = hostname_localhost
self._cmdargs = cmdargs
self._start_process()

Expand All @@ -83,6 +89,7 @@ def _start_process(self):
"cores": self.cores,
"oversubscribe": self._oversubscribe,
"cwd": self.working_directory,
"hostname_localhost": self._hostname_localhost,
},
)
self._process.start()
Expand Down
2 changes: 2 additions & 0 deletions pylammpsmpi/wrapper/extended.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ def __init__(
client=None,
mode="local",
cmdargs=None,
hostname_localhost=False,
):
self.cores = cores
self.working_directory = working_directory
Expand All @@ -259,6 +260,7 @@ def __init__(
oversubscribe=self.oversubscribe,
working_directory=self.working_directory,
cmdargs=cmdargs,
hostname_localhost=hostname_localhost,
)

def __getattr__(self, name):
Expand Down
43 changes: 37 additions & 6 deletions tests/test_ase_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ def test_static(self):
comm=None,
logger=logging.getLogger("TestStaticLogger"),
log_file=None,
library=LammpsLibrary(cores=2, mode="local"),
library=LammpsLibrary(
cores=2,
mode="local",
hostname_localhost=True,
),
diable_log_file=True,
hostname_localhost=True,
)
structure = bulk("Al", cubic=True).repeat([2, 2, 2])
lmp.interactive_structure_setter(
Expand Down Expand Up @@ -84,8 +89,13 @@ def test_small_displacement(self):
comm=None,
logger=logging.getLogger("TestStaticLogger"),
log_file=None,
library=LammpsLibrary(cores=2, mode="local"),
library=LammpsLibrary(
cores=2,
mode="local",
hostname_localhost=True,
),
diable_log_file=True,
hostname_localhost=True,
)
structure = bulk("Al", cubic=True)
lmp.interactive_structure_setter(
Expand Down Expand Up @@ -128,8 +138,13 @@ def test_small_displacement_skewed(self):
comm=None,
logger=logging.getLogger("TestStaticLogger"),
log_file=None,
library=LammpsLibrary(cores=2, mode="local"),
library=LammpsLibrary(
cores=2,
mode="local",
hostname_localhost=True,
),
diable_log_file=True,
hostname_localhost=True,
)
structure = bulk("Al").repeat([2, 2, 2])
lmp.interactive_structure_setter(
Expand Down Expand Up @@ -175,6 +190,7 @@ def test_static_with_statement(self):
log_file=None,
library=None,
diable_log_file=True,
hostname_localhost=True,
) as lmp:
lmp.interactive_structure_setter(
structure=structure,
Expand Down Expand Up @@ -417,8 +433,13 @@ def test_individual_calculation(self):
comm=None,
logger=logging.getLogger("TestStaticLogger"),
log_file=None,
library=LammpsLibrary(cores=2, mode="local"),
library=LammpsLibrary(
cores=2,
mode="local",
hostname_localhost=True,
),
diable_log_file=True,
hostname_localhost=True,
)
lmp.interactive_structure_setter(
structure=structure,
Expand All @@ -442,8 +463,13 @@ def test_interactive_calculation(self):
comm=None,
logger=logging.getLogger("TestStaticLogger"),
log_file=None,
library=LammpsLibrary(cores=2, mode="local"),
library=LammpsLibrary(
cores=2,
mode="local",
hostname_localhost=True,
),
diable_log_file=True,
hostname_localhost=True,
)
for structure in self.structure_lst:
lmp.interactive_structure_setter(
Expand All @@ -468,8 +494,13 @@ def test_interactive_calculation_inverse(self):
comm=None,
logger=logging.getLogger("TestStaticLogger"),
log_file=None,
library=LammpsLibrary(cores=2, mode="local"),
library=LammpsLibrary(
cores=2,
mode="local",
hostname_localhost=True,
),
diable_log_file=True,
hostname_localhost=True,
)
for structure in self.structure_lst[::-1]:
lmp.interactive_structure_setter(
Expand Down
2 changes: 2 additions & 0 deletions tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ def setUpClass(cls):
oversubscribe=False,
working_directory=".",
cmdargs=["-cite", cls.citation_file],
hostname_localhost=True,
)
cls.lmp.file(cls.lammps_file)

Expand All @@ -32,6 +33,7 @@ def test_file_not_found(self):
oversubscribe=False,
working_directory=".",
cmdargs=["-cite", self.citation_file],
hostname_localhost=True,
)
with self.assertRaises(FileNotFoundError):
lmp.file("file_does_not_exist.txt")
Expand Down
1 change: 1 addition & 0 deletions tests/test_concurrent.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def setUpClass(cls):
oversubscribe=False,
working_directory=".",
cmdargs=["-cite", cls.citation_file],
hostname_localhost=True,
)
cls.lmp.file(cls.lammps_file).result()

Expand Down
1 change: 1 addition & 0 deletions tests/test_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def calc_lmp(structure):
log_file=None,
library=None,
diable_log_file=True,
hostname_localhost=True,
)
lmp.interactive_structure_setter(
structure=structure,
Expand Down
Loading