Julia in Colab

Hmm…

using Pkg
Pkg.add("CUDA")
Pkg.add("BenchmarkTools")
using Plots, CUDA, BenchmarkTools

works just fine for me (well aside from the error shown below, but running the usings again works). Additionally, CUDA.versioninfo() works just fine and returns

CUDA runtime 12.6, artifact installation
CUDA driver 12.6
NVIDIA driver 550.54.15

CUDA libraries: 
- CUBLAS: 12.6.4
- CURAND: 10.3.7
- CUFFT: 11.3.0
- CUSOLVER: 11.7.1
- CUSPARSE: 12.5.4
- CUPTI: 2024.3.2 (API 24.0.0)
- NVML: 12.0.0+550.54.15

Julia packages: 
- CUDA: 5.6.1
- CUDA_Driver_jll: 0.10.4+0
- CUDA_Runtime_jll: 0.15.5+0

Toolchain:
- Julia: 1.10.8
- LLVM: 15.0.7

1 device:
  0: Tesla T4 (sm_75, 14.738 GiB / 15.000 GiB available)

Can you provide more details (e.g. the code) on exactly what you’re doing?

Error seen when calling using CUDA on fresh T4 GPU runtime:

InitError: could not load library "/root/.julia/artifacts/ac4708c3ef40405014c1080c17818cfa7d017563/lib/libGL.so"
/root/.julia/artifacts/ac4708c3ef40405014c1080c17818cfa7d017563/lib/libGL.so: undefined symbol: _glapi_tls_Current
during initialization of module Libglvnd_jll


Stacktrace:

  [1] dlopen(s::String, flags::UInt32; throw_error::Bool)

    @ Base.Libc.Libdl ./libdl.jl:117

  [2] dlopen(s::String, flags::UInt32)

    @ Base.Libc.Libdl ./libdl.jl:116

  [3] macro expansion

    @ ~/.julia/packages/JLLWrappers/GfYNv/src/products/library_generators.jl:63 [inlined]

  [4] __init__()

    @ Libglvnd_jll ~/.julia/packages/Libglvnd_jll/rKoF9/src/wrappers/x86_64-linux-gnu.jl:22

  [5] run_module_init(mod::Module, i::Int64)

    @ Base ./loading.jl:1193

  [6] register_restored_modules(sv::Core.SimpleVector, pkg::Base.PkgId, path::String)

    @ Base ./loading.jl:1181

  [7] _include_from_serialized(pkg::Base.PkgId, path::String, ocachepath::String, depmods::Vector{Any})

    @ Base ./loading.jl:1126

  [8] _tryrequire_from_serialized(modkey::Base.PkgId, path::String, ocachepath::String, sourcepath::String, depmods::Vector{Any})

    @ Base ./loading.jl:1551

  [9] _require_search_from_serialized(pkg::Base.PkgId, sourcepath::String, build_id::UInt128)

    @ Base ./loading.jl:1644

 [10] _require(pkg::Base.PkgId, env::String)

    @ Base ./loading.jl:2008

 [11] __require_prelocked(uuidkey::Base.PkgId, env::String)

    @ Base ./loading.jl:1882

 [12] #invoke_in_world#3

    @ ./essentials.jl:926 [inlined]

 [13] invoke_in_world

    @ ./essentials.jl:923 [inlined]

 [14] _require_prelocked(uuidkey::Base.PkgId, env::String)

    @ Base ./loading.jl:1873

 [15] macro expansion

    @ ./loading.jl:1860 [inlined]

 [16] macro expansion

    @ ./lock.jl:267 [inlined]

 [17] __require(into::Module, mod::Symbol)

    @ Base ./loading.jl:1823

 [18] #invoke_in_world#3

    @ ./essentials.jl:926 [inlined]

 [19] invoke_in_world

    @ ./essentials.jl:923 [inlined]

 [20] require(into::Module, mod::Symbol)

    @ Base ./loading.jl:1816

another reason why Interact.jl should be revived :slight_smile:

5 Likes

@metrizable I noticed that Collab comes with a pre-populated default environment. We discourage that for many reasons, partly because it leads to unfortunate interactions when users want to install their own packages.

Admin: How to provide Julia to users? has some more information on that topic (HPC admins also have the initial desire to provide a pre-populated default environment)

I noticed that precompilation times are quite bad, the machines seem to be beefy enough so I wonder if the slow down is some unfortunate interaction with the file system?

Ideally one would be able to have a transparent cache for JULIA_DEPOT_PATH. (~/.julia) (That’s something we do on GitHub actions), and support for Project.toml?

8 Likes

I very much understand where you’re coming from (and thanks for the link to juliahpc; I didn’t know about that), but also think it really depends on use-case. For example, I teach intro physics and have been trying to think of streamlined ways to get Julia into my students hands so I don’t have to say

Okay go download juliaup, then install pluto, then install these packages oh and also this is what an environment is…

So when I heard this news that Colab supports Julia, I was elated because it’s really exactly what I wanted: a preconfigured IDE* (not to mention notebook front-ends are really nice and intuitive for people just starting out), and common packages that can get you really far e.g. Plots, all without downloading or installing anything. So now I can just say

Go to this website. Write using Plots; dom = 0:pi/4:2pi; plot(dom, sin.(dom)). Press Shift+Enter.

and a plot shows up. Essentially making the time-to-first-plot zero.

All to say, I think Colab, while yes it can be used for almost anything, really shines when used in education so e.g. including these packages automatically is such a game changer for the adoption of Julia with new computational scientists.

6 Likes

This is fantastic news, thank you very much !
Any plans to support the latest stable version of Julia ? (Currently 1.11.3).