Category Archives: C++

Everything related to the use of the C++ language

Book review: Ultimate 3D Game Engine Design & Architecture

I bought this book as soon as it was published, and I sold it soon after. Suffice to say I had a very mitigated impression after reading it. There are good things in it, but also some very bad stuff. It doesn’t describe how to write your ultimate game engine, but the author’s game engine. What about some modesty?

Let’s start with the bad stuff.

Continue reading Book review: Ultimate 3D Game Engine Design & Architecture

Interactive RayTracer

Some months ago, I’ve decided to dig into raytracing, and more exactly interactive raytracing. So I’ve started writting my own library, based on several publications.
nVidia announced recently its own framework, Intel wants also to do raytracing on Larrabee, it is the current trend.
Continue reading Interactive RayTracer

Profiling with Valgrind/Callgrind

Profiling comes in three different flaviors. The first is emulation, where a processor behavior is emulated, the second is sampling, where at regular intervals, the profiler samples the status of a program, and fianlly instrulentation, where the profiler gets information when a subroutine is called and when it returns. As with the Heisenberg uncertainty, profiling changes the exact behavior of your program. This is something you have to remember when analyzing a profile.

Valgrind is an Open Source emulation profiler. It is freely available on standard Linux platforms. As it is an emulation, it is far slower than the actual program. This means that the I/O are underestimated. The advantage is that you can have every detail on the memory behavior (cache misses for instance). Valgrind does not emulate all processors, but you can tweak it to approach your own one.
Continue reading Profiling with Valgrind/Callgrind

Overview of TotalView, a parallel debugger

Some months ago, I had a TotalView tutorial, thanks to my job. Now, I’ve actually used it to debug one of my parallel applications and I would like to share my experience with fantastic tool.
First TotalView is not only a parallel debugger available on several Linux and Unix platforms. It also is a memory checker (MemoryScape and the TotalView plugin) as well as a reverse debugger, that is, you can roll back the execution of a program, even after it crashed (where it would be useless with a standard debugger like GDB).
Continue reading Overview of TotalView, a parallel debugger

Is it possible to achieve in C++ the performance one can get from Fortran?

This is the question I asked myself recently. If you write a scientific code in Fortran, you can expect a huge performance boost compared to the same program in C or C++. Well, unless you use some compiler extensions, in which case you get the same performance, or better.
Let’s try this on a 3D propagation sample, with a 8-points stencil.
Continue reading Is it possible to achieve in C++ the performance one can get from Fortran?

Using SCons with Eclipse (Linux)

I chose Eclipse as my new Linux IDE, instead of Konqueror + KWrite. The purpose was to be able to launch a SCons build from the IDE, get the errors in a panel and double-clicking on one of them would direct me to the location of the error.

So Eclipse seemed to fit my needs:

  • Plug-ins to add the support of various languages
  • Support of different construction tools
  • Support from the main C/C++/Fortran compiler developers (GNU, Intel, IBM, …)

So I will know show you two ways of enabling SCons support for Eclipse.
Continue reading Using SCons with Eclipse (Linux)

Exposing an array interface with SWIG for a C/C++ structure

Sometimes, a C or C++ array structure must be used in Python, and it’s always better to be able to use the underlying array to do some Numpy computations. To that purpose, Numpy proposes the array interface.

I will now expose an efficient way to use SWIG to generate the array interface and exposing the __array_struct__ property.
Continue reading Exposing an array interface with SWIG for a C/C++ structure

Book review: An Introduction to Design Patterns in C++ with Qt4

Contrary to what the title may hint to, this book is an introduction to C++ and the Qt library. And in the process, the authors tried to teach some good practices through design patterns. So if you’re a good C++ or Qt programer, this book is not for you. If you’re a beginner, the answer is in my review.

Continue reading Book review: An Introduction to Design Patterns in C++ with Qt4

Book review: Intel Threading Building Blocks: Outfitting C++ for Multi-core Processor Parallelism

After some general books on grid computation, I needed to change the subject of my readings a little bit. As Intel Threading Building Blocks always intrigued me, I chose the associated book.
Continue reading Book review: Intel Threading Building Blocks: Outfitting C++ for Multi-core Processor Parallelism