Monday, May 12, 2014

Preventing Pointer Aliasing in C (for Scientific Computing Optimization Purposes)

The issue of pointer aliasing in C for those working with Scientific Computing code is probably a familiar issue. Pointer aliasing happens when more than one pointer refers to the same or overlapping memory region. This hurts performance in Scientific Computing code written in C. Pointer aliasing is probably the biggest issue which hurts performance of Scientific Computing code written in C compared to those written in Fortran. However, as of C99 standard, pointer aliasing can be "disabled" via the __restrict__ keyword. Most mainline C/C++ compilers supports this keyword. These are the relevant links for various mainline compilers/toolchains:

Post a Comment

No comments: