Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port refactored docs into 6.1.1 #138

Merged
merged 11 commits into from
May 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions docs/cpp-api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
.. meta::
:description: A wrapper library that allows you to easily port CUDA applications that use the cuRAND library to the HIP layer
:keywords: hipRAND, ROCm, library, API, tool

.. _cpp-api:

===================
C/C++ API reference
===================

This document describes the hipRAND APIs available in C and C++.

Device Functions
================
.. doxygengroup:: hipranddevice

C Host API
==========
.. doxygengroup:: hiprandhost

C++ Host API Wrapper
====================
.. doxygengroup:: hiprandhostcpp
17 changes: 0 additions & 17 deletions docs/cpp_api.rst

This file was deleted.

13 changes: 10 additions & 3 deletions docs/data-type-support.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
.. meta::
:description: A wrapper library that allows you to easily port CUDA applications that use the cuRAND library to the HIP layer
:keywords: hipRAND, ROCm, library, API, tool

.. _data-type:

====================
Data type support
******************************************
====================

hipRAND's data type support is matching cuRAND's data type support. On AMD hardware, the backend is provided by rocRAND. The detailed description, which includes a comparison to cuRAND's data type support, can be found at :doc:`rocRAND's data type support page.<rocrand:data-type-support>`
The data type support in hipRAND is similar to cuRAND. On AMD hardware, the backend is provided by rocRAND. To see the data type comparison between rocRAND and cuRAND, see `rocRAND's data type support <https://rocm.docs.amd.com/projects/rocRAND/en/latest/data-type-support.html>`_ page.

You can find the ROCm data type support summary at :doc:`Supported data types in ROCm<rocm:about/compatibility/data-type-support>`
You can find the ROCm data type support summary at `Supported data types in ROCm <https://rocm.docs.amd.com/en/latest/about/compatibility/precision-support.html#data-type-support-in-rocm-libraries>`_.
39 changes: 32 additions & 7 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -1,10 +1,35 @@
==================
hipRAND User Guide
==================
.. meta::
:description: A wrapper library that allows you to easily port CUDA applications that use the cuRAND library to the HIP layer
:keywords: hipRAND, ROCm, library, API, tool

Overview
--------
.. _index:

The hipRAND library is a wrapper library which allows users to easily port CUDA applications that use the cuRAND library to the HIP layer. In a ROCm environment hipRAND uses rocRAND, however in a CUDA environment cuRAND is used instead.
===========================
hipRAND documentation
===========================

hipRAND provides both C/C++ and Python API wrappers.
The hipRAND library is a wrapper library that allows you to easily port CUDA applications that use the cuRAND library to the HIP layer. hipRAND uses rocRAND in a ROCm environment and cuRAND in a CUDA environment.

hipRAND provides C, C++, and Python API wrappers.

You can access hipRAND code on our `GitHub repository <https://github.com/ROCm/hipRAND>`_.

The documentation is structured as follows:

.. grid:: 2
:gutter: 3

.. grid-item-card:: Install

* :ref:`installation`

.. grid-item-card:: API reference

* :ref:`data-type`
* :ref:`cpp-api`
* :ref:`python-api`

To contribute to the documentation, refer to
`Contributing to ROCm <https://rocm.docs.amd.com/en/latest/contribute/contributing.html>`_.

You can find licensing information on the `Licensing <https://rocm.docs.amd.com/en/latest/about/license.html>`_ page.
181 changes: 181 additions & 0 deletions docs/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,181 @@
.. meta::
:description: A wrapper library that allows you to easily port CUDA applications that use the cuRAND library to the HIP layer
:keywords: hipRAND, ROCm, library, API, tool

.. _installation:

============
Installation
============

To install hipRAND, you can choose between the following two methods:

- :ref:`Using prebuilt packages from the ROCm repositories <prebuilt-packages>`
- :ref:`Building from source <build-from-source>`

Both the methods are described below.

.. _prebuilt-packages:

Install using prebuilt packages
--------------------------------

To install the prebuilt hipRAND packages, you require a ROCm-enabled platform. For information on ROCm installation, see the `ROCm installation for Linux <https://rocm.docs.amd.com/projects/install-on-linux/en/latest/>`_ page. After installing ROCm or enabling the ROCm repositories, you can install hipRAND using the system package manager.

For Ubuntu and Debian:

.. code-block:: shell

sudo apt-get install hiprand

For CentOS:

.. code-block:: shell

sudo yum install hiprand

For SLES:

.. code-block:: shell

sudo dnf install hiprand

This installs hipRAND in the ``/opt/rocm`` directory.

.. _build-from-source:

Build hipRAND from source
----------------------------

This section provides the information required to build hipRAND from source.

Requirements
^^^^^^^^^^^^

To build hipRAND, CMake version 3.10 or later is required.

Additionally, to build hipRAND for ROCm software, the following softwares are required:

* `AMD ROCm Software <https://rocm.docs.amd.com/projects/install-on-linux/en/latest/>`_ (version 5.0.0 or later).
* `rocRAND <https://github.com/ROCm/rocRAND.git>`_

To build hipRAND for the CUDA platform instead, the following softwares are required:

* The CUDA toolkit
* cuRAND (included in the CUDA Toolkit)

Obtaining sources
^^^^^^^^^^^^^^^^^

You can find the hipRAND sources in the `hipRAND GitHub Repository <https://github.com/ROCm/hipRAND>`_. Use the branch that matches the system-installed version of ROCm. For example, on a system with ROCm 5.4 installed, use the following command to obtain hipRAND sources:

.. code-block:: shell

git checkout -b release/rocm-rel-5.4 https://github.com/ROCm/hipRAND.git

Building library
^^^^^^^^^^^^^^^^^^^^

After obtaining the sources and dependencies, build hipRAND for ROCm software using the installation script:

.. code-block:: shell

cd hipRAND
./install --install

This automatically builds all required dependencies, excluding Git and the requirements listed above, and installs the project to ``/opt/rocm`` if everything went well. See ``./install --help`` for further information. The clients, enabled by option ``--clients``, consist of the hipRAND tests and add the additional dependency of `googletest <https://github.com/google/googletest>`_.

Building with CMake
^^^^^^^^^^^^^^^^^^^

For a more elaborate installation process, build hipRAND manually using CMake. This enables certain configuration options that are not exposed to the ``./install`` script. In general, you can build hipRAND using CMake with the following configuration:

.. code-block:: shell

cd hipRAND; mkdir build; cd build
# Configure the project
CXX=<compiler> cmake [options] ..
# Build
make -j$(nproc)
# Optionally, run the tests
ctest --output-on-failure
# Install
[sudo] make install

Where ``<compiler>`` should be set to ``hipcc`` or ``amdclang`` on ROCm software or to a regular C++ compiler such as ``g++`` on a CUDA platform. The default build configuration is ``Release``.

Here are the CMake options:

* ``BUILD_WITH_LIB`` decides whether to build hipRAND with the rocRAND or cuRAND backend. If set to ``CUDA``, hipRAND is built using the cuRAND backend. Otherwise, the rocRAND backend is used.
* ``BUILD_FORTRAN_WRAPPER`` builds the Fortran wrapper when set to ``ON``. Defaults to ``OFF``.
* ``BUILD_TEST`` builds the hipRAND tests when set to ``ON``. Defaults to ``OFF``.
* ``BUILD_BENCHMARK`` builds the hipRAND benchmarks when set to ``ON``. Defaults to ``OFF``.
* ``BUILD_ADDRESS_SANITIZER`` builds with address sanitization enabled when set to ``ON``. Defaults to ``OFF``.
* ``ROCRAND_PATH`` specifies a rocRAND install other than the default system installed one.
* ``DOWNLOAD_ROCRAND`` downloads and installs rocRAND in the build directory when set to ``ON``. Defaults to ``OFF``.
* ``DEPENDENCIES_FORCE_DOWNLOAD`` downloads and builds the dependencies instead of using system-installed dependencies when set to ``ON``. Defaults to ``OFF``.

If using ``ROCRAND_PATH`` or ``DOWNLOAD_ROCRAND`` when rocRAND is already installed in the default location in the system then, use ``CMAKE_NO_SYSTEM_FROM_IMPORTED=ON`` while configuring the project.
Failing to do so might resolve the rocRAND headers to the system-installed version instead of the specified version, leading to errors or missing functionalities.

Common build errors
"""""""""""""""""""""

*
.. code-block:: shell

Could not find a package configuration file provided by "rocrand" with any of the following names:

rocrandConfig.cmake
rocrand-config.cmake

Solution: install `rocRAND <https://github.com/ROCm/rocRAND.git>`_.
*
.. code-block:: shell

Could not find a package configuration file provided by "ROCM" with any of the following names:

ROCMConfig.cmake
rocm-config.cmake

Solution: install `ROCm CMake modules <https://github.com/RadeonOpenCompute/rocm-cmake>`_.

Building Python API wrapper
-------------------------------

This section provides information required to build the hipRAND Python API wrapper.

Requirements
^^^^^^^^^^^^

The hipRAND Python API Wrapper requires the following dependencies:

* hipRAND
* Python 3.5
* NumPy (will be installed automatically as a dependency if necessary)

.. note::

If hipRAND is built from sources but not installed or rather installed in a
non-standard directory, then set the ``ROCRAND_PATH`` or ``HIPRAND_PATH`` environment variable to the path containing ``libhiprand.so`` as shown below:

.. code-block:: shell

export HIPRAND_PATH=~/hipRAND/build/library/

Installation
^^^^^^^^^^^^^

To install Python hipRAND module using ``pip``:

.. code-block:: shell

cd hipRAND/python/hiprand
pip install .

To execute the tests:

.. code-block:: shell

cd hipRAND/python/hiprand
python tests/hiprand_test.py
Loading