Run-time error: undefined symbol: _intel_fast_memmove

Run-time error: undefined symbol: _intel_fast_memmove

Hello everyone,

I am trying to do something rather exotic. I think I have reached a good point in the process, but now I got stuck.

More specifically, I have a MATLAB program, part of which is very computationally intensive. I have successfully put this part into a MEX file (written in C) and parallelized it using OpenMP. So, the MATLAB part only sets up a bunch of arrays and the time-consuming part is done in the MEX file. Everything fine up to this point.

Now I am trying to offload the code in the MEX file to the Phi that is available on the system and use the parallelized version to run it there. I have managed to insert the offload pragmas into the code and compile the MEX file. But when I try to run it (from within MATLAB of course) I get the following error:

/path/to/mex/file/code_Phi.mexa64': /opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/
undefined symbol: _intel_fast_memmove

I found the above symbol in and linked the MEX file with it, but I am still getting the same error. I got really stuck here and I am not certain what to do. Is the problem on the host side or the Phi side? In either case, does anyone have an idea what I could try to solve it?

I didn't want to fill this message with a lot of information from compilation and linking commands that might not be necessary to solve the problem. If you think they are required, I can provide them.

Best regards,

Ioannis E. Venetis

11 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

The problem appears to be on the host side. Does this link of the MEX file use the icc/icpc compiler driver for linking or does it invoke ld directly where you control the list of libraries that are linked?

Dear Kevin,

Thank you for looking into this. I use icc for the linking stage, not ld.

By the way, the version of icc I use is 14.0.2 (if this helps).

Best regards,

Ioannis E. Venetis

Ok, that's good to hear. I will need to see some details. Let's start with the linking. Can you share with me the linking commands?

imagem de Ravi Narayanaswamy (Intel)

is the path to in LD_LIBRARY_PATH

The compilation and linking is done through MATLAB, calling the command 'mex'. I assume it is some kind of wrapper. The actual commands executed are as follows. Most of the parameters are included by 'mex'. I only added -fopenmp and -lintlc.


icc -c  -I/path/to/Matlab_R2013a/bin/matlab/extern/include -I/path/to/Matlab_R2013a/bin/matlab/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE  -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c99 -fopenmp  -DMX_COMPAT_32 -O3 -DNDEBUG  "code_Phi.c"


icc -O3 -pthread -shared -Wl,--version-script,/path/to/opt/Matlab_R2013a/bin/matlab/extern/lib/glnxa64/ -Wl,--no-undefined -fopenmp -o  "code_Phi.mexa64"  code_Phi.o  -Wl,-rpath-link,/path/to/Matlab_R2013a/bin/matlab/bin/glnxa64 -L/path/to/Matlab_R2013a/bin/matlab/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++ -lintlc

In case it is useful, running ldd on the produced mexa64 file gives:

$  ldd code_Phi.mexa64 =>  (0x00007ffffbbff000) => not found => not found => not found => /lib64/ (0x00007f50a63d7000) => /usr/lib64/ (0x00007f50a60d0000) => /opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/ (0x00007f50a5e7a000) => /opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/ (0x00007f50a59b7000) => /opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/ (0x00007f50a4dbb000) => /opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/ (0x00007f50a4bb4000) => /opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/ (0x00007f50a489c000) => /opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/ (0x00007f50a466a000) => /opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64/ (0x00007f50a442b000) => /lib64/ (0x00007f50a4215000) => /lib64/ (0x00007f50a3ff7000) => /lib64/ (0x00007f50a3c63000) => /lib64/ (0x00007f50a3a5f000)
        /lib64/ (0x0000003dcc400000), and are MATLAB libraries and are found when the mexa64 file is loaded from within MATLAB for execution. I had never a problem with these.

@Ravi: I execute 'source /opt/intel/bin/ intel64' before running anything else. This should set up LD_LIBRARY_PATH, which is as follows:


Ioannis E. Venetis

Hello again,

It seems that I finally managed to overcome the problem. I modified the linking flags and now the linking command is:

icc -O3 -pthread -shared -Wl,--version-script,/path/to/opt/Matlab_R2013a/bin/matlab/extern/lib/glnxa64/ -Wl,--no-undefined -fopenmp -o  "code_Phi.mexa64"  code_Phi.o  -Wl,-rpath-link,/path/to/Matlab_R2013a/bin/matlab/bin/glnxa64 -L/path/to/Matlab_R2013a/bin/matlab/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++ -Wl,-rpath,/opt/intel/composer_xe_2013_sp1.2.144/compiler/lib/intel64 -lintlc

Adding the -rpath option to the linker seems to fix the problem. And I say 'seems' because now I have a new issue. When the code runs on the Phi with 224 threads it is actually slower compared to the case when it runs on the 8 available threads of the CPU (1x i7-3770 @3.40GHz). Searching on the Internet I found that this might happen when native x86 code executes on the Phi (at least that is what I understood). If so, how can I check what kind of code is sent and executed on the Phi? Is there anything else I should check to make certain that things are compiled/linked/executed as required?

Best regards,

Ioannis E. Venetis

You shouldn't need rpath if you have set up the PATHs correctly according to sourceing compilervars.

It would be rather difficult to run host CPU code on the MIC, not something you are likely to accomplish by accident, nor in an offload compilation mode.

It would be important to verify, at least by opt-report, whether your important code is both vectorized and parallelized for MIC; otherwise MIC is unlikely to prove beneficial.  I guess that fits into your "what kind of code" category.

If your code needs only 8 host threads, there are additional likely reasons why you may not get a gain on MIC, at least not by accident.

If you succeed in offloading a large enough case with a high enough ratio of MIC local computation to data transfer, you may still need to optimize the MIC_PREFIX, MIC_KMP_PLACE_THREADS, MIC_OMP_PROC_BIND environment settings.


You shouldn't need rpath if you have set up the PATHs correctly according to sourceing compilervars.

That was my understanding too. But after reading the documentation about rpath I just thought to try it as it looked relevant. And it worked.

With respect to the code, the 8 threads case on the CPU requires about 330sec to run. When running the code on the Phi I ssh'd into mic0 and top verified that there are 224 threads running. But it takes 430sec to complete. Data transferred is about 25MB. It shouldn't need that much time to transfer, especially when compared to the total execution time.

The code is relatively simple. A series of nested loops, with the outermost loop having no data dependencies and having a lot of iteration (about 250000). Only synchronization required is at the end of each step where a calculated value has to be added to an element of an array, with that element being potentially updated by more threads. I use atomic for that. So, parallelization is straightforward. I get almost linear speedup on every system I have tried. That's why I am puzzled with the performance on the Phi.

Best regards,

Ioannis E. Venetis

imagem de jimdempseyatthecove

What happens to performance when you comment out the atomic update?

Do your vectorization reports indicate that the inner loop is not vectorized?

Jim Dempsey

Intel(r) Xeon Phi(tm) has different threading scaling characteristiics from other multi-core platforms, so you still need to investigate, e.g.





and so on, information which would help avoid a lot of speculation here.

I'm assuming you have 57 cores, where offload mode would default to using 56 of them for the application.

Faça login para deixar um comentário.