2010-03-16 52 views
0

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

只给你一个想法,方案的总体结构是这样的:

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; 
} 

回答

0

MPI只是另一个库,所以没有什么神奇。你的代码应该是这个样子:

初始化MPI

如果(排名== 0)初始化你的GUI;

而(1){

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

上输入

执行MPI计算确保秩0最终的结果结束了

如果(秩== 0)上GUI显示结果;

}

if(rank == 0)清理GUI;

清理MPI