Parallel calculations¶
ASE will automatically run in parallel, if it can import an MPI communicator from any of the supported libraries. ASE will attempt to import communicators from these external libraries: GPAW, Asap, Scientific MPI and MPI4PY.
If a parallel library is found, the ase.io.read()
function will always
read only on master (of the MPI world object) and broadcast the atoms to all
other cores. Therefore, always when using ase.io.read()
, all cores must
read the same atoms in same order, for example in the case of a NEB
calculation.
If one requires an individual core/cores to read a particular file, please
use Trajectory()
:
>>> from ase.io import Trajectory
>>> from ase.parallel import world
>>> atoms = Trajectory('myfile_{}.traj'.format(world.rank))[-1]
- ase.parallel.paropen(name, mode='r', buffering=-1, encoding=None, comm=None)[source]¶
MPI-safe version of open function.
In read mode, the file is opened on all nodes. In write and append mode, the file is opened on the master only, and /dev/null is opened on all other nodes.
- ase.parallel.broadcast(obj, root=0, comm=<ase.parallel.MPI object>)[source]¶
Broadcast a Python object across an MPI communicator and return it.