0

私は C++ で書かれた 2 つの独立したプログラムを持っており、ランタイム中にある種のインターフェースを介して結合する必要があります。以下に疑似コードでスケッチしてみました。

program1.cpp:

program1(){
   initializeProgram1();

   for (i = 0; i < nIterations; i ++){
        A = veryComplexParallelCalculation();
        postProcessAndOutput(A);
   }

   finishProgram1();
}

program2.cpp:

program2(){
   prepareProgram2();
   for (i = 0; i < nIterations; i ++){
        B = evenMoreComplexParallelCalculation();
        OutputAndPostProcess(B);
   }

   finishProgram2();

}

実行時に iteration の同じ値でのprogram1.cpp結果を使用する別の関数をループに追加する必要があります。たとえば、2 つのプログラムの変更されたループは次のようになります。program2.cppi

for (i = 0; i < nIterations; i ++){
        A = veryComplexParallelCalculation();
        postProcessAndOutput(A);

        //iB is the iteration number from program2
        getBfromProgram2(B, iB);
        if (iB == i )
            C = foo(A ,B);

}

そして、その中program2.cppには次のようなものがあります

   for (i = 0; i < nIterations; i ++){
        B = evenMoreComplexParallelCalculation();
        OutputAndPostProcess(B);

        //send data and iteration number to program1
        sendBtoProgram1(B, i);

        doSomeOtherStuff();
   }

Bそのため、program2 の実行時に変数をキャッチして program1 に送信できるかどうか疑問に思っています。2 つのプログラムは、マージできない 2 つの巨大なプロジェクトであることに注意してください。

それとも、ある種のインターフェースまたはラッパーを使用できますか (ある種のインタープログラム MPI_Send/Recv:)? ファイルとの入出力についても考えていました。私はそれについてのアイデアを高く評価します。

4

0 に答える 0