Exploiting C++: Cache and Memory Layout, Copies, Moves, Threads and Random Numbers


This class will cover aspects of the C++11 and 14 standards relevant for scientific high performance computing needs presented in an easy-to-understand and easy-to-use manner. Topics covered will range from using C++ thread objects, atomics, locks, and packaged tasks; reliable random numbers including reliably generating randomized seeds; writing code to exploit hardware caches; and learning how to easily exploit C++ move and copy semantics to help maximize the efficiency of your C++ code. Although it is not possible to explore all of these topics in an advanced manner in the time allotted, all of these topics will be presented in a way that will enable the attendee to extract the most performance possible with a minimum of syntax and effort. Such should enable the attendee to subsequently achieve noticeable improvements with his/her C++ programs.

This class is targeted to individuals wanting to exploit new features in C++11 and 14 to improve source code readability and the (time or space) efficiency of their serial or concurrent C++ programs. The attendee is welcome to ask technical questions of the instructor of how C++, the C++ Standard Library, Boost, etc. can be exploited to improve their programs. If you have questions involving the use of C++ Template Metaprogramming you are asked to ask such questions of the instructor either before the class has started and/or after the class has ended as such tends to involve very advanced C++ programming and may not be of interest to others in the class.

As this is a half-day (approximately three hour) class, it is not possible to cover all topics fully. Consequently, the class will consist of lecture-based segments (with slides and other available information), live coding demonstration segments, and some hands-on activities. Due to the time constraints, source code will be provided to simplify and speed up hands-on activities. The attendee will be free to build upon and use such code for his/her own use.

Instructor: Paul Preney, SHARCNET, University of Windsor

Prerequisites: Prior experience writing C++98 code is required. In particular, the attendee will need to understand how to write classes (i.e., a default constructor, a copy constructor, a copy assignment operator, and a destructor), use dynamic memory with the new operators, and hopefully is familiar how to use C++ Standard Library containers, iterators, and algorithms --but the latter will be briefly reviewed. This class will use containers in the C++ Standard Library. The attendee will need a login and password to log into SHARCNET to use the C++ compiler, or the attendee may bring his/her own laptop with a fully-supporting C++11-supporting compiler set up (i.e., GCC v4.8+, clang v3.5, Intel v15+) in advance of the class.

NOTE: If you have questions about this course or its prerequisites feel free to submit a ticket or contact Paul Preney directly.