Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 726
user3856486 Avatar asked Oct 07 '19 13:10

user3856486


People also ask

Can I run Julia on Google Colab?

Prerequisites Using the Notebook Note to the user Contributors License A notebook for running Julia 1.6.1 on Google Colab using the IJulia package. Why? When I started learning Julia few months back, I searched for an IDE or notebook to run Julia efficiently, but I struggled to get a GPU functioning on my own computer.

What is Google Colab and how does it work?

Google Colab is an entirely new IPython notebook with a virtual kernel as a frontend for computation on Google’s servers. Colab is also free, which puts it ahead of similar services.

What is the easiest way to create a Julia notebook?

The easiest option is to use this Colab notebook template. It supports any Julia version, and also has GPU support. Share Follow answered Jun 23 2020 at 22:34 MiniQuarkMiniQuark

What is the best alternative to Google Colab?

J uliabox is similar to Colab, but rather than running Python, it runs Julia. Just like Colab, JuliaBox is free. Something that I think Google could do better on is scalability. It would be nice to purchase a higher-level version of Colab just for the convenience.


3 Answers

The easiest option is to use this Colab notebook template.

It supports any Julia version, and also has GPU support.

like image 81
MiniQuark Avatar answered Oct 23 '22 01:10

MiniQuark


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!
like image 7
user3856486 Avatar answered Oct 23 '22 03:10

user3856486


In addition to the answer by user3856486: you can now skip the CUDA installation step (mentioned here). That saves a lot of time, especially since you have to rerun these steps whenever you close the notebook/the runtime disconnects.

like image 4
ita Avatar answered Oct 23 '22 02:10

ita