The recording of our September 10th webinar, Generative Art in C++, is now available on JetBrainsTV YouTube channel.
In this webinar, Dmitri Nesteruk shows an example implementation of a generative art algorithm that uses nested smooth functions to create artwork of arbitrary complexity and size, and discusses some hottest parallelisation topics.
Demo project is available on GitHub.
The video includes the time stamps following the agenda announced:
00:24 – Introduction to Generative Art task
01:01 – How to make random images (and why this is a computationally intensive task)?
06:58 – Code representation of the tesk
12:48 – Simple parallelization with OpenMP and Threading Building Blocks (TBB).
22:30 – Using vectorized functions from Intel’s Math Kernel Library (MKL).
29:06 – Clustered computation using Message Passing Interface (MPI).
48:15 – CUDA and OpenCL discussion
Below are some questions from our webinar answered by Dmitri.
Q: Why to use rand() and not modern some C++ random function?
A: Well, main reason is repeatability, that is very important for generative art task. Let me explain. You can notice that first we generate small images (512*512). We can preview them easily and store as many as we want. But when it comes to actually printing something like that and putting it on a wall, I want it bigger. And that’s why repeatability using the same random seed that we’ve started with is important.
Q: Please, elaborate on using raw pointers for x y, z instead of std::array or std::vector.
A: There’s no particular reason to use raw pointers here. I’d say it’s simply a bit easier to understand, and since the processes of creating and destroying the function are deterministic, you are not losing much by using raw pointers. Of course, it would have been just as easy to use
unique_ptr everywhere. Same goes for the arrays – it is equally reasonable to have used
std::vector, but given the relatively low complexity of the algorithm, it doesn’t really matter. I may upgrade the source code in the future to use those constructs instead.
Q: Could you please provide the link to the 4K video you are showing in the webinar?
A: Sure, please watch it here.
And by the way, in case you understand Russian language, you could have a look at the original idea I was using here.
Q: Could you suggest some books or online courses on the topic
A: If you are after general C++ knowledge, I have a few courses on Pluralsight you might be interested in. First there’s Accelerated Introduction to C++, I also have a course on the Boost C++ Libraries, there’s a course on CUDA which, incidentally, includes the image generating example that I’ve talked about. Finally, I have an upcoming course on HPC techniques, which specifically covers SIMD, OpenMP, MPI and C++ AMP (a platform-neutral GPU API from Microsoft).
About the Presenter:
Dmitri Nesteruk is a developer, speaker, podcaster and technical evangelist. His interests lie in software development and integration practices in the areas of computation, quantitative finance and algorithmic trading. His technological interests include C#, F# and C++ programming as well high-performance computing using technologies such as CUDA. He has been a C# MVP since 2009.
Thanks to all the attendees for the questions! If you still have some, please, contact Dmitri or our team.
Learn more about C++ tools from JetBrains on our site.
Thank you and develop with pleasure!