Skip to content

Commit

Permalink
docs(api-reference/cpp-api): reword sections in c host api
Browse files Browse the repository at this point in the history
  • Loading branch information
Naraenda committed Oct 28, 2024
1 parent 8fcb023 commit 9f8275c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/api-reference/cpp-api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ In the below example, random number generation is using the XORWOW generator.
C host API
==========

C host API allows encapsulation of the internal generator state. Random numbers may be produced either on the host CPU or device GPU, whether an appropriate generator object was created. The typical sequence of operations for GPU generation consists of the following steps:
The C host API allows encapsulation of the internal generator state. Random numbers may be produced either on the host or device, depending on the created generator object. The typical sequence of operations for device generation consists of the following steps:

1. Allocate memory on the device with ``hipMalloc``.

Expand All @@ -76,7 +76,7 @@ C host API allows encapsulation of the internal generator state. Random numbers

6. Clean up with ``rocrand_destroy_generator`` and ``hipFree``.

To generate random numbers on the host CPU, the memory allocation in step one should be made using a host memory allocation call. In step two ``rocrand_create_generator_host`` should be called respectfully. In the last step, the appropriate memory release should be made using the ``rocrand_destroy_generator``. All other calls work identically whether you are generating random numbers on the device or on the host CPU.
To generate random numbers on the host, the memory allocation in step one should be made using a host memory allocation call. In step two ``rocrand_create_generator_host`` should be called instead. In the last step, the appropriate memory release should be made using the ``rocrand_destroy_generator``. All other calls work identically whether you are generating random numbers on the device or on the host CPU.

In the example below, the C host API is used to generate 10 random floats using GPU capabilities.

Expand Down

0 comments on commit 9f8275c

Please sign in to comment.