Running a single Julia script simultaneously on different workers, each with different input parameters

rachithaiyappa
Thu, 05 Aug 2021 18:01:29 +0000
General Usage

I’m trying to run a script main.jl simultaneously on multiple workers, each worker having a different input parameter for the script. The skeleton code looks something like this. This results in a could not open file error where it treats, for example, julia --project=. main.jl -p 1 as a file instead of a command to be executed on the specific worker. Any suggestions on how to do this?

using Distributed
using IterTools
using StatsBase
addprocs(3)
parameters = collect(LinRange(1,3,2))
processes = collect(((round(i[1],digits=2),"main.jl") for i in parameters))
processes = collect("julia --project=. $(process[2]) -p1 $(process[1])" for process in processes)
pmap(include,processes)

The above script is similar to this answer
I suspect the pmap(include,processes) is not the right way to do it in my case?

1 post - 1 participant