How to run HPL/HPCG/IO500 in WSL (1) | 青训营笔记

367 阅读2分钟

How to run HPL/HPCG/IO500 in WSL

0. PC Info

NameInfo
EditionWindows 11 Pro Insider Preview 64-bit 22H2 (10.0, Build 1000.23451.1000.0) (23451.ni_prerelease.230428-1438)
Processor12th Gen Intel(R) Core(TM) i7-12700H (14 Cores 20 CPUs), ~2.3GHz
Memory16384MB RAM + 18925MB Page File

1. HPL (High-Performance Linpack)

0. Info

NameVersion
OSUbuntu 22.04.2 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64)
GCCgcc version 11.3.0 (Ubuntu 11.3.0-1ubuntu1~22.04.1)
OpenMPI4.1.5
OpenBLAS0.3.23

1. Install WSL

  1. In Windows 11, you can get WSL from Microsoft Store.

  2. Run Ubuntu from the start menu and set a username and password. When finished you will see output like following:

    Installing, this may take a few minutes...
    Please create a default UNIX user account. The username does not need to match your Windows username.
    For more information visit: https://aka.ms/wslusers
    Enter new UNIX username: hangyi
    New password:
    Retype new password:
    passwd: password updated successfully
    The operation completed successfully.
    Installation successful!
    To run a command as administrator (user "root"), use "sudo <command>".
    See "man sudo_root" for details.
    
    Welcome to Ubuntu 22.04.2 LTS (GNU/Linux 5.15.90.1-microsoft-standard-WSL2 x86_64)
    
     * Documentation:  https://help.ubuntu.com
     * Management:     https://landscape.canonical.com
     * Support:        https://ubuntu.com/advantage
    
    
    This message is shown once a day. To disable it please create the
    /home/hangyi/.hushlogin file.
    hangyi@DESKTOP-VHIQPUO:~$
    
  3. You can use the following commands to view system information.

    uname -a && lsb_release -a
    

    Output like this, I use Ubuntu 22.04.2 LTS:

    Linux DESKTOP-VHIQPUO 5.15.90.1-microsoft-standard-WSL2 #1 SMP Fri Jan 27 02:56:13 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description:    Ubuntu 22.04.2 LTS
    Release:        22.04
    Codename:       jammy
    
  4. If you exit, you can run wsl -d Ubuntu --cd ~ to return Ubuntu.

2. Install OpenMPI and OpenBLAS

  1. If you are not confident about your network situation, it is recommended to configure a mirror source.

    sudo sed -i 's@//.*.ubuntu.com@//mirrors.ustc.edu.cn@g' /etc/apt/sources.list
    

    Running the above command will change your source address to the USTC mirror source. You may need to enter the password you set during the WSL installation.

  2. Install the compile tools.

    sudo apt update && sudo apt install -y build-essential gfortran
    
  3. Installing using the package manager should be the easy way out, but the version may be older.

    sudo apt install -y libopenmpi-dev libopenblas-dev
    
  4. Test if the installation was successful:

    gcc --version && gfortran --version && mpirun --version && find /usr -name libmpi.so && find /usr -name libopenblas.a
    

    If the outputs like the following, it's OK:

    gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
    Copyright (C) 2021 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    GNU Fortran (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
    Copyright (C) 2021 Free Software Foundation, Inc.
    This is free software; see the source for copying conditions.  There is NO
    warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    
    mpirun (Open MPI) 4.1.2
    
    Report bugs to http://www.open-mpi.org/community/help/
    /usr/lib/x86_64-linux-gnu/libmpi.so
    /usr/lib/x86_64-linux-gnu/libopenblas.a