The compilation time was "higher" in percentitage points, but the overall speed was different, so it does not make sense to compare % without computing the actuall time spent compiling
I am loving your videos. Do you have a video about create environments for julia peojects? By the way I am happy you are using VSCode. It is lore easy and more intuitive. Keep it up!
I cover the basics in a few different videos, but the best video for this is actually a JuliaCon 2021 workshop by Sebastian Pfiztner where he presents Julia Package Development in VS Code th-cam.com/video/F1R3ETaRQXY/w-d-xo.html Good luck!
Hi, I'm running your code on a M2 pro, 32Gb RAM and 10 cores. The naive code runs in 22sec, but when wrapping the for loop into a function it runs in 14sec, and still have 700Mb allocated memory, strange, don't you think?
Hi, thank you for the suggestion. However, I will probably not be covering a Debugger in this series. There are some other resources on debugging in Julia available online. This JuliaCon 2021 workshop on Package Development covers some of the available tools: th-cam.com/video/wXRMwJdEjX4/w-d-xo.html Good luck!
I thought you would change the vector Any to teach how Julia infer types and show how the use of Any deteriorate performance. That it was a good moment for this
Hi Doggo, are your turorials/series devided by interest/topic or are they somewhat consecutive? Meaning do I need your other tutorials/series for before diving into #08 ?
It depends on your background. In general, I would recommend watching Series 1 (Intro to Julia), Series 2 (Intro to Data Analysis/Visualization), Series 5 (Intro to Machine Learning) and Series 7 (Intro to Differential Equations) before watching Series 8. If you already have those skills, then you can skip the other series and jump straight into Series 8. Good luck!
I noticed an even bigger time reduction when I used broadcast on the assignment operator as well, i.e. z .= a.*x .+ y instead of z = a.*x .+ y Also, it boggles my mind why the for loop method needs to have millions of allocations, even when I preallocate all the arrays (no push!()) and don't even use a temp variable - not that the last bit should make any difference to a modern compiler.
Good catch. As you figured out, you need to pre-allocate z before you can use z .= a .* .+ y. When you pre-allocate, you can use z = zeros(Float32, n) in order to pre-allocate it with 32-bit numbers. Regarding the loop method, I failed to mention that you should never use z = [], which is an empty Array of Type Any, so Julia needs to allocate all of that memory just in case there are 32-bit numbers, 64-bit number, Strings, etc... If you pre-allocate z using z = zeros(Float32, n), there shouldn't be that many allocations. The more specific you are regarding the data types, the less memory Julia will allocate. Cheers!
For optimal speed you would actually want to use z=Vector{Float32}(undef, n). This is faster then zeros(Float32, n) since it does not care what the numbers in z are, we are going to overwrite them any way. Most of the time the array will be mostly zeros, but there can be random garbage in there, again since we are going to overwrite the whole vector it does not matter
Great video! btw, so far I see you are using visual code for the IDE, but for scientific computing, jupyter-notebook will be more intutive and efficient to present the information May be you should try it also!
Hi, thanks for watching and thank you for the suggestion! I will probably not be using Jupyter notebooks in this series, but I may be using Pluto notebooks. In my opinion Pluto is a better notebook environment for Julia. I have a 13-part series where I introduce Pluto notebook and use them for Differential Equations (Series 07) if you are interested: th-cam.com/video/ex6dlDJgNNE/w-d-xo.html
Incredible how these tutorials make learning things which are otherwise annoying to oiece together a relaxing pleasure. Keep up the great work! 🎉
Incredibly clear and effective tutorials - thank you (looking forward to doing the complete series sets). Brilliant style, thanks again!
You're welcome! Have fun exploring the tutorials!
Best Julia lang video as always. It helps me a lot. Thank you, Doggo!
You're welcome!
greater than julia official tutorial ❤
This video is so great. I am a newbie at Julia and your content is helping me a lot.
Glad to be of service! Welcome to the World of Julia!
Thanks
Thank you!
The compilation time was "higher" in percentitage points, but the overall speed was different, so it does not make sense to compare % without computing the actuall time spent compiling
I am loving your videos. Do you have a video about create environments for julia peojects?
By the way I am happy you are using VSCode. It is lore easy and more intuitive. Keep it up!
Hi, it's correct, in the previous sessions, he explains how to create them.
I cover the basics in a few different videos, but the best video for this is actually a JuliaCon 2021 workshop by Sebastian Pfiztner where he presents Julia Package Development in VS Code th-cam.com/video/F1R3ETaRQXY/w-d-xo.html Good luck!
thank you very much!
You're welcome!
Hi, I'm running your code on a M2 pro, 32Gb RAM and 10 cores. The naive code runs in 22sec, but when wrapping the for loop into a function it runs in 14sec, and still have 700Mb allocated memory, strange, don't you think?
Great one! waiting for a Debugging julia code video :)
Hi, thank you for the suggestion. However, I will probably not be covering a Debugger in this series. There are some other resources on debugging in Julia available online. This JuliaCon 2021 workshop on Package Development covers some of the available tools: th-cam.com/video/wXRMwJdEjX4/w-d-xo.html Good luck!
I thought you would change the vector Any to teach how Julia infer types and show how the use of Any deteriorate performance. That it was a good moment for this
Definitely a missed opportunity!
Hi Doggo I have a question, how do you make those comment blocks in your code? Regards
I'm cheating, lol! I type them in manually. In the video, I'm just copying and pasting the text from a different file.
Hi Doggo,
are your turorials/series devided by interest/topic or are they somewhat consecutive?
Meaning do I need your other tutorials/series for before diving into #08 ?
It depends on your background. In general, I would recommend watching Series 1 (Intro to Julia), Series 2 (Intro to Data Analysis/Visualization), Series 5 (Intro to Machine Learning) and Series 7 (Intro to Differential Equations) before watching Series 8. If you already have those skills, then you can skip the other series and jump straight into Series 8. Good luck!
I noticed an even bigger time reduction when I used broadcast on the assignment operator as well, i.e.
z .= a.*x .+ y instead of
z = a.*x .+ y
Also, it boggles my mind why the for loop method needs to have millions of allocations, even when I preallocate all the arrays (no push!()) and don't even use a temp variable - not that the last bit should make any difference to a modern compiler.
Good catch. As you figured out, you need to pre-allocate z before you can use z .= a .* .+ y. When you pre-allocate, you can use z = zeros(Float32, n) in order to pre-allocate it with 32-bit numbers. Regarding the loop method, I failed to mention that you should never use z = [], which is an empty Array of Type Any, so Julia needs to allocate all of that memory just in case there are 32-bit numbers, 64-bit number, Strings, etc... If you pre-allocate z using z = zeros(Float32, n), there shouldn't be that many allocations. The more specific you are regarding the data types, the less memory Julia will allocate. Cheers!
For optimal speed you would actually want to use z=Vector{Float32}(undef, n). This is faster then zeros(Float32, n) since it does not care what the numbers in z are, we are going to overwrite them any way.
Most of the time the array will be mostly zeros, but there can be random garbage in there, again since we are going to overwrite the whole vector it does not matter
@@etiennekant Ah, yes, that's much better. Thanks for sharing!
Perfect...
Great video!
btw, so far I see you are using visual code for the IDE, but for scientific computing, jupyter-notebook will be more intutive and efficient to present the information
May be you should try it also!
Hi, thanks for watching and thank you for the suggestion! I will probably not be using Jupyter notebooks in this series, but I may be using Pluto notebooks. In my opinion Pluto is a better notebook environment for Julia. I have a 13-part series where I introduce Pluto notebook and use them for Differential Equations (Series 07) if you are interested: th-cam.com/video/ex6dlDJgNNE/w-d-xo.html