Skip to content

Commit 4e06483

Browse files
committed
DOC Add code sample to convert available backends to bool
1 parent 194de52 commit 4e06483

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

docs/details/backend.dox

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,15 @@ Return Value | Backends Available
4545
6 | CUDA and OpenCL
4646
7 | CPU, CUDA and OpenCL
4747

48+
To convert the integer back into bools for each device, use the following code
49+
\code
50+
int backends = af::getAvailableBackends();
51+
52+
bool cpu = backends & AF_BACKEND_CPU;
53+
bool cuda = backends & AF_BACKEND_CUDA;
54+
bool opencl = backends & AF_BACKEND_OPENCL;
55+
\endcode
56+
4857
\ingroup unified_func
4958
\ingroup arrayfire_func
5059

0 commit comments

Comments
 (0)