About OpenMPI
OpenMPI is a free, open-source, and high-performance MPI implementation that is compatible with the MPI-1 and MPI-2 standards, and also has the complete MPI-3. 1 standard. OpenMPI is developed and maintained by an open-source community, and supports most types of HPC platforms.
Benchmark Test
- Download the OpenMPI source code package and extract it, then enter the folder where the OpenMPI source code is stored.
wget https://download.open-mpi.org/release/open-mpi/v4.1/openmpi-4.1.5.tar.gz
tar -xzvf openmpi-4.1.5.tar.gz
- Execute
./configure
If there are no errors during the configuration process, it means that the configuration check has passed and the compilation can proceed.
- Then compile the source code and install it:
make -j[Decide the number of threads used]
sudo make install
Next, try to run mpicc and check the version number. The result shows an error in libopen-pal:
Installing libopenblas-dev should solve the problem (if there is an option for configuration, keep the default settings)
sudo apt install libopenblas-dev
If the version numbers are displayed after running mpicc --version
and mpirun --version
again, it means the installation was successful.
Test!!
OpenMPI provides a lot of sample code for us to test, covering C, C + +, and even Java language (yes, you read that right, there’s Java language, such as Hello. java files). However, in this tutorial, we will not use Java for now, and we will only use C and C + + code.
Compile all examples (compile all examples under the example
folder):
make -j[not exceed the maximum number of cores]
Execute mpirun-np 16 ring_ Usempi
. If the following content appears, it indicates that the compilation is successful.
Of course, you can also compile a separate example written in C language
mpicc ring_c.c -o ring_c
mpirun -np 16 ring_c
Next, I tried to compile a C++ program using mpicxx alone, but it failed to compile. After investigation, I found that the --enable-mpi-cxx
parameter was not included when configuring. Therefore, I need to reconfigure and compile with this parameter to fix the problem.
Conclusion
- If a library is missing during the configure process, install the corresponding library and then recompile.
- If libopen-pal or other related errors are displayed, install libopenblas-dev and try again.
- If ./configure is not accompanied by the --enable-mpi-cxx parameter, subsequent compilation of C++ MPI programs will fail.
- Running OpenMPI on the RISC-V platform is just the beginning for RISC-V to enter the HPC world, and with the support of SG2042’s 64 cores, it can make high-performance computing applications run more smoothly.
References
OpenMPI Official Download:
Open MPI: Version 4.1
OpenMPI——SJTU User Manual
OpenMPI - 上海交大超算平台用户手册 Documentation
Translate From: RISC-V公测平台发布:如何在SG2042上玩转OpenMPI