问题描述
我正在尝试将Ipopt与Intel MKL(说明).
I'm trying to link Ipopt with Intel MKL (instructions).
英特尔的链接顾问建议:
链接行:
-Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_core.a ${MKLROOT}/lib/intel64/libmkl_intel_thread.a -Wl,--end-group -lpthread -lm -ldl
编译器选项:
-DMKL_ILP64 -qopenmp -I${MKLROOT}/include
我尝试使用以下方法配置Ipopt:
I try to configure Ipopt with:
../configure CXX=icpc CC=icc F77=ifort --with-blas=" -Wl,--start-group ${MKLROOT}/lib/intel64/libmkl_intel_ilp64.a ${MKLROOT}/lib/intel64/libmkl_core.a ${MKLROOT}/lib/intel64/libmkl_intel_thread.a -Wl,--end-group -lpthread -lm -ldl" CXXFLAGS=" -DMKL_ILP64 -qopenmp -I${MKLROOT}/include"
这最终失败,表明:
checking whether user supplied BLASLIB=[text above] does not work
推荐答案
首先,您需要确保正确安装和配置了MKL,如下所示.
First you need to make sure that MKL is correctly installed and configured as shown here.
https://软件.intel.com/en-us/get-started-with-parallel-studio-xe-for-linux
一种永久的方法是将以下行放入 .bashrc
或 .profile
A permanent way is to put the following line in your .bashrc
or .profile
source /opt/intel/parallel_studio_xe_2016.<##>.<###>/psxevars.sh intel64
您可以使用以下cmdline检查MKL是否已准备就绪.它应该显示有效的MKL安装目录.
You could use the following cmdline to check if MKL is ready. It should display the valid MKL installation dir.
$ echo $MKLROOT
如果您使用的是MKL链接行顾问程序,为什么不完全按照说明进行操作?我注意到您错过了链接选项中的OpenMP lib -liomp5
和整个编译选项.
我可以通过以下方式使用单个动态MKL构建Ipopt:
I can build Ipopt with single dynamic MKL by
$ mkdir build
$ cd build
$ ../configure --with-blas=' -Wl,--no-as-needed -L${MKLROOT}/lib/intel64 -lmkl_rt -lpthread -lm -ldl' CFLAGS=' -m64 -I${MKLROOT}/include' CXXFLAGS=' -m64 -I${MKLROOT}/include'
,并带有动态MKL,
$ mkdir build
$ cd build
$ ../configure --with-blas='-Wl,--no-as-needed -L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_core -lmkl_intel_thread -liomp5 -lpthread -lm -ldl' CFLAGS=' -m64 -I${MKLROOT}/include' CXXFLAGS=' -m64 -I${MKLROOT}/include'
但是它不适用于静态MKL.
But it does not work with static MKL.
以上设置仅适用于gcc编译器.
The above settings only work with gcc compiler.
具有icc编译器的动态MKL也可以使用以下设置.
Dynamic MKL with icc compiler also works with the following setting.
$ mkdir build
$ cd build
$ ../configure --with-blas=' -L${MKLROOT}/lib/intel64 -lmkl_intel_ilp64 -lmkl_core -lmkl_intel_thread -lpthread -lm -ldl' CFLAGS=' -DMKL_ILP64 -qopenmp -I${MKLROOT}/include' CXXFLAGS=' -DMKL_ILP64 -qopenmp -I${MKLROOT}/include' CC=icc CXX=icpc
这篇关于将Ipopt与Intel MKL关联的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!