Skip to content

Installing H2Pack

Huang, Hua edited this page Feb 27, 2021 · 15 revisions

To compile H2Pack, you will need the following:

  • 64-bit processor
  • C compiler that supports the GNU C11 standard and OpenMP 3.0 (most C compilers after 2015)
  • BLAS and LAPACK libraries (most HPC systems provide them)

We have tested the following combinations:

Processor Operating System Compiler BLAS Library LAPACK Library
Intel Xeon Platinum 8160 (AVX-512) CentOS 7.6 ICC 18.0.4 MKL 18.0.4 MKL 18.0.4
Intel Xeon Gold 6226 (AVX-512) RHEL 7.6 ICC 19.0.5 MKL 19.0.5 MKL 19.0.5
Intel Core i5-4570S (AVX2) Ubuntu 18.04 LTS ICC 19.1.1 MKL 19.1.1 MKL 19.1.1
Intel Xeon E5-1620 (AVX) Ubuntu 18.04 LTS GCC 7.5.0 OpenBLAS 0.3.10 LAPACK 3.9.0
Intel Core i7-8550U (AVX2) WSL Ubuntu 18.04 LTS GCC 7.4.0 OpenBLAS 0.3.10 LAPACK 3.9.0
Intel Core i5-7300U (AVX2) macOS 10.15.4 GCC 9.2.0 OpenBLAS 0.3.10 LAPACK 3.9.0
AMD Threadripper 2950X (AVX2) WSL Ubuntu 20.04 LTS GCC 9.3.0 OpenBLAS 0.3.12 LAPACK 3.9.0
Intel Xeon W-2104 (AVX-512) Ubuntu 20.04.1 LTS GCC 9.3.0 OpenBLAS 0.3.10 LAPACK 3.9.0
Huawei Kunpeng 920 (ARMv8) Debian 10 (ECS VM) GCC 8.3.0 OpenBLAS 0.3.12 LAPACK 3.9.0
Apple M1 (ARMv8) Debian 10 (QEMU VM) GCC 8.3.0 OpenBLAS 0.3.12 LAPACK 3.9.0
Fujitsu A64FX (SVE-512) CentOS 8.3 GCC 10.2.0 OpenBLAS 0.3.13 LAPACK 3.9.0

On x64 processors, Intel Parallel Studio (ICC and MKL) usually gives the best performance. If you do not have or do not wish to use MKL, we recommend you to compile OpenBLAS, which will automatically compile the latest version of LAPACK for you. (If you are using OpenBLAS, it should be compiled with the USE_OPENMP=1 option.) Once you have your compiler and libraries ready, we can download and compile H2Pack. On ARM processors, the performance is not tuned yet.

First, clone H2Pack to your computer:

git clone --recurse-submodules https://github.com/scalable-matrix/H2Pack.git
cd H2Pack/src

In H2Pack/src, two example makefiles are provided: ICC-MKL.make and GCC-OpenBLAS.make.

  • If you are using ICC + MKL, you can use ICC-MKL.make directly.
  • If you are using GCC + OpenBLAS, you need to modify common.make according to your system configuration:
    • CC = gcc (change it to something like CC = gcc-9 if you are not using the default GCC)
    • OPENBLAS_INSTALL_DIR = <path to your OpenBLAS install directory>
  • If you are using other compilers and/or BLAS library and/or LAPACK library, we assume that you are an experienced *nix user and know how to customize the makefile.

Now, just run make -f <name of your makefile> to compile H2Pack. If everything went well, two directories should have been created:

  • H2Pack/include: contains all header files needed by an application that uses H2Pack
  • H2Pack/lib: contains a static linking library file libH2Pack.a and a dynamic linking library file libH2Pack.so

At this point, you may want to compile and run the examples in the examples directory. You may need to change the makefile in that directory in the same way you changed the makefile in the src directory.

Notes for using OpenBLAS:

  • It should be compiled with the USE_OPENMP=1 option
  • It should be compiled with the netlib LAPACK library by default (you need to have a Fortran compiler, otherwise OpenBLAS will not be compiled with the netlib LAPACK library)
  • The installation directory should look like the following (libopenblas_<arch>_<version>.{so, a} depend on your processor and OpenBLAS version):
$ tree
.
├── bin
├── include
│   ├── cblas.h
│   ├── f77blas.h
│   ├── lapack.h
│   ├── lapacke.h
│   ├── lapacke_config.h
│   ├── lapacke_mangling.h
│   ├── lapacke_utils.h
│   └── openblas_config.h
└── lib
    ├── cmake
    │   └── openblas
    │       ├── OpenBLASConfig.cmake
    │       └── OpenBLASConfigVersion.cmake
    ├── libopenblas.a -> libopenblas_zenp-r0.3.12.dev.a
    ├── libopenblas.so -> libopenblas_zenp-r0.3.12.dev.so
    ├── libopenblas.so.0 -> libopenblas_zenp-r0.3.12.dev.so
    ├── libopenblas_zenp-r0.3.12.dev.a
    ├── libopenblas_zenp-r0.3.12.dev.so
    └── pkgconfig
        └── openblas.pc

6 directories, 16 files
Clone this wiki locally