SLURM: Julia scripts do not exit or produce any output

Dear Julia community,

After successfully experimenting with Julia on my local machine, I am trying to get it to work on a cluster running SLURM.
After submitting a batch script (see below for an example) the job gets started and just continues sitting on the nodelist without actually doing anything. I do not get any output or error message until the job time runs out.
When trying to identify the problem, I have reduced my script to the most minimal (not-) working example
batch script:

#SBATCH --nodes=1
#SBATCH --ntasks=1
#SBATCH --mem-per-cpu=15
#SBATCH --qos=hiprio
#SBATCH --time=00:02:00          # total run time limit (HH:MM:SS)
#SBATCH --output=/home/<user>/Julia/jultest.out  #where <user> is my username
#SBATCH --error=/home/<user>/Julia/jultest.err

module purge
module load Julia
cd /home/<user>/Julia
srun julia test.jl

# Filename: test.jl

I am now completely at a loss how I can continue from here.
A while ago, I have tested a more involved script on two nodes with success which I found online, but now that also does not work any more. I am starting to think that it might not be a Julia problem but rather a cluster-specific issue. If I run the script from the shell it works fine. Does anyone have a good minimal working example or see anything wrong with the way I am submitting my job?
(My actual goal was to run a multithreaded program with Threads.@threads on a single node)

Thank you for reading until here, I hope you can help me!

Hi !
I use julia on a slurm cluster with Threads.@threads on a single node, this is my SBATCH

#SBATCH -J AnovaCluster
#SBATCH -n 1 
#SBATCH --threads-per-core=1
#SBATCH --cpus-per-task=36
#SBATCH --time=03:10:00
#SBATCH --mail-user=xxx@yyy
#SBATCH --mail-type=ALL

module load julia/curr

cd ${workdir}


julia main.jl

And to start calculation : sbatch

This is likely because of buffering. You can try to explicitly flush the output or write to stderr (which I think is unbuffered).

Thank you, I found my issue!
it seems like the

#SBATCH --cpus-per-task= ...

line was essential, (I feel slightly embarrassed although I would have expected an error message in that case). Adding this line to my batch caused the script to finish and produce output.
As a side-note, threads also seem to work as intended.

Thank you a lot for your help!

Thank you for the idea, the solution turned out to be more trivial than that. (Actually for the very short script the output is probably flushed at the end anyways, so it doesnt matter here, might help in some other cases though :smile:).