1. CPU, GPU, Memory 관계 기준
Serial
OpenMP
Accelerator Model
MPI
1. 개요
Message Passing Interface
MPI Implementation
2. MPI Basic Steps
Writing a Program
#include <mpi.h>
Compiling
$ mpicc -o test.exe [-O3] [-march=knl] test.c
mpicc
사용Starting
$ mpirun -np 4 -hostfile hosts ./hello.x
mpirun
으로 실행파일 실행-np
옵션은 실행할 프로세스의 개수 지정-hostfile
옵션은 host 이름을 저장하고 있는 machine file 지정Specify the Machine File
3. Example
C code
#include <stdio.h>
#include <mpi.h>
int main(int argc, char* argv[])
{
// Initialize the library
MPI_Init(&argc, &argv);
// Do some work
printf("Hello world\n");
// Return the resources
MPI_Finalize();
return 0;
}
Result
-np
옵션의 값이 4이므로, Hello World!
가 4번 출력4. Fortran Support
USE mpi_f08
USE mpi
INCLUDE 'mpif.h'