Remi.b
Remi.b

Reputation: 18219

Run Julia codes on a cluster

I aim to run some Julia-coded simulations on a cluster (no complicated parallel processing involved) using a .pbs file (and qsub)

I know two ways to run a .jl file from the Bash. The first one is

/path/to/julia myscript.jl

The second one is

exec '/Applications/bla/bla/julia/bin/julia'
include("myscript.jl")

Here is my .pbs file. I cannot test if it works because I don't know yet where the Julia application is stored on the cluster.

#!/bin/bash
#PBS -l procs=1
#PBS -l walltime=240:00:00
#PBS -N Name
#PBS -m ea
#PBS -M [email protected]
#PBS -l pmem=1000mb
#PBS -t 1-3
echo "Starting run at: `date`"
exec '/Applications/bla/bla/julia/bin/julia'
include("myscript.jl")
echo "Job finished with exit code $? at: `date`"

Does it seem correct to you? Or should I, somehow, make an .exec out of my .jl?

Upvotes: 1

Views: 889

Answers (1)

Jarvist
Jarvist

Reputation: 26

You want to directly execute Julia, with your .jl program file as an argument.

Something like:

echo "Starting run at: `date`"
/Applications/bla/bla/julia/bin/julia myscript.jl
echo "Job finished with exit code $? at: `date`"

PBS will catch the standard out and put it in a file such as .pbs.o#### (similarly the standard error in .pbs.e####).

You might find an issue in where your 'present working directory' is when the script runs. Some clusters are setup to 'cd' you to a /tmp/ filesystem, or just drop you in your home directory, rather than being where the script was submitted from.

In that case, the simple solution is to use a full path for the Julia script, but this makes it difficult to reuse your PBS submission script.

/Applications/bla/bla/julia/bin/julia ~/mydirectory/myscript.jl

Upvotes: 1

Related Questions