New Video Tutorial: Intro to C/C++ multicore CPU and GPU programming with OpenMP and OpenCL

June 14, 2011

Released Today! Our newest video tutorial, Intro to C/C++ multicore CPU and GPU programming with OpenMP and OpenCL, is now available for your viewing pleasure at the following link:

Link:  Got Cores? Use ’em!

This is a demonstration and discussion about using OpenMP and OpenCL for writing multicore CPU and GPU programs. This is for the intermediate C/C++ programmer who feels confident writing traditional single-threaded programs, and now wants to know more about the processes and tools that are out there to help in the transition to multicore.

We’ll take a simple little C/C++ program and run it first single-threaded, then adapt it to multicore CPU using OpenMP, then run it on the highly parallel graphics processor (GPU) using OpenCL. The goal is to foster “parallel thinking,” and to give you an idea of what kind of programming effort it takes, and what you can expect as a result.


Roll Top Desk Wallpaper

April 4, 2011

I always liked the look of a roll top desk, but never owned one. So I made a model in Blender, rendered an image, and installed it as my desktop wallpaper. Now when I’m sitting at my computer, I’m sitting at the roll top desk I always wanted.

Take a copy if you like — here are direct download links to some common wallpaper sizes. Completely free for non-commercial use under the terms of CC BY-NC-SA 3.0.


Comments are disabled due to the volume of spam we’re receiving. To post a comment or to get in touch for any reason, email dave at millermattson dot com.

New Video Tutorial: Assembly Language Output from gcc/g++

March 30, 2011

Released Today! Our newest video tutorial, Inspecting the Assembly Language Output from gcc/g++, is now available for your viewing pleasure at the following link:

Link:  Inspecting the Assembly Language Output from gcc/g++

You can look at the assembly language output from the gcc/g++ compiler to see what kind of code the compiler generates for your C++ source without linking or running your code.

For an example to show how the assembler listing can be used, we’ll look at the assembly language generated when compiling the following C++ snippet and try to answer the question, “Does the gcc/g++ compiler apply the Return Value Optimization (RVO) when compiling with optimization level zero (gcc -O0)?”

    class BigClass
        char a[1000000];

    BigClass getData(int a, int b)
        return BigClass();  // opportunity for RVO

    void testFunction(void)
        BigClass myData = getData(1, 2);

In this 20-minute video tutorial, we’ll discuss:

  • How the Return Value Optimization works
  • How to get an assembly language listing from the compiler
  • How to make sense of mangled names
  • Find where the stack frames are created and local stack space allocated
  • Addressing local data on the stack
  • Function call convention


New Video Tutorial: Make a Neural Net Simulator in C++

February 4, 2011

Released today! Our newest video programming tutorial, A Neural Net Simulator in C++, is now available for your viewing pleasure at the following link:

[ Update for 2013: Also see the new companion video for visualizations of how neural nets work and how to train them: The Care and Training of Your Backpropagation Neural Net.  ]

Neural Net in C++ Tutorial from David Miller on Vimeo.

If you’re a beginning to intermediate C++ programmer, this tutorial will guide you through the analysis, design, and coding of a command line console program that implements a neural net in C++. You’ll end up with a classic back propagation model with adjustable gradient descent learning and adjustable momentum. You’ll see how to teach your neural net to solve a simple task, then you can supply your own training data to train your net to do wonderful and amazing things.

Besides showing how a neural net works, we also discuss:

  • C++ class design
  • prototyping with portable C++
  • test early, test often
  • encapsulation, data hiding
  • static class members
  • accessor functions
  • const correctness
  • the assert() macro
  • the vector<> template container, and .size(), .back(), and .push_back() member functions
  • reference variables

This tutorial does not cover or require exception handling, memory management, STL iterators, inheritance, threads, or graphical input or output.

The finished neural net source code is also available for download here (see the video for instructions on what to do with it):


Blender and Large Video File Sizes

January 8, 2011

Blender is a capable tool for making and editing video. Not only can it render a movie file from a 3D model, it also has a non-linear sequence editor that you can use for audio and video compositing and editing. For an overview of what the sequence editor can do, see .

Video files can get huge. Especially during editing, you often want to work with high resolution video, perhaps uncompressed or lightly compressed, to avoid degrading the image from recompression. Unfortunately, not all your video tools will work as expected if a video file exceeds 2 GB in size. To be exact, that means a limit of 2 * 1024 * 1024 * 1024 = 2,147,483,648 bytes. Blender may happily write a video file larger than that without complaint and your operating system might not mind, but you also may end up with a movie file that is not strictly valid or for whatever reasons can’t be read correctly by some of your multimedia tools.

One way to avoid the 2 GB file size issue is to output a sequence of individual image files, such as PNG, one image file per frame. With most modern filesystems, you can throw a few thousand image files into each directory without horrendous performance problems. Also, if you crash or stop your animation before it’s done, you can restart the program and resume rendering at the frame where you left off.

When you do really want to generate a movie file, here are some of the Blender 2.5 settings that affect the size of the output.

Blender settings affecting video size

  1. File format: For smaller output files, use a compressed video format (such as MPEG-4) that allows you to specify the bitrate or compression factor, then dial that down to a low number for a low-quality draft output. Use the larger default values for a final higher-quality output.
  2. Separate video and audio: You can sync them up in the editor, then output video with no audio or vice versa for a smaller draft file.
  3. Resolution: Reduce to make smaller files, then increase for the final product.
  4. Step parameter: Use step N to encode only one of every N frames.
  5. Autosplit output: This should always be checked for safety. This will give Blender permission to break up the output file in pieces smaller than 2 GB each.


Comments are disabled due to the amount of spam we’re receiving. For non-spam communication, feel free to contact user dave, who receives email at the domain millermattson dot com.

Powered by Wordpress and MySQL. Theme by Shlomi Noach,