Skip to content

Commit 7c5c0c6

Browse files
author
jianrui geng
committed
Fix socket docs generation and launcher parsing
1 parent 9f26e9f commit 7c5c0c6

3 files changed

Lines changed: 21 additions & 8 deletions

File tree

docs/advanced/input_files/input-main.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -596,14 +596,12 @@
596596
### socket_driver
597597

598598
- **Type**: Boolean
599-
- **Availability**: *calculation==scf*
600599
- **Description**: If set to True, ABACUS keeps the calculation type as scf and receives atomic positions from an external driver through the i-PI socket protocol.
601600

602601
> Note: Use calculation = scf with socket_driver = True. ABACUS connects to the external i-PI server selected by ABACUS_SOCKET_ADDRESS. If ABACUS_SOCKET_ADDRESS is unset, ABACUS uses localhost:31415. The value can use one of two forms:
603602
604603
- host:port, for example localhost:31415 or 127.0.0.1:31415, opens a TCP connection to that host and port. Use this when the i-PI server listens on a TCP port.
605604
- path:UNIX, for example /tmp/ipi_abacus_si:UNIX, opens a Unix-domain socket at the given filesystem path. The :UNIX suffix tells ABACUS that the preceding value is a local socket path rather than a TCP host name. This form only works on the same machine.
606-
607605
When using the ASE AbacusSocketIO interface, this environment variable is set automatically from the port or unixsocket calculator argument.
608606
- **Default**: False
609607

docs/advanced/interface/ase.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,11 @@ cmake -S . -B build-lcao -DENABLE_MPI=ON -DENABLE_LCAO=ON
119119
cmake --build build-lcao --target abacus_basic_para -j
120120
```
121121

122-
With the ABACUS toolchain workflow, build the normal ABACUS executable with LCAO support when `basis_type=lcao` is needed, then pass that executable to `AbacusProfile(command=...)`. The command can include an MPI launcher, for example `mpirun -np 4 /path/to/abacus`; ABACUS rank 0 opens the socket connection and broadcasts the i-PI data to the other ranks internally. The ASE interface can be installed from this repository with:
122+
With the ABACUS toolchain workflow, build the normal ABACUS executable with LCAO support when `basis_type=lcao` is needed, then pass that executable to `AbacusProfile(command=...)`. The command can include an MPI launcher, for example `mpirun -np 4 /path/to/abacus`; ABACUS rank 0 opens the socket connection and broadcasts the i-PI data to the other ranks internally. On managed clusters, keep scheduler-specific launch options outside the calculator when possible and test the exact launcher command on a compute node.
123+
124+
For PW calculations on CUDA/ROCm with multiple MPI ranks, use a k-point layout compatible with ABACUS' GPU parallelization. In practice, make sure each k-point pool contains one MPI rank; for example, a 4-rank PW GPU socket calculation should use at least four k-points so the default GPU `kpar` adjustment can assign one rank per pool. A one-k-point PW GPU job with several MPI ranks can fail in the PW GPU transform path; reduce the rank count or use a denser k-point mesh such as a smaller `kspacing`.
125+
126+
The ASE interface can be installed from this repository with:
123127

124128
```bash
125129
cd interfaces/ASE_interface

interfaces/ASE_interface/abacuslite/core.py

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,14 @@ def __init__(self,
125125

126126
@staticmethod
127127
def parse_version(stdout) -> str:
128-
# up to the ABACUS version v3.9.0.17, the run of command
129-
# `abacus --version` would returns the information organized
130-
# in the following way:
131-
# ABACUS version v3.9.0.17
132-
return re.match(r'ABACUS version (\S+)', stdout).group(1)
128+
# MPI launchers may add informational lines before ABACUS output.
129+
match = re.search(r'ABACUS version (\S+)', stdout or '')
130+
if match is None:
131+
raise RuntimeError(
132+
'Could not parse ABACUS version from command output. '
133+
'Expected a line like "ABACUS version vX.Y.Z".'
134+
)
135+
return match.group(1)
133136

134137
def get_calculator_command(self, inputfile) -> List[str]:
135138
# because ABACUS run in the folder where there are INPUT files, so the
@@ -778,6 +781,14 @@ def test_socketio_rejects_cell_changes(self):
778781
with self.assertRaisesRegex(PropertyNotImplementedError, 'fixed-cell'):
779782
calc._check_fixed_cell(changed)
780783

784+
def test_parse_version_allows_launcher_noise(self):
785+
stdout = 'launcher info\nABACUS version v3.11.0-beta6\n'
786+
self.assertEqual(AbacusProfile.parse_version(stdout), 'v3.11.0-beta6')
787+
788+
def test_parse_version_rejects_missing_version(self):
789+
with self.assertRaisesRegex(RuntimeError, 'ABACUS version'):
790+
AbacusProfile.parse_version('launcher failed before abacus started')
791+
781792
def test_calculator_results(self):
782793
from ase.build.bulk import bulk
783794
silicon = bulk('Si', crystalstructure='diamond', a=5.43)

0 commit comments

Comments
 (0)