From fcc4e1eb1041c02a7fba0d93286d09c027ab56cd Mon Sep 17 00:00:00 2001 From: "Zhukova, Maria" Date: Thu, 16 Oct 2025 16:03:53 -0700 Subject: [PATCH] doc: small subsection wrt how to run examples --- doc/examples.md | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/doc/examples.md b/doc/examples.md index dc1cfa409c..aa2433baee 100644 --- a/doc/examples.md +++ b/doc/examples.md @@ -174,3 +174,47 @@ with minimal overhead. | Example | Description | |:--------|:------------| | @ref cpu_brgemm_example_cpp | \copybrief cpu_brgemm_example_cpp_brief | + +## Running Examples + +### Prerequisites and Building Examples + +Before running examples, ensure: +1. oneDNN is built from source. + Note that examples are built automatically when building oneDNN + with `-DONEDNN_BUILD_EXAMPLES=ON` (enabled by default). +2. Environment is set up and oneDNN libraries are in the path. + +Refer to @ref dev_guide_build for detailed build instructions. + +### Running Examples + +Most examples accept an optional engine argument (`cpu` or `gpu`), +and if no argument is provided, example will most likely default to CPU: + +**Linux/macOS:** +```bash +# Run on CPU (default) +./examples/getting_started + +# Run on CPU explicitly +./examples/getting_started cpu + +# Run on GPU (if available) +./examples/getting_started gpu +``` + +**Windows:** +```cmd +# Run on CPU (default) +examples\getting_started.exe + +# Run on CPU explicitly +examples\getting_started.exe cpu + +# Run on GPU (if available) +examples\getting_started.exe gpu +``` + +Examples will output "Example passed on CPU/GPU." upon successful completion +and display an error status with message otherwise.