Running Julia programs
Julia scripts and hyper parameter sweeps can be run in Grid easily using CLI or the web UI. Both CPU and GPU instances are supported with all necessary system drivers pre-installed and set up, so you can take advantage of multiprocessing and compute acceleration hardware with no additional configuration.
Step 0 Prepare script
- Have the Julia script available on Github
- Make sure the Julia script is invocable via the command line. No changes to your code are required when running on Grid
- Julia scripts must be named with the suffix .jl
- If any dependencies are required, the git repo must contain a valid Project.toml file which has been generated by the Julia standard library pkg manager utility.
- Optionally, you can test by creating an Interactive Session in Grid and running your script there
Step 1 Run on Grid
- Start the Grid platform at platform.grid.ai
- In the Web UI, choose “New Run”
- Copy and paste the Github script or select the entry file in the dropdown menu
- Select Julia from the “framework” drop down option
- Add any script arguments
- If the script accepts command line arguments, you can submit a hyperparameter sweep in the same way you do for a python based run
Step 2 See results
- Any text sent to stdout from the Julia program will be available in the Stdout log
- Any artifacts written in the main program directory are automatically preserved
- If you are able to view Tensorboard logs then metrics are available in the Web UI as well as any artifacts
Note: The first time you run a Julia file, it will take a bit longer; you can track progress in Build logs
Step 3: Bonus CLI Examples
Script1: https://github.com/rlizzo/julia_binder_test/blob/master/demo.jl
Script arguments: --num "[10,100,1000,10000]"
git clone https://github.com/rlizzo/julia_binder_test
cd julia_binder_test
grid run --instance_type t2.medium \
--framework julia \
--use_spot \
--cpus 1 \
demo.jl \
--num "[10,100,1000,10000]"
Script2: https://github.com/rlizzo/TuringCLIExample/blob/main/fit.jl
Script arguments: --num_samples "[10,100,1000,10000]"
git clone https://github.com/rlizzo/TuringCLIExample
cd TuringCLIExample
grid run --instance_type t2.medium \
--framework julia \
--use_spot \
--cpus 1 \
fit.jl \
--num_samples 100
Notes and limitations:
- Please be aware that following environment variables pertinent to the julia runtime configuration are set automatically before the script is invoked.
- JULIA_PROJECT="@." where the current working directory is the root of your cloned repository.
- JULIA_NUM_THREADS where the value is set to the number of CPUs you dedicate to each experiment.
The two environment variables above are equivalent to invoking a julia script with the following configuration options:
julia --project=@. --threads auto <YOUR JULIA SCRIPT NAME>.jl
- At this time, we only support the latest release of the Julia language (v1.6.1) please ensure that 1.6.1 is compatible with the Julia version specified in the [compat] section of the repository's Project.toml.