Source code for abed.local
# -*- coding: utf-8 -*-
"""Helper function for local mode
Abed has support for running simulations locally, instead of on a compute
cluster. To facilitate this, some helper functions are needed which deal with
organizing the necessary files. These functions are defined here.
"""
from mpi4py import MPI
from .zips import move_results
[docs]def local_move_results(task_dict):
""" Wrapper around :func:`move_results()` for local mode
This function calls :func:`move_results()`, but ensures that it is only
called by one thread.
Parameters
----------
task_dict : dict
The task dict with all task definitions, as generated by
:func:`init_tasks()`.
"""
# Ensure only one thread executes this function
rank = MPI.COMM_WORLD.Get_rank()
if not rank == 0:
return
move_results(task_dict)