您可以从终端在多个进程中运行程序。如果你使用Cygwin的MPI,你可以在Cygwin的终端试试这个:
> cd ThreadsandMPI/MPI/HellowWorld/
> rm helloworld.exe # if it exists, delete it
> mpic++ helloworld.cpp -o helloworld.exe
> mpirun -np 4 helloworld.exe # run 4 processes
但是,如果你想做到这一点不留IDE这是可能的。你需要创建一个名为MPI.xml
(在C:\Users\<yourUserName>\.clion\config\tools
文件夹)文件,该文件将包含这样的代码:
<?xml version="1.0" encoding="UTF-8"?>
<toolSet name="MPI">
<tool name="mpic++" description="MPI C++ compiler" showInMainMenu="true" showInEditor="true" showInProject="true" showInSearchPopup="true" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
<exec>
<option name="COMMAND" value="C:\cygwin64\bin\sh.exe" />
<option name="PARAMETERS" value="-l -c "cd /cygdrive/d/CLion_Projects/$FileDirName$; mpic++ $FileName$ -o $FileNameWithoutExtension$.exe"" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
</exec>
</tool>
<tool name="mpirun" description="Runner for MPI" showInMainMenu="true" showInEditor="true" showInProject="true" showInSearchPopup="true" disabled="false" useConsole="true" showConsoleOnStdOut="false" showConsoleOnStdErr="false" synchronizeAfterRun="true">
<exec>
<option name="COMMAND" value="C:\cygwin64\bin\sh.exe" />
<option name="PARAMETERS" value="-l -c "cd /cygdrive/d/Clion_Projects/$FileDirName$; mpirun -np $Prompt$ -bind-to core:overload-allowed $FileNameWithoutAllExtensions$"" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
</exec>
</tool>
</toolSet>
- 在这个文件
MPI.xml
查找和使用自己的路与克利翁项目 更换2个出现次数的
d/CLion_Projects
到目录
- 确保选项命令(在
cygwin64\bin
文件夹路径sh.exe
)修正值
- 通知,
D:\something
必须d/something
和当然避免路径
空间,这一文件将用于MPI C++编译器mpic++
和转轮MPI mpirun
集成外部工具。 顺便说一下,有关如何通过here设置MPI到Clion的完整说明。