November 2014 archive

Fix MATLAB Error: “dlopen: cannot load any more object with static TLS”

On Linux, you may occasionally encounter the error “dlopen: cannot load any more object with static TLS” in MATLAB. This is a known bug since way back! To fix, create a file “startup.m” in the directory that you start MATLAB from with the following content: ones(10)*ones(10); I know! It’s ugly… But it works!! EDIT: Since it …

Continue reading

Apache Always Redirect to HTTPS for SSL Websites

After getting an SSL certificate, it is usually good idea to redirect all http (port 80) connections on your website to https (port 443). This can be simply done in Apache. To do this, just go to your public_html folder and either create a .htaccess file and add these lines, or add them to the already existing .htaccess file: …

Continue reading

ArrayFire is Now Open Source!

To my surprise, the CUDA library ArrayFire is now open source and licensed under BSD 3-Clause License which means that commercial use is permitted! ArrayFire is a production oriented library which greatly reduces CUDA application development time. The repository is hosted on GitHub and is located here.

Tutorial : Use CUDA and C++11 Code in MATLAB

As it turns out, incorporating CUDA code in MATLAB can be easily done! 🙂 MATLAB provides functionality for loading arbitrary dynamic libraries and invoking their functions. This is especially easy for invoking C/C++ code in a MATLAB program. Such functionality is possible using the so called MEX functions. Introduction: Mex functions can be created with the …

Continue reading

CImg and NVIDIA’s NPP Interop

Apparently, NPP relies on the pixel order of its input arrays (they need to be interleaved). If you are planning on using CImg with NPP, be sure to check this post out before attempting to do so. Failing to permute CImg image axes will result in wrong filtered values for color images.

CImg does not store pixels in the interleaved format

  Took me hours before I found and read the documentation. CImg stores pixels in a planer format (RRRR…..GGGG…..BBBB). For most tasks in CUDA, it’s much better to store the pixel values in the interleaved format (RGBRGBRGB……). In order to do that, just call the permute_axes method of the CImg object: CImg image(“image.jpg”); image.permute_axes(“cxyz”);    IMPORTANT: After …

Continue reading

Error: “incorrect inclusion of a cudart header file”

If you receive this error while compiling a CUDA program, it means that you have included a CUDA header file containing CUDA specific qualifiers (such as __device__)  in a *.cpp file. CUDA header files with such qualifiers should ONLY be included in *.cu files. This happened to me when I had #inlcude <common_functions.h> in my *.cpp …

Continue reading