CMake的:选择mpich而不是openmpi [英] CMake : Selecting mpich over openmpi

查看:121
本文介绍了CMake的:选择mpich而不是openmpi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用cmake 3.10.2.我同时安装了openmpi和mpich.但是我只需要加载mpich.因此,我从文档中发现了以下内容

I am using cmake 3.10.2. I have both openmpi and mpich installed. However I need to load only mpich. So I found from the documentation the following

MPI_EXECUTABLE_SUFFIX

后缀,该后缀附加在要查找的所有名称之后.例如,您可以将其设置为.mpich或.openmpi来选择一个或另一个关于Debian及其衍生版本的信息.

A suffix which is appended to all names that are being looked for. For instance you may set this to .mpich or .openmpi to prefer the one or the other on Debian and its derivatives.

我的CMake文件是这样的

My CMake file goes like this

set(MPI_EXECUTABLE_SUFFIX ".mpich")
FIND_PACKAGE(MPI REQUIRED)
INCLUDE_DIRECTORIES(${MPI_INCLUDE_DIRS})
LINK_DIRECTORIES(${MPI_LIBRARY_DIRS})
message(${MPI_INCLUDE_PATH})

无论如何显示

/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/usr/lib/x86_64-linux-gnu/openmpi/include...

我要去哪里错了.您能帮我吗

Where am I going wrong. Could you please help me with this

mpicc -show
gcc -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent -I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi/opal/mca/event/libevent2022/libevent/include -I/usr/lib/x86_64-linux-gnu/openmpi/include -pthread -L/usr//lib -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi

mpicc.mpich -show
gcc -Wl,-Bsymbolic-functions -Wl,-z,relro -I/usr/include/mpich -L/usr/lib/x86_64-linux-gnu -lmpich

推荐答案

默认的mpicc不是您的选择.您可以在cmake文件中手动指定它,或使用默认值之前包含的mpicc更新$ PATH变量.我个人将mpich安装在/usr/local/目录中.问候

The default mpicc is not your choice. You can specify it manually in the cmake file, or update the $PATH variable with your mpicc included before the default one. Personally, I installed the mpich in the /usr/local/ directory. Regards

这篇关于CMake的:选择mpich而不是openmpi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆