juliagpugoogle-colaboratory

Julia in Google Colab


I am trying to setup Julia with Google Colab. Installation instructions as in https://discourse.julialang.org/t/julia-on-google-colab-free-gpu-accelerated-shareable-notebooks/15319 have been followed. Despite that, I am unable to launch Julia.

I am trying to use Julia with Google Colab. I followed the following steps:

  1. Install CUDA
!wget https://developer.nvidia.com/compute/cuda/9.0/Prod/local_installers/cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
!dpkg -i cuda-repo-ubuntu1604-9-0-local_9.0.176-1_amd64-deb
!apt-key add /var/cuda-repo-9-0-local/7fa2af80.pub
!apt update -q
!apt install cuda gcc-6 g++-6 -y -q
!ln -s /usr/bin/gcc-6 /usr/local/cuda/bin/gcc
!ln -s /usr/bin/g++-6 /usr/local/cuda/bin/g++
  1. Install Julia 1.2.0
!curl -sSL "https://julialang-s3.julialang.org/bin/linux/x64/1.2/julia-1.2.0-linux-x86_64.tar.gz" -o julia.tar.gz
!tar -xzf julia.tar.gz -C /usr --strip-components 1
!rm -rf julia.tar.gz*
!julia -e 'using Pkg; pkg"add IJulia; add CuArrays; add Flux; precompile"'

The above two steps run perfectly fine. I am unable to initiate a Julia session. I tried:


!julia

With this, the Julia start-up screen keeps showing with no command-line.


Solution

  • Turns out that it was just the sequence of steps that was wrong. Very helpful video posted https://www.youtube.com/watch?v=xpZo3L2dYTY. Just to reiterate:

    1. Save the following as .ipynb file, and upload it on Google Colab:
    
    {
      "nbformat": 4,
      "nbformat_minor": 0,
      "metadata": {
        "colab": {
          "name": "Julia on Colab.ipynb",
          "version": "0.3.2",
          "provenance": []
        },
        "kernelspec": {
          "name": "julia-1.2",
          "display_name": "Julia 1.2"
        },
        "accelerator": "GPU"
      },
      "cells": [
        {
          "metadata": {
            "id": "oMSuTc3pDlHv",
            "colab_type": "code",
            "colab": {}
          },
          "cell_type": "code",
          "source": [
            ""
          ],
          "execution_count": 0,
          "outputs": []
        }
      ]
    }
    
    1. Install CUDA in the same notebook using the commands mentioned in the question.
    2. Install Julia 1.2.0 in the same notebook using the commands mentioned above.
    3. Configure the settings as demonstrated in the video and you are all set!