This template helps you setup julia on google colab
MIT License
Google Colab is great, Julia is great, we should have both.
Steps to run:
julia.ipynb
file on your colab. Here's the quick link for CPU runtime and GPU runtime
What's behind the scenes, a step by step explanation:
julia.ipynb
file predefines "julia"
kernel. You can find this by checking in raw format
julia.ipynb
requires. But unfortunately this will fail, so colab falls back to using the Python kernel!
)julia
kernel. But since we have it installed in the current runtime, this time it will succeed.Because the julia
kernelspec is not available by default, you will need to install Julia kernel everytime when you start a new colab runtime.
For GPU runtimes, it seems that when you refresh the page via "Ctrl-R" colab will redirect you to the CPU runtimes and thus you lose the Julia kernel. I don't know the internal but this is perhaps a colab strategy to save GPU resource. To fix it, instead of manually refreshing page via "Ctrl-R", you can instead trigger kernel reloading by:
This trick works when I write it up, I hope this still works in the future.
It's also worth noting that you can force CUDA.jl to use system-installed CUDA library by setting
environment variable JULIA_CUDA_USE_BINARYBUILDER
to false
. This saves a lot of downloading time.