Files
composable_kernel/docs/install/Composable-Kernel-build.rst
peterjunpark fcece1e838 [rocm-libraries] ROCm/rocm-libraries#7380 (commit 50b369d)
docs(composablekernel): update install pages for 7.13

## Motivation

Update instructions to install prebuilt packages. Generally, point to
ROCm Core SDK install instructions. List a more granular package if
useful to users.

Preview:
https://rocm.docs.amd.com/projects/composable_kernel/en/users-peterjunpark-ck-7.13-install/install/Composable-Kernel-install.html

>[!NOTE]
>Some links appear as plain text in the preview b/c the target page
isn't publicly accessible yet.

Related to:
- [x] composablekernel https://github.com/ROCm/rocm-libraries/pull/7380
  - [x] hipblas https://github.com/ROCm/rocm-libraries/pull/7378
  - [x] hipblaslt https://github.com/ROCm/rocm-libraries/pull/7379
  - [x] hipcub https://github.com/ROCm/rocm-libraries/pull/7377
  - [x] hipdnn https://github.com/ROCm/rocm-libraries/pull/7376
  - [x] hipfft https://github.com/ROCm/rocm-libraries/pull/7375
  - [x] hiprand https://github.com/ROCm/rocm-libraries/pull/7374
  - [x] hipsolver https://github.com/ROCm/rocm-libraries/pull/7371
  - [x] hipsparse https://github.com/ROCm/rocm-libraries/pull/7373
  - [x] hipsparselt https://github.com/ROCm/rocm-libraries/pull/7372
  - [x] miopen https://github.com/ROCm/rocm-libraries/pull/7370
  - [x] rocblas https://github.com/ROCm/rocm-libraries/pull/7369
  - [x] rocfft https://github.com/ROCm/rocm-libraries/pull/7368
  - [x] rocprim https://github.com/ROCm/rocm-libraries/pull/7367
  - [x] rocrand https://github.com/ROCm/rocm-libraries/pull/7366
  - [x] rocsolver https://github.com/ROCm/rocm-libraries/pull/7364
  - [x] rocsparse https://github.com/ROCm/rocm-libraries/pull/7365
  - [x] rocthrust https://github.com/ROCm/rocm-libraries/pull/7363
  - [x] rocwmma https://github.com/ROCm/rocm-libraries/pull/7362

<!-- Explain the purpose of this PR and the goals it aims to achieve.
-->

## Technical Details

<!-- Explain the changes along with any relevant GitHub links. -->

## JIRA ID

<!-- If applicable, mention the JIRA ID resolved by this PR (Example:
Resolves SWDEV-12345). -->
<!-- Do not post any JIRA links here. -->

## Test Plan

<!-- Explain any relevant testing done to verify this PR. -->

## Test Result

<!-- Briefly summarize test outcomes. -->

## Submission Checklist

- [ ] Look over the contributing guidelines at
https://github.com/ROCm/ROCm/blob/develop/CONTRIBUTING.md#pull-requests.
2026-05-15 14:58:51 +00:00

124 lines
5.2 KiB
ReStructuredText

.. meta::
:description: Composable Kernel build and install
:keywords: composable kernel, CK, ROCm, API, documentation, install
***********************************************
Build and install Composable Kernel from source
***********************************************
To build Composable Kernel as part of the ROCm Core SDK, see `TheRock build
instructions
<https://github.com/ROCm/TheRock/blob/main/docs/development/README.md>`__.
TheRock is the recommended way to build ROCm components from source.
Alternatively, you can build Composable Kernel standalone using the following
instructions.
Prerequisites
=============
The following prerequisites are required to build and install Composable Kernel:
* cmake
* hip-rocclr
* iputils-ping
* jq
* libelf-dev
* libncurses5-dev
* libnuma-dev
* libpthread-stubs0-dev
* llvm-amdgpu
* mpich
* net-tools
* python3
* python3-dev
* python3-pip
* redis
* rocm-llvm-dev
* zlib1g-dev
* libzstd-dev
* openssh-server
* clang-format-18
Docker images that include all the required prerequisites for building Composable Kernel are available on `Docker Hub <https://hub.docker.com/r/rocm/composable_kernel/tags>`_.
Build and install
=================
Before you begin, clone the `Composable Kernel project <https://github.com/ROCm/rocm-libraries/tree/develop/projects/composablekernel>`_.
Use sparse checkout when cloning the Composable Kernel project:
.. code-block:: bash
git clone --no-checkout --filter=blob:none https://github.com/ROCm/rocm-libraries.git
cd rocm-libraries
git sparse-checkout init --cone
git sparse-checkout set projects/composablekernel
Then use ``git checkout`` to check out the branch you need.
The develop branch is intended for users who want to preview new features or contribute to the Composable Kernel codebase.
If you don't intend to contribute to the codebase and won't be previewing features, use a branch that matches the version of ROCm installed on your system.
Create the ``build`` directory under ``rocm-libraries/projects/composablekernel``:
.. code-block:: bash
cd projects/composablekernel
mkdir build
Change directory to the ``build`` directory and generate the makefile using the ``cmake`` command. Two build options are required:
* ``CMAKE_PREFIX_PATH``: The ROCm installation path. ROCm is installed in ``/opt/rocm`` by default.
* ``CMAKE_CXX_COMPILER``: The path to the Clang compiler. Clang is found at ``/opt/rocm/llvm/bin/clang++`` by default.
.. code-block:: bash
cd build
cmake ../. -D CMAKE_PREFIX_PATH="/opt/rocm" -D CMAKE_CXX_COMPILER="/opt/rocm/llvm/bin/clang++" [-D<OPTION1=VALUE1> [-D<OPTION2=VALUE2>] ...]
Other build options are:
* ``DISABLE_DL_KERNELS``: Set this to "ON" to not build deep learning (DL) and data parallel primitive (DPP) instances.
.. note::
DL and DPP instances are useful on architectures that don't support XDL or WMMA.
* ``CK_USE_FP8_ON_UNSUPPORTED_ARCH``: Set to ``ON`` to build FP8 data type instances on gfx90a without native FP8 support.
* ``GPU_TARGETS``: Target architectures. Target architectures in this list must all be different versions of the same architectures. Enclose the list of targets in quotation marks. Separate multiple targets with semicolons (``;``). For example, ``cmake -D GPU_TARGETS="gfx908;gfx90a"``. This option is required to build tests and examples.
* ``GPU_ARCHS``: Target architectures. Target architectures in this list are not limited to different versions of the same architectures. Enclose the list of targets in quotation marks. Separate multiple targets with semicolons (``;``). For example, ``cmake -D GPU_TARGETS="gfx908;gfx1100"``.
* ``CMAKE_BUILD_TYPE``: The build type. Can be ``None``, ``Release``, ``Debug``, ``RelWithDebInfo``, or ``MinSizeRel``. CMake will use ``Release`` by default.
.. note::
If neither ``GPU_TARGETS`` nor ``GPU_ARCHS`` is specified, Composable Kernel will be built for all targets supported by the compiler.
Build Composable Kernel using the generated makefile. This will build the library, the examples, and the tests, and save them to ``bin``.
.. code-block:: bash
make -j20
The ``-j`` option speeds up the build by using multiple threads in parallel. For example, ``-j20`` uses twenty threads in parallel. On average, each thread will use 2GB of memory. Make sure that the number of threads you use doesn't exceed the available memory in your system.
Using ``-j`` alone will launch an unlimited number of threads and is not recommended.
Install the Composable Kernel library:
.. code-block:: bash
make install
After running ``make install``, the Composable Kernel files will be saved to the following locations:
* Library files: ``/opt/rocm/lib/``
* Header files: ``/opt/rocm/include/ck/`` and ``/opt/rocm/include/ck_tile/``
* Examples, tests, and ckProfiler: ``/opt/rocm/bin/``
For information about ckProfiler, see `the ckProfiler readme file <https://github.com/ROCm/rocm-libraries/tree/develop/projects/composablekernel/profiler/README.md>`_.
For information about running the examples and tests, see :doc:`Composable Kernel examples and tests <../tutorial/Composable-Kernel-examples>`.