From c793b3bb92748261fa4f20ac44debd3f4d601369 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Sj=C3=B6lund?= <martin.sjolund@liu.se> Date: Mon, 7 Oct 2019 16:01:56 +0200 Subject: [PATCH] Update to Julia 1.2.0 (released Aug 20, 2019) Julia 1.2.0 has more intuitive output for the memory profiler. --- julia/.gitignore | 2 +- julia/Makefile | 12 +++++++----- julia/run.jl | 8 +++++--- profiling/Makefile | 8 +++++--- 4 files changed, 18 insertions(+), 12 deletions(-) diff --git a/julia/.gitignore b/julia/.gitignore index ff2c26d..fbb41be 100644 --- a/julia/.gitignore +++ b/julia/.gitignore @@ -1,2 +1,2 @@ *.tar.gz -julia-1.0.4 +julia-* diff --git a/julia/Makefile b/julia/Makefile index 8b65272..2020fa8 100644 --- a/julia/Makefile +++ b/julia/Makefile @@ -1,14 +1,16 @@ .PHONY: run -run: julia-1.0.4/bin/julia +VERSION=1.2.0 + +run: julia-$(VERSION)/bin/julia $< run.jl -shell: julia-1.0.4/bin/julia +shell: $(VERSION)/bin/julia $< -julia-1.0.4/bin/julia: julia-1.0.4-linux-x86_64.tar.gz +julia-%/bin/julia: julia-%-linux-x86_64.tar.gz tar xzf $< $@ -e 'using Pkg; Pkg.add("BenchmarkTools"); Pkg.add("StatProfilerHTML")' touch $@ -julia-1.0.4-linux-x86_64.tar.gz: - wget https://julialang-s3.julialang.org/bin/linux/x64/1.0/julia-1.0.4-linux-x86_64.tar.gz +julia-%-linux-x86_64.tar.gz: + wget https://julialang-s3.julialang.org/bin/linux/x64/`echo $@ | grep -E -o [0-9]+[.][0-9]+`/$@ diff --git a/julia/run.jl b/julia/run.jl index 3728a8f..0278924 100644 --- a/julia/run.jl +++ b/julia/run.jl @@ -1,6 +1,7 @@ """Template programming is a sort of metaprogramming where you fill in the blanks, but most parts of the code are very similar.""" +# Problem1 for (name,op) in [(:add, :+), (:sub, :-), (:mul, :*)] # Create a function that is named for example add and returns the # sum of its two arguments @@ -14,19 +15,20 @@ end at runtime, but it is so similar to template programming that you could try to delete a function instead.""" -module Problem1 +module Problem2 f(a::Int) = 1 f(a::Any) = 2 end # TODO: Delete the method f(a::Int) so that f(1) returns the value 2 instead of 1 -@assert 2 == Problem1.f(1) +@assert 2 == Problem2.f(1) +# Problem3 # TODO: Make an until block for Julia, similar to do {} while (cond); in C # # Make sure that any assertions and error-messages refer to lines in the original code. # Hint: You can access a hidden input __source__ in a macro and use that to replace source information. # By having the macro in a separate file, you can check source locations that match dowhile.jl and replace them with __source__. -include("dowhile.jl") +include("dowhile.jl") # Modify the macro in dowhile.jl function testDoWhile() local a = 5 @doWhile begin diff --git a/profiling/Makefile b/profiling/Makefile index 97d9551..2fb559c 100644 --- a/profiling/Makefile +++ b/profiling/Makefile @@ -1,7 +1,9 @@ .PHONY: run -run: ../julia/julia-1.0.4/bin/julia +VERSION=1.2.0 + +run: ../julia/julia-$(VERSION)/bin/julia $< test.jl -../julia/julia-1.0.4/bin/julia: - $(MAKE) -C ../julia julia-1.0.4/bin/julia +../julia/julia-$(VERSION)/bin/julia: + $(MAKE) -C ../julia julia-$(VERSION)/bin/julia -- GitLab