Parallelism in irace at Compute Canada

57 views
Skip to first unread message

Sarah Lee

unread,
Mar 9, 2023, 1:14:55 PM3/9/23
to The irace package: Iterated Racing for Automatic Configuration
Hi there,

I am sorry about asking another question regarding irace. I would like to use parallel computing for irace at Compute Canada. I checked some references online and it seems there are several options to do so, including using batchmode, mpi, batchtools etc. 

Among all of these, I wonder which one is the best/most efficient option. By being efficient, I mean that there will be less coding and possibly more interpretable. When I read the target_runner_slurm file under batchmode-cluster folder, I feel really confused and don't know how to implement it on Compute Canada. If there is an option that is easier to implement, for example, batchtools, is there any example recommended on how to use that at Compute Canada? 

Thank you very much!

Best regards,

Sarah Lee 

Manuel López-Ibáñez

unread,
Mar 10, 2023, 4:41:55 AM3/10/23
to The irace package: Iterated Racing for Automatic Configuration
Hi Sarah Lee,

I don't know how Compute Canada works, so I cannot tell you how to do it. But the easiest is probably to use just the --parallel option without anything else and submit "irace" as a job (how to do the latter depends on how Compute Canada works). This way you do not need to modify your target-runner in any way. The downside is that you will be limited by the maximum number of CPUs of a single machine in the cluster.

It may be better to ask someone who is working with ComputeCanada about how to setup the job script. this and give them to read the section about Parallelization in the user-guide: https://mlopez-ibanez.github.io/irace/irace-package.pdf

Best regards,

Manuel. 

Sarah Lee

unread,
Mar 12, 2023, 7:07:13 PM3/12/23
to The irace package: Iterated Racing for Automatic Configuration
Hi Manuel,

Ok, I will ask someone working there for the script. Thanks very much!

Best,

Sarah Lee

Sarah Lee

unread,
Mar 21, 2023, 12:27:57 PM3/21/23
to The irace package: Iterated Racing for Automatic Configuration
Hi Manuel,

I tried to use mpirun with the --parallel option in the job script on compute canada, but it couldn't work. I executed it with an R script that included data loading, target.runner function, scenario and parameter lists. It worked fine on my local machine, but is it the right way to run irace in Linux? 

Also, I noticed that in the irace/bin folder, there is a file called "parallel-irace-slurm", and in the irace/examples/batchmode-cluster, there is "target-runner-slurm" file. Both look like bash scripts. I wonder which one should be used for compute canada, which should depend on slurm cluster. 

In addition to the bash script, is it possible to run the R script in Linux, or do I have to divide it into several files, while each contains one info (parameter list/scenario list/target.runner function)? 

There are really not many examples online for this. I really appreciate your help and advice.

Best,
Sarah Lee

On Friday, March 10, 2023 at 2:41:55 AM UTC-7 Manuel López-Ibáñez wrote:

Manuel López-Ibáñez

unread,
Mar 21, 2023, 1:16:42 PM3/21/23
to The irace package: Iterated Racing for Automatic Configuration
On Tuesday, 21 March 2023 at 16:27:57 UTC sarahk...@gmail.com wrote:
Hi Manuel,

I tried to use mpirun with the --parallel option in the job script on compute canada, but it couldn't work. I executed it with an R script that included data loading, target.runner function, scenario and parameter lists. It worked fine on my local machine, but is it the right way to run irace in Linux?

I personally would find easier to run irace via the command-line irace and put the various bits and pieces in different files as the command-line irace executable expects. This is what the script https://github.com/MLopez-Ibanez/irace/blob/master/inst/bin/parallel-irace-mpi uses.

Alternatively, you can put everything together in one .R file that calls irace() (or irace.main()) and run the .R file using Rscript (https://stat.ethz.ch/R-manual/R-devel/library/utils/html/Rscript.html), but you need still a bash script to set the options needed for SLURM and MPI and call Rscript from bash.
 
Also, I noticed that in the irace/bin folder, there is a file called "parallel-irace-slurm", and in the irace/examples/batchmode-cluster, there is "target-runner-slurm" file. Both look like bash scripts. I wonder which one should be used for compute canada, which should depend on slurm cluster.

Probably the most useful for you is https://github.com/MLopez-Ibanez/irace/blob/master/inst/bin/parallel-irace-slurm. This is launching the command-line irace via slurm. You could replace the command-line irace with "Rscript yourscript.R".

But you sill need to modify it to setup MPI (by calling mpirun or setting some options). You may need also to change the SLURM options that do not apply to your cluster.

What to change is difficult to say as different clusters require difference commands and options. You may need to load some module to activate R or install extra packages. You need to read the documentation provided and/or contact someone from the support staff in Compute Canada. Surely, you are not the only person running R scripts using MPI.
 
In addition to the bash script, is it possible to run the R script in Linux, or do I have to divide it into several files, while each contains one info (parameter list/scenario list/target.runner function)?

You can run an .R script in Linux with Rscript myscript.R. You can define everything within myscript.R and not use any extra files if you wish to do that.
 
There are really not many examples online for this. I really appreciate your help and advice.

It would be great to have more examples. Unfortunately, I rely on users to send me examples for the systems that I don't use. The github repository contains  the examples that I'm aware of.

Good luck!

Manuel.

Sarah Lee

unread,
Mar 26, 2023, 10:29:04 PM3/26/23
to The irace package: Iterated Racing for Automatic Configuration
Hi Manuel,

Thank you for your detailed reply. It now works out!

Best,

Sarah

Manuel López-Ibáñez

unread,
Apr 3, 2023, 6:51:25 AM4/3/23
to The irace package: Iterated Racing for Automatic Configuration
Dear Sarash,

Would it be possible to share your setup? I think it would be helpful for other users. I  don't need the code to your algorithm or the instances, only the scripts that you use to launch irace, the target-runner (and target-evaluator if you use that), and the scenario.txt (if you use that).

Thanks,

Manuel.

Sarah Lee

unread,
Apr 3, 2023, 1:08:49 PM4/3/23
to The irace package: Iterated Racing for Automatic Configuration
Hello Manuel,

Sure, I'd love to share it. Do I need to share it here or make it public in another place? 

Best,
Sarah

Manuel López-Ibáñez

unread,
Apr 3, 2023, 1:12:42 PM4/3/23
to The irace package: Iterated Racing for Automatic Configuration
Dear Sarah,

You can share them here if you wish or send them to my email address and I will upload them to the git repository: https://github.com/MLopez-Ibanez/irace

Please, only the scripts and text files for setting up and launching irace (no datasets no code for your own algorithm).

Cheers,

Manuel.

Sarah Lee

unread,
Apr 3, 2023, 5:52:04 PM4/3/23
to The irace package: Iterated Racing for Automatic Configuration
Hi Manuel,

I have sent it to your email.

Cheers,

Sarah
Reply all
Reply to author
Forward
0 new messages