MPI程序与VC ++ GUI?

时间:2010-03-16 14:27:34

标签: visual-c++ mpi

我需要使用MPICH2编写应用程序(64位,以防您想知道)。 GUI完全是可选的,但当然是一个巨大的优势。 mpiexec在运行托管VC ++代码时会遇到什么困难吗?编译/链接(调用约定等)可能会遇到其他问题吗?

只是为了给你一个想法,程序的一般结构将是这样的:

int main(array<System::String ^> ^args)
{
    /* Get MPI rank */

    if ( rank == 0 )
    {
        // Enabling Windows XP visual effects before any controls are created
        Application::EnableVisualStyles();
        Application::SetCompatibleTextRenderingDefault(false); 

        // Create the main window and run it
        // Send/receive messages in Form1's code
        Application::Run(gcnew Form1());
    }
    else
    {
        /* Send/receive messages to/from process #0 only */
    }
    return 0;
}

1 个答案:

答案 0 :(得分:0)

MPI只是另一个图书馆,所以没有魔力。您的代码应如下所示:

init MPI

如果(rank == 0)初始化您的GUI;

while(1){

if(rank == 0)得到输入;

在输入上执行MPI计算

确保排名0以最终结果

结束

if(rank == 0)在GUI上显示结果;

}

if(rank == 0)清理GUI;

清理MPI