【问题标题】:MPI program with a VC++ GUI?带有 VC++ GUI 的 MPI 程序?
【发布时间】:2011-01-28 03:31:24
【问题描述】:

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

【问题讨论】:

    标签: visual-c++ mpi


    【解决方案1】:

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

    初始化 MPI

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

    而 (1){

    如果(rank == 0)获取输入;

    对输入执行 MPI 计算

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

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

    }

    if(rank == 0) 清理 GUI;

    清理 MPI

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-04
      • 1970-01-01
      • 1970-01-01
      • 2011-01-13
      • 2014-07-13
      • 2015-12-30
      • 2023-03-12
      • 1970-01-01
      相关资源
      最近更新 更多