Linux

openmpi 사용법 (Open MPI:Open Source High Performance Computing)

Naan 2023. 3. 9. 00:15
반응형

openmpi 설치 방법 Open MPI:Open Source High Performance Computing

master PC 하나 slave PC 하나 총 2개 장비를 셋팅을 하자.

master PC 에도

키를 우선 만들자.

$ ssh-keygen -t rsa -P ""
Generating public/private rsa key pair.
Enter file in which to save the key (/home/sim716/.ssh/id_rsa):
/home/test6/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Your identification has been saved in /home/test6/.ssh/id_rsa.
Your public key has been saved in /home/test6/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:LN+d4HkhLzWQhgh6aI0pZvOQ5hLyPzBPLU test6@test6
The key's randomart image is:
+---[RSA 3072]----+
| oo .            |
|.  *.. . . .     |
| o*+o.. . +      |
|++==+E o o B +   |
|.=..o.  . = =    |
|. +.       o     |
|   .             |
+----[SHA256]-----+

그리고 키를 복사해주자.

scp ~/.ssh/id_rsa.pub ss@devi-linux:.ssh/authorized_keys

 

에러1

orted: Command not found.
--------------------------------------------------------------------------
ORTE was unable to reliably start one or more daemons.
This usually is caused by:

위와 같이 에러 발생 한다면 해당 장비에 openmpi 가 미설치 되서 그렇다 설치 해주자.

 

에러2

$ mpirun --host localhost -n 2 ./test
--------------------------------------------------------------------------
There are not enough slots available in the system to satisfy the 2
slots that were requested by the application:

  ./test

Either request fewer slots for your application, or make more slots
available for use.

A "slot" is the Open MPI term for an allocatable unit where we can
launch a process.  The number of slots available are defined by the
environment in which Open MPI processes are run:

  1. Hostfile, via "slots=N" clauses (N defaults to number of
     processor cores if not provided)
  2. The --host command line parameter, via a ":N" suffix on the
     hostname (N defaults to 1 if not provided)
  3. Resource manager (e.g., SLURM, PBS/Torque, LSF, etc.)
  4. If none of a hostfile, the --host command line parameter, or an
     RM is present, Open MPI defaults to the number of processor cores

In all the above cases, if you want Open MPI to default to the number
of hardware threads instead of the number of processor cores, use the
--use-hwthread-cpus option.

Alternatively, you can use the --oversubscribe option to ignore the
number of available slots when deciding the number of processes to
launch.

이상하다.

$ mpirun -np 10 ./test
Processor name: localhost
slave  (3/10)
Processor name: localhost
slave  (6/10)
Processor name: localhost
slave  (2/10)
Processor name: localhost
Processor name: localhost
slave  (8/10)
master (0/10)
Processor name: localhost
slave  (1/10)
Processor name: localhost
slave  (4/10)
Processor name: localhost
slave  (5/10)
Processor name: localhost
slave  (9/10)
Processor name: localhost
slave  (7/10)

host 등록해서 사용하면 2개 이상 구동시 위와 같이 에러가 발생 한다. 이상하다.

해결 방법은 옵션을 추가 하면 된다.

$ mpirun --host localhost -np 10 --oversubscribe ./test

위와 같이 명령어를 추가 해주면 된다. --oversubscribe

반응형