Learning to Learn: CMake

CMake is the de-facto C++ build system used by an overwhelming number of C++ projects. Even if you personally favor more modern alternatives such as Meson, Bazel, or Pants, if you ever pull in a 3rd party dependency, there is a good chance that it uses CMake so knowing enough about CMake to understand it is worth knowing. How to get started I recommend new users to CMake start with the following resources:...

November 15, 2022 · 5 min · 999 words · Robert Underwood

Generic Cuda

GPU programming has the potential to make embarrassingly parallel tasks very quick. But what if you want to perform the same task on a variety of different types? In this post, I walk through a generic testing code that preforms a vector add on GPU and CPU to verify the correctness. The Test Harness Our main function is pretty simple: int main(int argc, char* argv[]) { check_type<int>(); check_type<long>(); check_type<double>(); check_type<float>(); return 0; } So how do we write check_type?...

May 12, 2018 · 7 min · 1378 words · Robert Underwood

Learning to Learn: C++

C++ is a huge language. It has tools form imperative, functional, object-oriented, and generic paradigms. And that leaves out the extremely fine control over things like memory allocation strategies in the standard library not generally available elsewhere. In this post, I present my learning path through C++ and offer some suggestions for learning this multi-faceted language. Order of Topics This is not intended to be an exhaustive (for that would be far too long), or optimal (for that would be context dependent) listing of the topics, but rather the path that I took through the language....

January 12, 2018 · 12 min · 2513 words · Robert Underwood

Life with Libtooling

Over the last two months, I spent a significant amount of time using Clang’s libtooling. Libtooling is a great way to quickly develop tools to analyze and modify large quantizes of C++. In this article, I share some lessons learned working with libtooling. Beware the Stability Guarantees. The biggest problem with libtooling is that it has very few if any Stability guarantees. When I was learning libtooling, I watched Peter Goldsborough’s video excellent “clang-useful: Building useful tools with LLVM and clang for fun and profit”....

December 10, 2017 · 5 min · 873 words · Robert Underwood

Qt is for more than just GUIs

When most people think of Qt, I imagine that they think about the Graphical User Interface components. But Qt has a variety of other components beyond just being a GUI framework. In this post, I highlight some of what I find to be the more interesting features. Object Communication via Signals and Slots One of the coolest features of Qt is its very clean implementation of signals and slots. Signals and slots are a means of communicating information (called signals) between objects via special callbacks (called slots)....

May 23, 2017 · 3 min · 616 words · Robert Underwood

Resource Acquisition is Initialization and SDL

Recently, I was working on a project for 2D Game Development where I had to use SDL 2.0. SDL 2.0 is a family of media libraries designed for writing cross platform games in C. However it can be difficult to remember where various resources are allocated and deallocated. Resource Acquisition is Initialization (RAII) is a common pattern in C++ programming that solves this problem. So I wrote a series of wrappers for SDL 2....

May 8, 2017 · 3 min · 564 words · Robert Underwood

Smart Pool

Object Pools are a commonly used pattern used in operating systems, game, and high performance computing development. However just as it can be easy to forget to return a pointer to memory, it can be easy to forget to return the memory to the pool. In this article, I layout a class that I recently used to automatically manage memory from a pool. The template pool class has 4 parts: an onEmpty policy, an allocation policy, a reset policy, and an object proxy....

April 30, 2017 · 3 min · 581 words · Robert Underwood

Learning to Learn: GDB

GDB is a powerful tool that is underutilized by most programmers that I’ve met. It can tell you the state of one or more running or crashed programs, and even manipulate the memory of a running process. It is an invaluable tool for understanding what is going wrong with your programs. How to get started To get the most out of GDB you need to compile your program with debug information – metadata that describes the program source....

9 min · 1728 words · Robert Underwood

Learning to Learn: MPI

MPI is the de-facto standard way to write distributed programs that run on super computers. Many have tried to replace it, but so far none of them have succeeded. Learning to use it successfully, will enable you to write powerful distributed programs. Order of Topics MPI has a minimal powerful and useful core, but really tries to completely own it’s space. I strongly reccommend reading “Using MPI” by Gropp et al....

5 min · 1034 words · Robert Underwood