Intel® oneAPI Math Kernel Library
Ask questions and share information with other developers who use Intel® Math Kernel Library.
6977 Discussions

icpc-16_0_170: warning #10315 and malloc message

Pantelis_I_
Beginner
878 Views

Hi all,

 

 

 

 

 

 

 

I would really appreciate any insights regarding the issue I describe below. Even high-level pointers in the right direction can be helpful. Given the level of expertise in this forum, please bear with my naive question. 

Being new to Intel MKL, I am going through the examples that are available online and, specifically, I was looking at "Measuring Effect of Threading on dgemm", which is available here

    https://software.intel.com/en-us/node/529737

The problem, I think, is that I do not really understand the linker flags---I just copied them from the online step-by-step instructions for using Intel MKL with Xcode (v. 7.3.1 on OS X 10.11.6, for what is worth). Hence, when I compile the example, above, I get the following warning

        /icpc-16_0_170: warning #10315: specifying -lm before files may supersede the Intel(R) math library and affect performance

The linker flags are set as follows

        -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -lpthread -lm

When compiling with Apple LLVM, no warnings are emitted, however, given that I do not have in depth knowledge of the compilers, I do not find the lack of warning reassuring. It may very well be the case that only of the two compilers detects the issue.

Also, another disconcerting symptom (with both compilers) is that the first line of the output generated during execution is

        MKL_Cpp(38877,0x11880d000) malloc: Attempted to register zone more than once: 0x104cf0140

However, the program runs and gives correct results. At least for matrices small enough so that I could check the results by inspection (e.g., permutation matrices, matrices that sum columns, etc).

Any ideas or suggestions will be highly appreciated.

Thanks in advance.

 

0 Kudos
1 Solution
Zhen_Z_Intel
Employee
878 Views

Hi Pantelis,

What's the version of your mkl & icc compiler? I tried to reproduce your problem, when I use different version of compiler & mkl, and do not select to use MKL under same version of ICC, link with runpath & header path manually, you might meet this problem. The "libm.dylib" is defined in /usr/lib/, might be used for some of MKL function, but degmm function would not use libm.

For your problem, please try to remove -lm option in Linker flag, this problem could be avoid. For instance,

Mach-O-Type: Executable

Other Linker flags:
-lmkl_core
-lmkl_intel_thread
-lmkl_intel_lp64
-liomp5

Seems your source code is using OMP, please also remember to link with libiomp5.dylib in compiler lib folder.

Best regards,
Fiona

View solution in original post

0 Kudos
6 Replies
Zhen_Z_Intel
Employee
879 Views

Hi Pantelis,

What's the version of your mkl & icc compiler? I tried to reproduce your problem, when I use different version of compiler & mkl, and do not select to use MKL under same version of ICC, link with runpath & header path manually, you might meet this problem. The "libm.dylib" is defined in /usr/lib/, might be used for some of MKL function, but degmm function would not use libm.

For your problem, please try to remove -lm option in Linker flag, this problem could be avoid. For instance,

Mach-O-Type: Executable

Other Linker flags:
-lmkl_core
-lmkl_intel_thread
-lmkl_intel_lp64
-liomp5

Seems your source code is using OMP, please also remember to link with libiomp5.dylib in compiler lib folder.

Best regards,
Fiona

0 Kudos
Pantelis_I_
Beginner
878 Views

Hi Fiona,

 

Thanks a lot for your reply.

I did what you suggested and, indeed, the warnings from the linker went away.

Maybe it is a separate problem, however I am still getting the malloc warning (I linked against libiomp5.dylib, as you suggested, which I hadn't before).

As for versions, I am using MKL 11.3 (for which there are updates, I just realised) and the compiler's version is 16.0 (the folder name is compilers_and_libraries_2016.3.170).

Thanks again for your time.

Pantelis

 

0 Kudos
Zhen_Z_Intel
Employee
878 Views

Hi Pantelis,

Glad to hear the linking warning has been solved, it is very unusual problem, I did't meet before when I choose to use MKL2017 and compiler 17.0.

On the other hand, the meaning of malloc error message is that you might allocate memory space for same pointer twice, before you free it. It might not affect result, but may lead to memory leak or other memory problems when you process large amount of data. My advice is checking with your source code, or you could submit your code to me.

Best regards,
Fiona

0 Kudos
Pantelis_I_
Beginner
878 Views

Hi,

If you could take a look at my code, that would be great.

I am not sure what is the best way to share the code, so I put everything in a .zip file. It is just a toy example based on a tutorial example available online, however it would be really instructive for me to see how is properly done what I am trying to do.

Thanks so much for your patience and expert advice.

Best,

Pantelis

0 Kudos
Zhen_Z_Intel
Employee
878 Views

Hi Pantelis,

I tested your project with system environment listed below, however I could not reproduce your problem. There's no any problem with your code. Seems not the problem of MKL nor Intel compiler.

Environment:
OS X EL Captian 10.11.5
Processor: 2GHz
Memory: 8GB

While the program has been executed the memory raised around to 100M. I wonder while you run the program, could you make sure you have enough memory space? Some large size of heap objects may lead to this error "malloc: Attempted to register zone more than once: 0x7fff587b18b0" in some version of IOS, for instance ios9.1. Please check with your ios version and also try to test that just allocate large number of space and free them directly. If this problem still remains, try to use MKL function mkl_thread_free_buffer() within each thread and call mkl_free_buffer() to empty all space allocated for mkl functions at the end of program. Please view link to learn more information about MKL memory management methods. Thank you.

Best regards,
Fiona

0 Kudos
Pantelis_I_
Beginner
878 Views

Hi Fiona,

Thanks a lot for looking into the issue.

I should have isolated the memory aspect before I uploaded my code: I get the same message even when I only allocate once three tiny arrays (4 elements each). Moreover, it seems strange to me that the warning appears before any other statement in main() is executed. For example, the code I am attaching results in the same warning.

In any case, thank you very much for looking at my code and for the references to the memory management functions. I will read about them.

I will also try compiling with the latest version (2017) of Parallel Studio.

Best regards,

Pantelis

0 Kudos
Reply