## 依賴 sudo apt install build-essential hwloc libhwloc-dev libevent-dev gfortran ## 編譯 OpenBLAS ``` $ git clone https://github.com/xianyi/OpenBLAS.git $ cd OpenBLAS $ git checkout v0.3.21 $ make $ make PREFIX=$HOME/opt/OpenBLAS install ``` ::: warning make不了 ![image](https://hackmd.io/_uploads/r1-hrrFJxx.png) 應該是虛擬機記憶體不足造成 ::: :::success 在增加記憶體後成功 ![image](https://hackmd.io/_uploads/HylnXnY1xx.png) 測試 ![image](https://hackmd.io/_uploads/rkVp4nt1lg.png) ::: ## 編譯OpenMPI ``` $ wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.4.tar.gz $ tar xf openmpi-4.1.4.tar.gz $ cd openmpi-4.1.4 $ CFLAGS="-Ofast -march=native" ./configure --prefix=$HOME/opt/OpenMPI $ make -j 16 $ make install ``` ## 設定環境變數 ``` export MPI_HOME=$HOME/opt/OpenMPI export PATH=$PATH:$MPI_HOME/bin export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$MPI_HOME/lib ``` source ~/.bashrc ## 編譯HPL 下載 ``` $ wget https://netlib.org/benchmark/hpl/hpl-2.3.tar.gz $ gunzip hpl-2.3.tar.gz $ tar xvf hpl-2.3.tar $ rm hpl-2.3.tar $ mv hpl-2.3 ~/hpl ``` 編譯 ``` $ cd hpl/setup $ sh make_generic $ cp Make.UNKNOWN ../Make.linux $ cd ../ # Specify the paths to libraries $ nano Make.linux ``` 修改makefile ``` ARCH = linux MPdir = $(HOME)/opt/OpenMPI MPinc = -I$(MPdir)/include MPlib = $(MPdir)/lib/libmpi.so LAdir = $(HOME)/opt/OpenBLAS LAinc = LAlib = $(LAdir)/lib/libopenblas.a ``` $ make arch=linux ::: warning 不知道哪來的空格 ![image](https://hackmd.io/_uploads/rJZhh3t1ee.png) ::: :::success 它偷偷藏在後面 ``` # MPdir =$(HOME)/opt/OpenMPI MPinc =-I$(MPdir)/include MPlib =$(MPdir)/lib/libmpi.so # ``` ::: 編譯成功 ![image](https://hackmd.io/_uploads/rkvCW6K1gx.png) - 單cpu ![image](https://hackmd.io/_uploads/S12b2Y51ex.png) - 多cpu ``` mpirun -np 2 ./xhpl ``` ![image](https://hackmd.io/_uploads/BJJqdQjJlx.png) ![image](https://hackmd.io/_uploads/r1UncQiygx.png) ![image](https://hackmd.io/_uploads/SyA0aQjyeg.png) - 多節點(cluster) ``` mpirun --hostfile ./hosts.list ./xhpl ``` ::: warning 由於重新編譯HPL,openMPI版本不同 => Segmentation fault ![image](https://hackmd.io/_uploads/Bkukidjygl.png) ![image](https://hackmd.io/_uploads/rJg9cOikeg.png) ![image](https://hackmd.io/_uploads/HyKFquoklg.png) ::: ::: danger ![image](https://hackmd.io/_uploads/HybUF8AJee.png) orted是MPI的輔助程式 ::: ::: warning ![image](https://hackmd.io/_uploads/H1ASeDCkle.png) 非互動式ssh讀不到環境變數 In a non-interactive shell, `.bashrc` and `.profile` files do not get executed. This is because these files usually contain setup commands that are meant to be run when a user logs in, such as setting environment variables or defining aliases. Since a non-interactive shell doesn’t have a user to log in, these files aren’t needed. => `.bashrc` 前面有一段是遇到非互動式ssh會直接return,所以要在這段前面改環境變數。 ![image](https://hackmd.io/_uploads/rkGU0qJeex.png) ::: =>可以直接指定 ![image](https://hackmd.io/_uploads/BJmWkVkxgg.png) ::: success ![image](https://hackmd.io/_uploads/Hk24MYJxxe.png) ![image](https://hackmd.io/_uploads/Bk26wFkegg.png) ::: ### 編譯intel MKL ### To do MPI的參數編譯 可以更換OpenBLAS(MKL) HPL.dat的參數測試 用更好的CPU(更多核心)測試 嘗試module file、腳本 ### 參數調校 ``` ================================================================================ T/V N NB P Q Time Gflops -------------------------------------------------------------------------------- WR11R2R4 18000 512 1 4 196.45 1.9794e+01 HPL_pdgesv() start time Sat May 24 15:54:34 2025 HPL_pdgesv() end time Sat May 24 15:57:51 2025 -------------------------------------------------------------------------------- ||Ax-b||_oo/(eps*(||A||_oo*||x||_oo+||b||_oo)*N)= 2.08450229e-03 ...... PASSED ================================================================================ ``` ### 參考連結 -[(https://www.mgaillard.fr/2022/08/27/benchmark-with-hpl.html)](https://www.mgaillard.fr/2022/08/27/benchmark-with-hpl.html)