# Start Julia via SLURM batch script on remote node

**URL:** <https://discourse.julialang.org/t/start-julia-via-slurm-batch-script-on-remote-node/33885>\
**Category:** New to Julia\
**Created:** [January 28, 2020, 10:02am UTC](https://discourse.julialang.org/t/start-julia-via-slurm-batch-script-on-remote-node/33885 "2020-01-28T10:02:12Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![LysandrosAn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lysandrosan/32/12528_2.png) [@LysandrosAn](https://discourse.julialang.org/u/LysandrosAn)\
**Post date:** [January 28, 2020, 10:02am UTC](https://discourse.julialang.org/t/start-julia-via-slurm-batch-script-on-remote-node/33885/1 "2020-01-28T10:02:12Z")

</div>

Hello together,  
for numerical integration of ODEs I am intending to use an external high-performance-computing centre, where one can deploy code. Although the admins installed julia there, I can’t seem to kick it off via the batch script. I guess I am missing something about the modules or the directory:

```julia
## LOAD MODULES ##
module purge # clean up loaded modules 
# load necessary modules
module load intel/18.0.5
module load gnu/4.9.2
module load java/9.0
module load julia

## RUN CODE ##
julia LAfem.jl 

```

even the simplest code in the .jl file is generating an permission error message. If I try ` pwd()` there is no response. Is there a clever way to investgate the cause?

Thanks, kind regards  
Lysandros

---

<div class="post-metadata">

**Author:** ![traktofon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/traktofon/32/591_2.png) [@traktofon](https://discourse.julialang.org/u/traktofon)\
**Post date:** [January 28, 2020, 11:44am UTC](https://discourse.julialang.org/t/start-julia-via-slurm-batch-script-on-remote-node/33885/2 "2020-01-28T11:44:53Z")

</div>

It’s hard to give specific advice without seeing the details of the error message. Are you trying to install packages? Do the errors happen perhaps during precompilation? Depending on how julia was installed, and on what environment variables the module sets, it’s possible that your julia process tries to write into the common julia install (which of course mustn’t be allowed).

It might be worth trying to just install julia in your own account. The binary distribution should work fine on standard x86\_64 clusters, just make sure that the `julia` binary is in your `PATH`. If you have limited space in your home directory but have access to a global scratch directory (a common scenario on HPC clusters) then you might need to put the julia install onto the scratch space, and probably also the `.julia` directory (and then make a symlink `~/.julia` to it).

---

<div class="post-metadata">

**Author:** ![KajWiik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kajwiik/32/199_2.png) [@KajWiik](https://discourse.julialang.org/u/KajWiik)\
**Post date:** [January 28, 2020, 2:00pm UTC](https://discourse.julialang.org/t/start-julia-via-slurm-batch-script-on-remote-node/33885/3 "2020-01-28T14:00:16Z")

</div>

Here’s how I set up Julia in a cluster, this also sets up CUDA but you can ignore that.

> [@Failed to load \`CUDAdrv\`](https://discourse.julialang.org/t/failed-to-load-cudadrv/32524/4):
>
> See e.g. Here’s how I compiled and tested Julia CUDA libraries in our cluster: mkdir bin; cd bin curl -o julia-1.3.0-linux-x86\_64.tar.gz https://julialang-s3.julialang.org/bin/linux/x64/1.3/julia-1.3.0-linux-x86\_64.tar.gz tar xzvf julia-1.3.0-linux-x86\_64.tar.gz module add CUDA ln -s julia-1.3.0 julia julia/bin/julia ] pkg\> add CUDAapi CUDAdrv CUDAnative CuArrays BenchmarkTools DiffResults ForwardDiff Compat cat \> buildcuarrays.jl using Pkg Pkg.test("CuArrays") srun -p gpu --mem=50G --time=…

---

<div class="post-metadata">

**Author:** ![tbeason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tbeason/32/15898_2.png) [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Post date:** [January 28, 2020, 4:29pm UTC](https://discourse.julialang.org/t/start-julia-via-slurm-batch-script-on-remote-node/33885/4 "2020-01-28T16:29:14Z")

</div>

Are you able to start interactive jobs on your HPC cluster? I would suggest doing that and seeing if you can start Julia, add packages via REPL, run some basic commands, etc. first. If you get errors there then at least you can dig around to figure out what is causing it.

---

<div class="post-metadata">

**Author:** ![LysandrosAn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lysandrosan/32/12528_2.png) [@LysandrosAn](https://discourse.julialang.org/u/LysandrosAn)\
**Post date:** [January 28, 2020, 6:35pm UTC](https://discourse.julialang.org/t/start-julia-via-slurm-batch-script-on-remote-node/33885/5 "2020-01-28T18:35:17Z")

</div>

Thanks KajWiik. Should I place  
the

```julia
julia/bin/julia

```

inside the batch script for running Julia code? Because this generates the error:

```julia
/var/spool/slurmd/job830162/slurm_script: line 36: julia/bin/julia: No such file or directory

```

Should it be inside the .jl file instead?

---

<div class="post-metadata">

**Author:** ![LysandrosAn](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lysandrosan/32/12528_2.png) [@LysandrosAn](https://discourse.julialang.org/u/LysandrosAn)\
**Post date:** [January 28, 2020, 6:43pm UTC](https://discourse.julialang.org/t/start-julia-via-slurm-batch-script-on-remote-node/33885/6 "2020-01-28T18:43:49Z")

</div>

I am able to start jobs on the HPC only via batch script with Octave, not Julia yet. I think it does not support REPL. For the moment, my SLURM batch script is:

```julia
#!/bin/bash -l

####################################

## LOAD MODULES ##
module purge # clean up loaded modules 

# load necessary modules
module load intel/18.0.5
module load gnu/4.9.2
module load java/9.0
module load julia

## RUN CODE ##
date
julia LAfem.jl 
date

```

and inside the LAfem.jl, the only line is:

```julia
using Pkg

```

, in order to see if this runs. But this generates the error:

```julia
ERROR: LoadError: IOError: stat: permission denied (EACCES) for file "/users/apps/compilers/julia/1.3.1/share/julia/stdlib/v1.3/Pkg/src/Pkg.jl"
Stacktrace:
 [1] stat(::String) at ./stat.jl:69
 [2] isfile at ./stat.jl:311 [inlined]
 [3] isfile_casesensitive at ./loading.jl:9 [inlined]
 [4] entry_point_and_project_file_inside at ./loading.jl:438 [inlined]
 [5] entry_point_and_project_file(::String, ::String) at ./loading.jl:453
 [6] implicit_project_deps_get at ./loading.jl:605 [inlined]
 [7] project_deps_get(::String, ::String) at ./loading.jl:308
 [8] identify_package(::String) at ./loading.jl:220
 [9] identify_package(::Base.PkgId, ::String) at ./loading.jl:206
 [10] identify_package at ./loading.jl:200 [inlined]
 [11] require(::Module, ::Symbol) at ./loading.jl:882
 [12] include at ./boot.jl:328 [inlined]
 [13] include_relative(::Module, ::String) at ./loading.jl:1105
 [14] include(::Module, ::String) at ./Base.jl:31
 [15] exec_options(::Base.JLOptions) at ./client.jl:287
 [16] _start() at ./client.jl:460
in expression starting at /users/pa19/lanast/taskp/LAfem.jl:1

```

Are there alternatives to check the actual status (root directory, what packages are installed), or other information?

Thanks tbeason

---

<div class="post-metadata">

**Author:** ![KajWiik](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kajwiik/32/199_2.png) [@KajWiik](https://discourse.julialang.org/u/KajWiik)\
**Post date:** [January 28, 2020, 6:50pm UTC](https://discourse.julialang.org/t/start-julia-via-slurm-batch-script-on-remote-node/33885/7 "2020-01-28T18:50:10Z")

</div>

Sorry, my post was bit cryptic.  
No, that line is just starting julia to add CUDA packages.

You should add ~/bin/julia/bin to your path or make a softlink so that the system can find the julia binary.
