# Best practices for single script files

**URL:** https://discourse.julialang.org/t/best-practices-for-single-script-files/110258
**Category:** Performance
**Created:** [February 15, 2024, 3:43pm UTC](https://discourse.julialang.org/t/best-practices-for-single-script-files/110258 "2024-02-15T15:43:25Z")
**Posts on this page:** 1
**Showing post:** 9

<div class="post-metadata">

### Author: ![goerz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/goerz/32/3269_2.png) [@goerz](https://discourse.julialang.org/u/goerz)
#### Post date: [February 16, 2024, 8:25pm UTC](https://discourse.julialang.org/t/best-practices-for-single-script-files/110258/9 "2024-02-16T20:25:04Z")

</div>

If you search this forum, you will find previous threads on using Julia on a cluster, e.g.,

> [@Julia on a cluster using SLURM, dependencies](https://discourse.julialang.org/t/julia-on-a-cluster-using-slurm-dependencies/89737/10):
>
> Do I need my script to call the project module? That is do I need it to be of the form module TestProject greet() = print(“Hello World!”) using Statistics using Distributions open(“./testing\_write\_proj.txt”, “w”) do file write(file, “worked 1:03 edit”) end end # module TestProject

> [@How to run Julia on Cluster?](https://discourse.julialang.org/t/how-to-run-julia-on-cluster/56551/6):
>
> This is what the last two lines in my example accomplish: I upload the code to the project directory with rsync. That way, I have a Project.toml and Manifest.toml in place that match my (tested) local version of the code. All the jl file needs to do then is using Pkg Pkg.instantiate() # in case some package is missing on the remote using MyPackage command\_I\_want\_to\_run()

You will also find general documentation on the web, e.g.,

> **[SLURM Job Array Julia Example | RCpedia](https://rcpedia.stanford.edu/topicGuides/jobArrayJuliaExample.html)**
>
> Site / page description

> **[Julia on the HPC Clusters](https://researchcomputing.princeton.edu/support/knowledge-base/julia)**
>
> This page describes getting started with running Julia on the HPC clusters.

> **[Using Julia](https://www.carc.usc.edu/user-information/user-guides/software-and-programming/julia/)**
>
> USC's Center for Advanced Research Computing supports computational research and data-driven solutions.

Lastly, the HPC staff of the cluster you’re planning to use should be able to give you advice for their specific system.

My general recommendation was that your job script should only call `julia` once. Beyond that, calling `julia` on the cluster isn’t that much different from running it on your workstation. Except maybe that you should be more aware of the exact resources you’re going to use, and carefully manage the number of processes/threads. The `JULIA_EXCLUSIVE` environment variable might be useful on a cluster.

---

_[View the full topic](https://discourse.julialang.org/t/best-practices-for-single-script-files/110258)._
