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

Build Scipy With MKL failed

zz
Beginner
806 Views

I use command to build numpy first:

python %MYPWD%/%NUMPY_VER%/setup.py config  --compiler=msvc build_clib --compiler=msvc  build_ext

the site.cfg content is:

[mkl]
library_dirs = C:\Program Files (x86)\Intel\Composer XE 2015\mkl\lib\intel64
include_dirs = C:\Program Files (x86)\Intel\Composer XE 2015\mkl\include
mkl_libs = mkl_rt
lapack_libs = 

Then I build scipy with command:

python %MYPWD%/%SCIPY_VER%/setup.py config  --compiler=msvc build_clib --compiler=msvc  build_ext

 

It failed with message:

_fftpackmodule.obj : warning LNK4197: export 'init_fftpack' specified multiple times; using first specificatio
n
   Creating library build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\scipy\fftpack\_fftpack.lib and ob
ject build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\scipy\fftpack\_fftpack.exp
zfft.obj : error LNK2019: unresolved external symbol zfftf_ referenced in function zfft
zfft.obj : error LNK2019: unresolved external symbol zfftb_ referenced in function zfft
zfft.obj : error LNK2019: unresolved external symbol zffti_ referenced in function get_cache_id_zfft
zfft.obj : error LNK2019: unresolved external symbol cfftf_ referenced in function cfft
zfft.obj : error LNK2019: unresolved external symbol cfftb_ referenced in function cfft
zfft.obj : error LNK2019: unresolved external symbol cffti_ referenced in function get_cache_id_cfft
drfft.obj : error LNK2019: unresolved external symbol dfftf_ referenced in function drfft
drfft.obj : error LNK2019: unresolved external symbol dfftb_ referenced in function drfft
drfft.obj : error LNK2019: unresolved external symbol dffti_ referenced in function get_cache_id_drfft
drfft.obj : error LNK2019: unresolved external symbol rfftf_ referenced in function rfft
drfft.obj : error LNK2019: unresolved external symbol rfftb_ referenced in function rfft
drfft.obj : error LNK2019: unresolved external symbol rffti_ referenced in function get_cache_id_rfft
dct.obj : error LNK2019: unresolved external symbol costi_ referenced in function get_cache_id_dct1
dct.obj : error LNK2019: unresolved external symbol cost_ referenced in function dct1
dct.obj : error LNK2019: unresolved external symbol cosqi_ referenced in function get_cache_id_dct2
dct.obj : error LNK2019: unresolved external symbol cosqb_ referenced in function dct2
dct.obj : error LNK2019: unresolved external symbol cosqf_ referenced in function dct3
dct.obj : error LNK2019: unresolved external symbol dcosti_ referenced in function get_cache_id_ddct1
dct.obj : error LNK2019: unresolved external symbol dcost_ referenced in function ddct1
dct.obj : error LNK2019: unresolved external symbol dcosqi_ referenced in function get_cache_id_ddct2
dct.obj : error LNK2019: unresolved external symbol dcosqb_ referenced in function ddct2
dct.obj : error LNK2019: unresolved external symbol dcosqf_ referenced in function ddct3
dst.obj : error LNK2019: unresolved external symbol sinti_ referenced in function get_cache_id_dst1
dst.obj : error LNK2019: unresolved external symbol sint_ referenced in function dst1
dst.obj : error LNK2019: unresolved external symbol sinqi_ referenced in function get_cache_id_dst2
dst.obj : error LNK2019: unresolved external symbol sinqb_ referenced in function dst2
dst.obj : error LNK2019: unresolved external symbol sinqf_ referenced in function dst3
dst.obj : error LNK2019: unresolved external symbol dsinti_ referenced in function get_cache_id_ddst1
dst.obj : error LNK2019: unresolved external symbol dsint_ referenced in function ddst1
dst.obj : error LNK2019: unresolved external symbol dsinqi_ referenced in function get_cache_id_ddst2
dst.obj : error LNK2019: unresolved external symbol dsinqb_ referenced in function ddst2
dst.obj : error LNK2019: unresolved external symbol dsinqf_ referenced in function ddst3
build\lib.win-amd64-2.7\scipy\fftpack\_fftpack.pyd : fatal error LNK1120: 32 unresolved externals

 

Please give me your suggestion if you have experience about this. Thanks

 

0 Kudos
8 Replies
zz
Beginner
806 Views

please help 

Thanks

0 Kudos
Zhang_Z_Intel
Employee
806 Views

Please see this article about building NumPy and SciPy with MKL: https://software.intel.com/en-us/articles/numpyscipy-with-intel-mkl 

The article only discusses building using Intel compilers. But you are using msvc. You may need to make some modifications accordingly. 

Do you specify fftw in site.cfg? Is it in the correct location?

 

0 Kudos
Ying_H_Intel
Employee
806 Views

Hi Zhen Z,

The problem of unresolved external symbol zfftf_ referenced in function zfft_   are related to the different name conversion of C and fortran under windows and linux, 32bit and intel64 bit.  In the source code : there are three micro to control them NO_APPEND_FORTRAN, UPPERCASE_FORTRAN, PREPEND_FORTRAN. 

Here are some related information i found on internet,  

http://mail.scipy.org/pipermail/scipy-user/2011-April/029192.html  => two patch. 

Please check them  or manually to add  either  /DNO_APPEND_FORTRAN' some place

'/DPREPEND_FORTRAN'. /DNO_APPEND_FORTRAN','/DUPPERCASE_FORTRAN'

and let us know how they work. 

Best Regards,

Ying

 

0 Kudos
zz
Beginner
806 Views

Hi, Zhang Z

Can you show me how to specify fftw in site.cfg?

I attached my old site.cfg. 

 

0 Kudos
zz
Beginner
806 Views

Hi, Ying

After add the three options, I got the new error. What's options I can use?

 

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE\mkl\lib\intel64" /LIBPATH:S:\sc\EEsofTools\Windows\vs2012\win32_64\python\2.7.3\win32_64\release\python\libs /LIBPATH:S:\sc\EEsofTools\Windows\vs2012\win32_64\python\2.7.3\win32_64\release\python\PCbuild\amd64 /LIBPATH:build\temp.win-amd64-2.7 /LIBPATH:S:\sc\EEsofTools\Windows\vs2012\win32_64\python\2.7.3\win32_64\release\python\libs /LIBPATH:S:\sc\EEsofTools\Windows\vs2012\win32_64\python\2.7.3\win32_64\release\python\PCbuild\amd64 /LIBPATH:build\temp.win-amd64-2.7 odepack.lib linpack_lite.lib mach.lib mkl_rt.lib /EXPORT:initvode build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\scipy\integrate\vodemodule.obj build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\fortranobject.obj /OUT:build\lib.win-amd64-2.7\scipy\integrate\vode.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\scipy\integrate\vode.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\scipy\integrate\vode.pyd.manifest
vodemodule.obj : warning LNK4197: export 'initvode' specified multiple times; using first specification
   Creating library build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\scipy\integrate\vode.lib and object build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\scipy\integrate\vode.exp
vodemodule.obj : error LNK2001: unresolved external symbol _DVODE
vodemodule.obj : error LNK2001: unresolved external symbol _ZVODE
build\lib.win-amd64-2.7\scipy\integrate\vode.pyd : fatal error LNK1120: 2 unresolved external

 

0 Kudos
Kaushal_S_
Beginner
806 Views

Hi

I'm trying to build scipy-0.15.1 using Visual Studio 2013 (msvc12) against numpy 1.9.1 and Python 2.7.6 x64 all built with Visual Studio 2013.

I'm I was stuck at the same location as well. 

I looked at the symbols in vode.lib and I see the DVODE and ZVODE symbols, but no _DVODE and _ZVODE symbols. Is that the problem? I'll investigate further and see if I can figure this out. That is the problem. You can temporarily undefine PREPEND_FORTRAN macro for vodemodule.

Thanks,
Kaushal

zhen z. wrote:

Hi, Ying

After add the three options, I got the new error. What's options I can use?

 

C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:"C:\Program Files (x86)\Intel\Composer XE\mkl\lib\intel64" /LIBPATH:S:\sc\EEsofTools\Windows\vs2012\win32_64\python\2.7.3\win32_64\release\python\libs /LIBPATH:S:\sc\EEsofTools\Windows\vs2012\win32_64\python\2.7.3\win32_64\release\python\PCbuild\amd64 /LIBPATH:build\temp.win-amd64-2.7 /LIBPATH:S:\sc\EEsofTools\Windows\vs2012\win32_64\python\2.7.3\win32_64\release\python\libs /LIBPATH:S:\sc\EEsofTools\Windows\vs2012\win32_64\python\2.7.3\win32_64\release\python\PCbuild\amd64 /LIBPATH:build\temp.win-amd64-2.7 odepack.lib linpack_lite.lib mach.lib mkl_rt.lib /EXPORT:initvode build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\scipy\integrate\vodemodule.obj build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\fortranobject.obj /OUT:build\lib.win-amd64-2.7\scipy\integrate\vode.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\scipy\integrate\vode.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\scipy\integrate\vode.pyd.manifest
vodemodule.obj : warning LNK4197: export 'initvode' specified multiple times; using first specification
   Creating library build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\scipy\integrate\vode.lib and object build\temp.win-amd64-2.7\Release\build\src.win-amd64-2.7\scipy\integrate\vode.exp
vodemodule.obj : error LNK2001: unresolved external symbol _DVODE
vodemodule.obj : error LNK2001: unresolved external symbol _ZVODE
build\lib.win-amd64-2.7\scipy\integrate\vode.pyd : fatal error LNK1120: 2 unresolved external

 

0 Kudos
zz
Beginner
806 Views

I have build three times to finish it.

1   genreal build with no option to change upper/lower case

2   run build with option ""-DUPPERCASE_FORTRAN  -DNO_APPEND_FORTRAN -DPREPEND_FORTRAN "

3   run build again with option ""-DUPPERCASE_FORTRAN  -DNO_APPEND_FORTRAN "

Hope this can help you.

 

Below is part of my build script:

 

pushd %MYPWD%\%SCIPY_VER%

python %MYPWD%/%SCIPY_VER%/setup.py clean --all

python %MYPWD%/%SCIPY_VER%/setup.py config  --compiler=msvc --fcompiler=intelvem build_clib --compiler=msvc --fcompiler=intelvem build_ext >> %MYPWD%\build1.log
 
python %MYPWD%/%SCIPY_VER%/setup.py config  --compiler=msvc --fcompiler=intelvem build_clib --compiler=msvc --fcompiler=intelvem build_ext "-DUPPERCASE_FORTRAN  -DNO_APPEND_FORTRAN -DPREPEND_FORTRAN ">> %MYPWD%\build2.log
 
python %MYPWD%/%SCIPY_VER%/setup.py config  --compiler=msvc --fcompiler=intelvem build_clib --compiler=msvc --fcompiler=intelvem   build_ext "-DUPPERCASE_FORTRAN  -DNO_APPEND_FORTRAN "   >> %MYPWD%\build3.log

0 Kudos
Yuan_C_Intel
Employee
806 Views

Hi, Zhen and Kaushal

The two Fortran compiler options: "/Qlowercase /us" used in numpy scripts are already removed from Intel(R) Visual Fortran 15.0.

The suggested replacement are /names:lowercase and /assume:underscore

Try update numpy\distutils\fcompiler\intel.py:

Under class IntelVisualFCompiler(BaseIntelFCompiler):

Change:

    def get_flags(self):

        opt = ['/nologo', '/MD', '/nbs', '/Qlowercase', '/us']

to:

    def get_flags(self):

        opt = ['/nologo', '/MD', '/nbs', '/names:lowercase', '/assume:underscore']

Build and install passed successfully. 

Thanks

0 Kudos
Reply