0

我需要使用 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;
}
4

1 回答 1

0

MPI 只是另一个库,所以没有魔法。您的代码应如下所示:

初始化 MPI

if(rank == 0) 初始化你的 GUI;

而(1){

如果(排名 == 0)获取输入;

对输入执行 MPI 计算

确保排名 0 以最终结果结束

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

}

if(rank == 0) 清理 GUI;

清理 MPI

于 2010-03-18T15:21:58.093 回答