-비주얼스튜디오를 설치하고 WIn 32 c++ 어플리케이션을 만든다.

-만들때 Precomfiled Header와 Empty Project 옵션을 끈다

-SOultion Explore를 보면 Header files, Resource Files, Source Files 이렇게 세 폴더가 있다.

-Source Files에 오른 클릭하고 아이템 추가를 선택한다.

-c++ File을 선택하는데, 확장자를 cpp가 아닌 c로 한다.

-책의 코드를 복붙한다.

#include 
#include 
int hello(void);
int main(void)
{
return hello();
}
int hello(void)
{
int rank, size;
// Standard MPI initialisation
MPI_Init(NULL, NULL);
MPI_Comm_size(MPI_COMM_WORLD, &size);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
// Prints out hello from each process
printf("Hello from rank %d out of %d\n", rank, size);
MPI_Finalize();
return 0;
}

-상단 탭의 빌드에서 프로그램을 빌드한다.

-만들어진 exe 파일의 폴더로 가서 다음 명령어를 명령창에서 실행한다.

mpiexec -n 4 ./mpihello.exe

Posted by 타다키치
,