Learning to Learn: Python

Python is a relatively simple language compared to others such as C++. Despite its simplicity, Python really shines because of its robust standard library, extensive 3rd party library ecosystem (especially for statistics and data analysis), and intuitiveness. This post tracks my process of learning how to program well in Python. Order of Topics The listing of topics here is arbitrary and represents the path that I took to learn Python roughly organized by topic....

January 23, 2019 · 11 min · 2157 words · Robert Underwood

Learning to Learn: Reading

From time to time, I get questions about how I read and retain as much information as I do. While it is never easy – especially with dry technical documents – there are a few strategies that I have learned along the what that I find helpful. In this post I provide some general suggestions along with some that are more useful in computer systems research. Strategies for Reading in General My chemistry and physics teacher – Dr....

August 8, 2018 · 8 min · 1548 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

Design of A Matrix loading Library

Ever notice that every matrix and graph library seems to have a different interface for constructing matrices? Also notice that each only only supports some subset of common matrix formats? With a little help from the Adapter and Builder design patterns we can actually solve this problem. Design Overview In this design, we have 2 main actors: Parser andBuilder as well as their implementations ParserImpl and BuilderImpl. It allows us to write code like this in c++:...

September 23, 2017 · 4 min · 796 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

Pluggable Authentication With PAM

Authentication and authorization is one of foundational aspects of any security system. However writing an authentication and authorization system can be anything but: There are complex, ever-changing requirements, not to mention differences for differing interfaces it can quickly become daunting. However, there already exists a system on Linux and Unix that allows for dynamic and complex authentication: PAM. PAM Modules and Authentication Types Fundamentally, PAM is a collection of modules that provide several methods....

May 14, 2017 · 3 min · 444 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