Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lab5-metaprogramming-and-debugging-lab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TDDE45-2019-GROUPC-tonzh048-zhish307
lab5-metaprogramming-and-debugging-lab
Commits
c793b3bb
Verified
Commit
c793b3bb
authored
5 years ago
by
Martin Sjölund
Browse files
Options
Downloads
Patches
Plain Diff
Update to Julia 1.2.0 (released Aug 20, 2019)
Julia 1.2.0 has more intuitive output for the memory profiler.
parent
9aff870b
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
julia/.gitignore
+1
-1
1 addition, 1 deletion
julia/.gitignore
julia/Makefile
+7
-5
7 additions, 5 deletions
julia/Makefile
julia/run.jl
+5
-3
5 additions, 3 deletions
julia/run.jl
profiling/Makefile
+5
-3
5 additions, 3 deletions
profiling/Makefile
with
18 additions
and
12 deletions
julia/.gitignore
+
1
−
1
View file @
c793b3bb
*.tar.gz
julia-
1.0.4
julia-
*
This diff is collapsed.
Click to expand it.
julia/Makefile
+
7
−
5
View file @
c793b3bb
.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]+
`
/
$@
This diff is collapsed.
Click to expand it.
julia/run.jl
+
5
−
3
View file @
c793b3bb
"""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
Problem
1
module
Problem
2
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
==
Problem
1
.
f
(
1
)
@assert
2
==
Problem
2
.
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
...
...
This diff is collapsed.
Click to expand it.
profiling/Makefile
+
5
−
3
View file @
c793b3bb
.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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment