Since Windows 10 1703 (Creators Update, available since April 6th 2017 or so) ,the Windows-Subsystem-Linux (WSL) provides the opportunity to use a fully featured Linux environment natively on Windows. Although in principle available since roughly two years, the Creators Update resolves the previously lacking symbolic links capability on Windows and allows an update to Ubuntu Xenial 16.04.
Consequently, one may also choose to run the Linux version of Julia on Windows, potentially giving a richer development experience.
Note that WSL is not a virtual machine; the Linux kernel functions are directly mapped to the Windows kernel, thereby allowing essentially any native Linux binary to be directly run on Windows – as long as it doesn’t require X windows. Luckily, Julia has an excellent REPL for the terminal.
Take a look at the detailed description of Bash on Ubuntu on Windows (Microsoft Developer Network)
Make it so…
Requirements
- Windows 10 (64-bit) version 1703 (Creators Update) or newer, and
- Local administrator priviledges to install Bash on Windows, or
- already installed Bash on Windows with Ubuntu Xenial 16.04 or newer.
Installation
-
Follow the Installation Guide of Bash on Windows.
-
Verify that you have Ubuntu Xenial 16.04 installed by opening Bash on Windows from the start menu and type
user@host:~$ cat /etc/lsb-release DISTRIB_ID=Ubuntu DISTRIB_RELEASE=16.04 DISTRIB_CODENAME=xenial DISTRIB_DESCRIPTION="Ubuntu 16.04.2 LTS"
If you have an older release, type
do-release-upgrade
and follow the instructions. -
Download and extract the Julia archive to your user’s home directory, here we choose the Generic Linux Binaries of Julia 0.5.1:
user@host:~$ cd ~ user@host:~$ sudo apt get wget user@host:~$ wget https://julialang.s3.amazonaws.com/bin/linux/x64/0.5/julia-0.5.1-linux-x86_64.tar.gz user@host:~$ tar xzvf julia-0.5.1-linux-x86_64.tar.gz
Energize…
There should now be a subdirectory starting with julia-
and followed by the Git commit hash of the release. Here, we assume this exact directory name is julia-6445c82d00
.
user@host:~$ ls -d julia-*
julia-0.5.1-linux-x86_64.tar.gz* julia-6445c82d00/
Now it’s time to start the Julia REPL
user@host:~$ julia-6445c82d00/bin/julia
and see the magic happen:
_
_ _ _(_)_ | A fresh approach to technical computing
(_) | (_) (_) | Documentation: http://docs.julialang.org
_ _ _| |_ __ _ | Type "?help" for help.
| | | | | | |/ _` | |
| | |_| | | | (_| | | Version 0.5.1 (2017-03-05 13:25 UTC)
_/ |\__'_|_|_|\__'_| | Official http://julialang.org/ release
|__/ | x86_64-pc-linux-gnu
julia> peakflops()
1.9908520348996365e10
julia> versioninfo()
Julia Version 0.5.1
Commit 6445c82 (2017-03-05 13:25 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i5-2520M CPU @ 2.50GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Sandybridge)
LAPACK: libopenblas64_
LIBM: libopenlibm
LLVM: libLLVM-3.7.1 (ORCJIT, sandybridge)
julia> 1+2
3
julia>
Hit <CTRL>+D
to exit Julia.
Engage…
To make sure everything is alright, let’s run the full Julia test suite.
Unfortunately, there seems to be some issue regarding multi-threading, so
lets fall back to single core:
help?> Base.runtests
runtests([tests=["all"] [, numcores=ceil(Integer, Sys.CPU_CORES / 2) ]])
Run the Julia unit tests listed in tests, which can be either a string or
an array of strings, using numcores processors. (not exported)
julia> Base.runtests("all", 0)
* linalg/triangular in 343.51 seconds, maxrss 637.77 MB
* linalg/qr in 61.01 seconds, maxrss 749.48 MB
* linalg/dense in 31.24 seconds, maxrss 784.41 MB
* linalg/matmul in 125.35 seconds, maxrss 852.55 MB
* linalg/schur in 6.61 seconds, maxrss 862.48 MB
* linalg/special in 2.57 seconds, maxrss 869.45 MB
* linalg/eigen in 26.10 seconds, maxrss 880.37 MB
* linalg/bunchkaufman in 18.99 seconds, maxrss 887.07 MB
* linalg/svd in 11.31 seconds, maxrss 898.15 MB
* linalg/lapack in 30.40 seconds, maxrss 907.11 MB
* linalg/tridiag in 23.49 seconds, maxrss 907.44 MB
* linalg/bidiag in 22.15 seconds, maxrss 921.24 MB
* linalg/diagonal in 32.28 seconds, maxrss 928.46 MB
* linalg/pinv in 6.56 seconds, maxrss 1014.12 MB
* linalg/givens in 5.54 seconds, maxrss 1014.12 MB
* linalg/cholesky in 22.80 seconds, maxrss 1014.12 MB
* linalg/lu in 24.52 seconds, maxrss 1014.12 MB
* linalg/symmetric in 11.90 seconds, maxrss 1014.12 MB
* linalg/generic in 7.63 seconds, maxrss 1014.23 MB
* linalg/uniformscaling in 34.96 seconds, maxrss 1017.74 MB
* linalg/lq in 43.18 seconds, maxrss 1048.18 MB
* linalg/hessenberg in 0.89 seconds, maxrss 1048.48 MB
* linalg/arnoldi in 30.30 seconds, maxrss 1052.84 MB
* subarray in 391.72 seconds, maxrss 1402.90 MB
* core in 70.38 seconds, maxrss 2548.99 MB
* inference in 0.97 seconds, maxrss 2548.99 MB
* keywordargs in 2.10 seconds, maxrss 2548.99 MB
* numbers in 136.61 seconds, maxrss 2548.99 MB
* printf in 19.77 seconds, maxrss 2548.99 MB
* char in 1.58 seconds, maxrss 2548.99 MB
* string in 27.48 seconds, maxrss 2548.99 MB
* triplequote in 0.03 seconds, maxrss 2548.99 MB
* unicode in 5.13 seconds, maxrss 2548.99 MB
* dates in 54.40 seconds, maxrss 2548.99 MB
* dict in 15.71 seconds, maxrss 2548.99 MB
* hashing in 6.90 seconds, maxrss 2548.99 MB
* iobuffer in 1.10 seconds, maxrss 2548.99 MB
* staged in 1.71 seconds, maxrss 2548.99 MB
* offsetarray in 99.84 seconds, maxrss 2548.99 MB
* arrayops in 48.48 seconds, maxrss 2548.99 MB
* tuple in 2.51 seconds, maxrss 2548.99 MB
* reduce in 4.98 seconds, maxrss 2548.99 MB
* reducedim in 16.75 seconds, maxrss 2548.99 MB
* random in 14.81 seconds, maxrss 2548.99 MB
* abstractarray in 129.88 seconds, maxrss 2548.99 MB
* intfuncs in 1.36 seconds, maxrss 2548.99 MB
* simdloop in 1.77 seconds, maxrss 2548.99 MB
* vecelement in 2.76 seconds, maxrss 2548.99 MB
* blas in 40.38 seconds, maxrss 2548.99 MB
* sparse in 362.34 seconds, maxrss 2548.99 MB
* bitarray in 669.47 seconds, maxrss 2548.99 MB
* copy in 2.11 seconds, maxrss 2548.99 MB
* math in 52.24 seconds, maxrss 2548.99 MB
* fastmath in 3.75 seconds, maxrss 2548.99 MB
* functional in 36.97 seconds, maxrss 2548.99 MB
* operators in 0.66 seconds, maxrss 2548.99 MB
* path in 5.38 seconds, maxrss 2548.99 MB
* ccall in 7.28 seconds, maxrss 2548.99 MB
* parse in 3.61 seconds, maxrss 2548.99 MB
* loading in 0.12 seconds, maxrss 2548.99 MB
* bigint in 5.41 seconds, maxrss 2548.99 MB
* bigfloat in 0.14 seconds, maxrss 2548.99 MB
* sorting in 45.76 seconds, maxrss 2548.99 MB
* statistics in 8.42 seconds, maxrss 2548.99 MB
* spawn [stdio passthrough ok]
Test Failed
Expression: run(@cmd("foo_is_not_a_valid_command"))
Expected: Base.UVError
Thrown: ErrorException
ERROR: LoadError: LoadError: There was an error during testing
in record(::Base.Test.FallbackTestSet, ::Base.Test.Fail) at test.jl:397
in do_test_throws(::Base.Test.Threw, ::Expr, ::Type{T}) at test.jl:329
in include_from_node1(::String) at loading.jl:488
in macro expansion at util.jl:230 [inlined]
Well, not exactly super fast on a 2nd gen mobile Core i5, and certainly libuv
requires some patches, but still:
Quod erat demonstrandum.