13.07.2015 Views

Intel(R) Math Kernel Library for Linux* OS User's Guide

Intel(R) Math Kernel Library for Linux* OS User's Guide

Intel(R) Math Kernel Library for Linux* OS User's Guide

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Managing Per<strong>for</strong>mance and Memory 6Redirecting the pointers is the only correct way to use your own set of memorymanagement functions. If you call your own memory functions without redirecting thepointers, the memory will get managed by two independent memory managementpackages, which may cause unexpected memory issues.How to Redefine Memory FunctionsTo redefine memory functions, use the following procedure:1. Include the i_malloc.h header file in your code.This header file contains all declarations required <strong>for</strong> replacing the memory allocationfunctions. The header file also describes how memory allocation can be replaced inthose <strong>Intel</strong> libraries that support this feature.2. Redefine values of pointers i_malloc, i_free, i_calloc, i_realloc prior to thefirst call to MKL functions:Example 6-4 Redefining Memory Functions#include "i_malloc.h". . .i_malloc = my_malloc;i_calloc = my_calloc;i_realloc = my_realloc;i_free = my_free;. . .// Now you may call <strong>Intel</strong> MKL functions6-19

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!