Child pages
  • Hyak Julia programming
Skip to end of metadata
Go to start of metadata

Installing Julia

ssh -X
srun -p build --time=2:00:00 --mem=100G --pty /bin/bash
download julia tar.gz file from Julia Language web pages
mkdir juliastuff
cd julia stuff
tar -xvf julia-0.4.6-linux-x86_64.tar.gz
In below command replace xyz by the full path to the bin directory of julia
export PATH=xyz:$PATH
module load git_1.8.2.3
module load anaconda_2.4

Plotting with Gadfly

At the Julia prompt
(In below command replace abc with your userid)
rm /usr/lusers/abc/.julia/lib/v0.4/Compose.ji
Restart Julia
At the Julia prompt:
Below error is due to missing xdg-open on Hyak. It is minor error.
myplot=plot([sin, cos], 0, 25)
Error showing value of type Gadfly.Plot:
ERROR: could not spawn `xdg-open /tmp/juliapXh0kL.html`: no such file or directory (ENOENT)
in _jl_spawn at process.jl:262
in anonymous at process.jl:415
in setup_stdio at ./process.jl:403
in _spawn#58_ at ./process.jl:414
in run at ./process.jl:530
in open_file at /usr/lusers/psgupta/.julia/v0.4/Gadfly/src/Gadfly.jl:919
in display at /usr/lusers/psgupta/.julia/v0.4/Gadfly/src/Gadfly.jl:977
[inlined code] from multimedia.jl:151
in display at /usr/lusers/psgupta/.julia/v0.4/Gadfly/src/Gadfly.jl:904
in print_response at REPL.jl:134
in print_response at REPL.jl:121
in anonymous at REPL.jl:624
in run_interface at ./LineEdit.jl:1610
in run_frontend at ./REPL.jl:863
in run_repl at ./REPL.jl:167
in _start at ./client.jl:420
Save plot to PDF file:
draw(PDF("myplot.pdf", 4inch, 3inch), myplot)

Plotting with Python Matplotlib PyPlot

At the julia prompt:
using PyPlot
x = linspace(0,2*pi,1000); y = sin(3*x + 4*cos(2*x))
plot(x, y, color="red", linewidth=2.0, linestyle="--")
ERROR: ArgumentError: haskey of NULL PyObject
(Above is a Julia bug in calling Python matplotlib properly)

  • No labels