Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A mpi script for calibration #151

Open
zrxdaly opened this issue Sep 24, 2022 · 2 comments
Open

A mpi script for calibration #151

zrxdaly opened this issue Sep 24, 2022 · 2 comments

Comments

@zrxdaly
Copy link

zrxdaly commented Sep 24, 2022

Is your feature request related to a problem? Please describe.
I guess some may also need this to calibrate tons of files, I tested a script for mpi calibration.

  1. install mpi4py: https://mpi4py.readthedocs.io/en/latest/install.html
  2. code example mainly from here https://gist.github.com/joezuntz/7c590a8652a1da6dc4c9:

import dtscalibration
from mpi4py import MPI
...
comm = MPI.COMM_WORLD
rank = MPI.COMM_WORLD.Get_rank()
size = MPI.COMM_WORLD.Get_size()

def cali_fun(file):
    # calibration function

comm.Barrier()

for i, file in enumerate(grouped_files):
    if i%size!=rank: continue
    print("Task number %d being done by processor %d of %d" % (i, rank, size))
    cali_fun(file)
@BSchilperoort
Copy link
Collaborator

Hi Dai, is this script just an example for how other people can do this?

Python also has the built-in multiprocessing module available, in case you just want to split up the jobs on your own machine.

@zrxdaly
Copy link
Author

zrxdaly commented Sep 26, 2022

Hi Dai, is this script just an example for how other people can do this?

Yes, just thought it would be nice to share it here.

Python also has the built-in multiprocessing module available, in case you just want to split up the jobs on your own machine.

Oh nice, just tested it, multiprocessing module is also very handy to use for local machine. Since the data is quite a lot, I use mpi4py in Defltblue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants