This is a synchronization library used to synchronize multiple processes in distributed systems.
You can install this package with pip using the following command:
pip install multiprocess-synchronizer
from synchronizer import FileSystemSynchronizer
from multiprocessing import Process
def main(num_processes):
fs_sync = FileSystemSynchronizer('test', rank, world_size)
fs_sync.barrier()
if __name__ == "__main__":
main()
FileSystemSynchronizer(shared_dir, rank, world_size)
Parameters:
- shared_dir: A directory on a shared file system that can be accessed by all processes; this directory must be empty.
- rank: Rank id of the current process.
- world_size: Total number of processes.
You can also use the synchronizer
command:
synchronizer --shared_dir dir --rank 0 --num_processes 1