Skip to content

Instantly share code, notes, and snippets.

@dirumahrafif
Last active June 4, 2026 14:29
Show Gist options
  • Select an option

  • Save dirumahrafif/3c4e51c80dbc7795c984566c4a783cb1 to your computer and use it in GitHub Desktop.

Select an option

Save dirumahrafif/3c4e51c80dbc7795c984566c4a783cb1 to your computer and use it in GitHub Desktop.
Praktikum MPI

Install Ubuntu melalui wsl

  • Masuk ke command prompt
  • Ketikkan perintah wsl --status
  • Jalankan lagi : wsl.exe --install ubuntu-24.04
  • pastikan sudah terinstall ubuntu 24.04 dengan perintah lsb_release -a
  • Jika ada sebelumnya sudah terinstall Distro lain di WSL ketikkan wsl -l -v kemudian pilih salah satu distro dengan mengetik wsl -d nama_distro

Jalankan proses instalasi Ubuntu

  • update repository sudo apt update
  • install gcc, openmp, dan openssh sudo apt install -y build-essential openmpi-bin libopenmpi-dev openssh-server
  • Enable SSH sudo systemctl enable ssh dan jalankan sudo service ssh start untuk menjalankan ssh
  • Buat user mpi di semua node sudo adduser mpi

Test di Tiap Node

  • Masukkan semua file program ke semua node
  • compile tiap aplikasi di tiap node mpicc 20_mpi-host-detection.c -o 20_mpi-host-detection
  • coba jalankan program 20_mpi-host-detection.c mpirun -np 4 ./20_mpi-host-detection

Test di bagian master

  • Buat key di master jika belum ada ssh-keygen -t ed25519
  • buat koneksi ke semua node supaya tidak perlu masukkan password ssh-copy-id mpi@ip_laptop
  • buat file hosts.txt di server master
ip_laptop_1 slots=2
ip_laptop_2 slots=2
ip_laptop_3 slots=2
ip_laptop_4 slots=2
ip_laptop_5 slots=2
ip_laptop_6 slots=2
  • pastikan bisa terhubung ke semua node mpirun --hostfile hosts.txt -np 6 hostname
  • jalankan program mpirun --hostfile hosts.txt -np 4 --mca btl_tcp_if_include 10.1.248.0/24 ./20_mpi-host-detection
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment