Visual c++ 带有VC++;桂?

Visual c++ 带有VC++;桂?,visual-c++,mpi,Visual C++,Mpi,我需要使用MPICH2(64位,如果您不知道的话)编写一个应用程序。GUI是完全可选的,但当然是一个巨大的优势。mpiexec在运行托管VC++代码时会遇到任何困难吗?我在编译/链接(调用约定等)时是否还会遇到其他问题 为了给你一个想法,该计划的总体结构如下: int main(array<System::String ^> ^args) { /* Get MPI rank */ if ( rank == 0 ) { // Enabling

我需要使用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;
}
int main(数组^args)
{
/*获得MPI等级*/
如果(秩==0)
{
//在创建任何控件之前启用Windows XP视觉效果
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
//创建主窗口并运行它
//以Form1的代码发送/接收消息
应用程序::运行(gcnewform1());
}
其他的
{
/*仅向进程#0发送/接收消息*/
}
返回0;
}

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;
}
初始化MPI

如果(rank==0)初始化GUI

而(1){

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

对输入执行MPI计算

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

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

}

如果(秩==0)清理GUI

清理MPI