2010-03-16 30 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