diff --git a/.github/workflows/unittests-mpich.yml b/.github/workflows/unittests-mpich.yml index eaf09c8d..5e9d64a5 100644 --- a/.github/workflows/unittests-mpich.yml +++ b/.github/workflows/unittests-mpich.yml @@ -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 diff --git a/.github/workflows/unittests-openmpi.yml b/.github/workflows/unittests-openmpi.yml index c67080c5..b9880141 100644 --- a/.github/workflows/unittests-openmpi.yml +++ b/.github/workflows/unittests-openmpi.yml @@ -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 diff --git a/pylammpsmpi/wrapper/ase.py b/pylammpsmpi/wrapper/ase.py index c2c91a77..05f99b30 100644 --- a/pylammpsmpi/wrapper/ase.py +++ b/pylammpsmpi/wrapper/ase.py @@ -21,6 +21,7 @@ def __init__( log_file=None, library=None, diable_log_file=True, + hostname_localhost=False, ): self._logger = logger self._prism = None @@ -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): diff --git a/pylammpsmpi/wrapper/concurrent.py b/pylammpsmpi/wrapper/concurrent.py index 4a49834f..fdb43d33 100644 --- a/pylammpsmpi/wrapper/concurrent.py +++ b/pylammpsmpi/wrapper/concurrent.py @@ -31,6 +31,7 @@ def execute_async( cmdargs=None, cores=1, oversubscribe=False, + hostname_localhost=False, cwd=None, ): executable = os.path.join( @@ -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() @@ -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() @@ -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() diff --git a/pylammpsmpi/wrapper/extended.py b/pylammpsmpi/wrapper/extended.py index d9d57239..e5bd833c 100644 --- a/pylammpsmpi/wrapper/extended.py +++ b/pylammpsmpi/wrapper/extended.py @@ -248,6 +248,7 @@ def __init__( client=None, mode="local", cmdargs=None, + hostname_localhost=False, ): self.cores = cores self.working_directory = working_directory @@ -259,6 +260,7 @@ def __init__( oversubscribe=self.oversubscribe, working_directory=self.working_directory, cmdargs=cmdargs, + hostname_localhost=hostname_localhost, ) def __getattr__(self, name): diff --git a/tests/test_ase_interface.py b/tests/test_ase_interface.py index f802f22e..a27d5348 100644 --- a/tests/test_ase_interface.py +++ b/tests/test_ase_interface.py @@ -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( @@ -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( @@ -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( @@ -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, @@ -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, @@ -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( @@ -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( diff --git a/tests/test_base.py b/tests/test_base.py index 88ce7bde..0c12671c 100644 --- a/tests/test_base.py +++ b/tests/test_base.py @@ -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) @@ -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") diff --git a/tests/test_concurrent.py b/tests/test_concurrent.py index 1ffca3c5..9707f823 100644 --- a/tests/test_concurrent.py +++ b/tests/test_concurrent.py @@ -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() diff --git a/tests/test_executor.py b/tests/test_executor.py index 97812951..51e1bd34 100644 --- a/tests/test_executor.py +++ b/tests/test_executor.py @@ -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,