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?