Skip to content
This repository was archived by the owner on Sep 27, 2021. It is now read-only.

Commit cb54d77

Browse files
authored
Merge pull request #14 from ssfrr/patch-1
updates README with `init` clarification and other use-facing functions
2 parents 01ecb23 + 00affa9 commit cb54d77

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

README.md

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,20 @@ Implementation of the [abstract GPU Array Interface](https://github.com/JuliaGPU
77

88
CLArray uses [Transpiler.jl](https://github.com/SimonDanisch/Transpiler.jl) to compile Julia functions for the GPU using OpenCL.
99

10-
It implements the full abstract gpu interface from GPUArrays.
11-
To learn how to use it, please refer to the GPUArray documentations:
10+
It implements the full abstract gpu interface from GPUArrays, and most interactions will be through those functions.
11+
To learn how to use it, please refer to the GPUArray documentation:
1212

1313
[![](https://img.shields.io/badge/docs-latest-blue.svg)](https://JuliaGPU.github.io/GPUArrays.jl/latest)
1414

15-
The only noteworthy functionality that isn't part of the GPUArray interface is how to select and initialize devices:
15+
CLArrays includes several other OpenCL-specific functions:
16+
17+
* `CLArrays.devices()` returns a list of the OpenCL compute devices (CPU and GPU) available on the system.
18+
* `CLArrays.init(dev::OpenCL.cl.Device)` will set the given device to be the active device. If you do not initialize a device explicitly, a default device will be chosen automatically, prioritizing GPU devices over CPU devices.
19+
* `is_gpu(dev::OpenCL.cl.Device)` returns `true` if the given device is a GPU.
20+
* `is_cpu(dev::OpenCL.cl.Device)` returns `true` if the given device is a CPU.
21+
* `gpu_call(kernel::Function, A::GPUArray, args::Tuple, configuration = length(A))` calls the given function on the GPU. See the function documentation for more details.
22+
23+
### Example
1624

1725
```Julia
1826
using CLArrays
@@ -21,6 +29,7 @@ for dev in CLArrays.devices()
2129
CLArrays.init(dev)
2230
x = zeros(CLArray{Float32}, 5, 5) # create a CLArray on device `dev`
2331
end
32+
2433
# you can also filter with is_gpu, is_cpu
2534
gpu_devices = CLArrays.devices(is_gpu)
2635
```

0 commit comments

Comments
 (0)