File: Linux_Install_Guide.rst

package info (click to toggle)
hipblas 6.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 26,548 kB
  • sloc: cpp: 209,856; f90: 49,800; python: 4,680; ansic: 1,141; sh: 799; makefile: 50; xml: 23
file content (172 lines) | stat: -rw-r--r-- 9,807 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
.. meta::
  :description: Installing and Building hipBLAS for Linux
  :keywords: hipBLAS, rocBLAS, BLAS, ROCm, API, Linear Algebra, documentation, Linux installation, build

.. _linux-install:

***********************************
Installing and building for Linux
***********************************

This topic discusses how to install hipBLAS on Linux from a package and how to build and install it from the source code.
For a list of installation prerequisites, see :doc:`hipBLAS prerequisites <prerequisites>`.

Installing prebuilt packages
=============================

You can manually download the prebuilt hipBLAS packages from the :doc:`ROCm native package manager <rocm-install-on-linux:install/quick-start>`
or by clicking the `GitHub releases tab <https://github.com/ROCm/hipBLAS/releases>`_.
The versions on GitHub might be more recent. Release notes are available for each release on the releases tab.

To download the prebuilt package, use this command:

.. code-block:: shell

   sudo apt update && sudo apt install hipblas

Building hipBLAS from source
============================

When building hipBLAS from source, you can choose to build only the library and its dependencies or include the client and its
dependencies.

Building the library and library dependencies
---------------------------------------------

The root directory of this repository contains the helper Python script ``rmake.py`` which lets you build and install
hipBLAS with a single command. It accepts several options but has a hard-coded configuration
that you can override by invoking ``cmake`` directly. However, it's a great way to get started quickly and
serves as an example of how to build and install hipBLAS.
A few commands in the script require ``sudo`` access, which might prompt you for a password.

The install script determines the build platform by querying ``hipconfig --platform``. This value can be explicitly defined
by setting the environment variable ``HIP_PLATFORM`` to ``HIP_PLATFORM=amd`` or ``HIP_PLATFORM=nvidia``.

Common examples showing how to use ``rmake.py`` to build the library dependencies and library are listed
in this table.

.. csv-table::
   :header: "Command","Description"
   :widths: 30, 100

   "``python3 rmake.py -h``", "Help information."
   "``python3 rmake.py -d``", "Build the library dependencies and library in your local directory. The ``-d`` flag only has to be used once. For subsequent invocations of ``rmake.py``, it is not necessary to rebuild the dependencies."
   "``python3 rmake.py``", "Build the library in your local directory. It is assumed the dependencies have been built."
   "``python3 rmake.py -i``", "Build the library, then build and  install the hipBLAS package in  ``/opt/rocm/hipblas``. You will be prompted for sudo access. This installs it for all users. To restrict hipBLAS to your local directory, do not use the  ``-i`` flag. "
   "``python3 rmake.py -n``", "Build the library without the functionality provided by rocSOLVER. The rocSOLVER, rocSPARSE, and rocPRIM dependencies will not be required. This flag has no effect when building with a NVIDIA CUDA backend."

Building the library, client, and all dependencies
-------------------------------------------------------------------

The client contains the executables listed in the table below.

================= =======================================================
Executable name   Description
================= =======================================================
hipblas-test      Runs GoogleTest tests to validate the library
hipblas-bench     An executable to benchmark or test individual functions
hipblas-example-* Various examples showing how to use hipBLAS
================= =======================================================

Common ways to use ``rmake.py`` to build the dependencies, library, and client are
listed in this table.

.. csv-table::
   :header: "Command","Description"
   :widths: 33, 97

   "``python3 rmake.py -dc``", "Build the library dependencies, client dependencies, library, and client in your local directory. The ``-d`` flag only has to be used once. For subsequent invocations of  ``rmake.py``, it is not necessary to rebuild the dependencies."
   "``python3 rmake.py -c``", "Build the library and client in your local directory. It is assumed the  dependencies have been built."
   "``python3 rmake.py -idc``", "Build the library dependencies, client dependencies, library, and client, then build and install the hipBLAS package. You will be prompted for sudo access. To install hipBLAS for all users, use the ``-i`` flag. To restrict hipBLAS to your local directory, do not use the ``-i`` flag."
   "``python3 rmake.py -ic``", "Build and install the hipBLAS package and build the client. You will be prompted for sudo access. This installs it for all users. To restrict hipBLAS to your local directory, do not use the ``-i`` flag."

Dependencies for building the library
=====================================

Use ``rmake.py`` with the ``-d`` option to install the dependencies required to build the library.
This does not install the hipblas-common, rocBLAS, rocSOLVER, rocSPARSE, and rocPRIM dependencies.
When building hipBLAS, it is important to take note of the version dependencies for other libraries. The hipblas-common,
rocBLAS, and rocSOLVER versions required to build for an AMD backend are listed in the top-level ``CMakeLists.txt`` file.
rocSPARSE and rocPRIM are currently dependencies for rocSOLVER. To build these libraries from
source, see the :doc:`rocBLAS <rocblas:index>`,
:doc:`rocSOLVER <rocsolver:index>`, :doc:`rocSPARSE <rocsparse:index>`,
and :doc:`rocPRIM <rocprim:index>` documentation.

The minimum version of CMake is currently 3.16.8. See the ``--cmake_install`` flag in ``rmake.py`` to
upgrade automatically.

To use the test and benchmark clients' host reference functions, you must manually download and install
AMD's `ILP64 version of the AOCL libraries <https://www.amd.com/en/developer/aocl.html>`_ version 4.2.
The ``aocl-linux-*`` packages include AOCL-BLAS (``aocl-blis``) and AOCL-LAPACK (``aocl-libflame``).
If you download and install the full AOCL packages to the default location, then these reference
functions should be found by the clients` ``CMakeLists.txt`` file.

.. note::

   If you only use the ``rmake.py -d`` dependency script and change the default CMake option ``LINK_BLIS=ON``,
   you might experience ``hipblas-test`` stress test failures due to a 32-bit integer overflow
   on the host. To resolve this issue, exclude the stress tests using the command line argument ``--gtest_filter=-*stress*``.

Manual build
=======================================

This section provides information on how to configure CMake and manually build on all supported platforms.

Build the library using individual commands
-------------------------------------------

.. code-block:: bash

   mkdir -p [HIPBLAS_BUILD_DIR]/release
   cd [HIPBLAS_BUILD_DIR]/release
   # Default install location is in /opt/rocm, define -DCMAKE_INSTALL_PREFIX=<path> to specify other
   # Default build config is 'Release', define -DCMAKE_BUILD_TYPE=<config> to specify other
   CXX=/opt/rocm/bin/amdclang++ ccmake [HIPBLAS_SOURCE]
   make -j$(nproc)
   sudo make install # sudo required if installing into system directory such as /opt/rocm

Build the library, tests, benchmarks, and samples using individual commands
----------------------------------------------------------------------------

The repository contains source code for clients that serve as samples, tests, and benchmarks. These source code files can be
found in the `clients subdirectory <https://github.com/ROCm/hipBLAS/tree/develop/clients>`_ of the hipBLAS GitHub.

Dependencies (only necessary for hipBLAS clients)
-------------------------------------------------

The hipBLAS samples have no external dependencies, but the unit test and benchmarking applications do.
These clients have the following dependencies:

* `LAPACK <https://github.com/Reference-LAPACK>`_: LAPACK itself adds a dependency on a Fortran compiler
* `GoogleTest <https://github.com/google/googletest>`_

GoogleTest and LAPACK are more difficult to install. Many distributions
do not provide a GoogleTest package with pre-compiled libraries,
and the LAPACK packages do not have the necessary CMake config files for CMake to link to the library.
hipBLAS provides a CMake script that builds these dependencies from source.
This is an optional step. Users can provide their own builds of these dependencies and configure CMake to find them
by setting the ``CMAKE_PREFIX_PATH`` definition. The following steps demonstrate how to build dependencies and
install them to the default CMake ``/usr/local`` directory.

.. note::

   The following steps are optional and only need to be run once.

.. code-block:: bash

   mkdir -p [HIPBLAS_BUILD_DIR]/release/deps
   cd [HIPBLAS_BUILD_DIR]/release/deps
   ccmake -DBUILD_BOOST=OFF [HIPBLAS_SOURCE]/deps   # assuming boost is installed through package manager as above
   make -j$(nproc) install

After the dependencies are available on the system, configure the clients to build.
This involves passing a few extra CMake flags to the library CMake configure script. If the dependencies are not
installed into the default system locations, such as ``/usr/local``, pass the ``CMAKE_PREFIX_PATH`` to CMake so it can find them.

.. code-block:: bash

   -DCMAKE_PREFIX_PATH="<semicolon separated paths>"
   # Default install location is in /opt/rocm, use -DCMAKE_INSTALL_PREFIX=<path> to specify other
   CXX=/opt/rocm/bin/amdclang++ ccmake -DBUILD_CLIENTS_TESTS=ON -DBUILD_CLIENTS_BENCHMARKS=ON [HIPBLAS_SOURCE]
   make -j$(nproc)
   sudo make install   # sudo required if installing into system directory such as /opt/rocm