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


Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


CLArrays.jl is unmaintained and does not work with Julia v1.0 and newer. Please use CUDA.jl, AMDGPU.jl, or oneAPI.jl instead.

Build status:

Implementation of the abstract GPU Array Interface

CLArray uses Transpiler.jl to compile Julia functions for the GPU using OpenCL.

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

CLArrays includes several other OpenCL-specific functions:

  • CLArrays.devices() returns a list of the OpenCL compute devices (CPU and GPU) available on the system.
  • CLArrays.init( 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.
  • is_gpu( returns true if the given device is a GPU.
  • is_cpu( returns true if the given device is a CPU.
  • 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.


using CLArrays

for dev in CLArrays.devices()
    x = zeros(CLArray{Float32}, 5, 5) # create a CLArray on device `dev`

# you can also filter with is_gpu, is_cpu
gpu_devices = CLArrays.devices(is_gpu)

Note that CLArrays.jl does not handle installing OpenCL drivers for your machine. You will need to make sure you have the appropriate drivers installed for your hardware.

Install OpenCL drivers for intel graphics in Linux

cd $HOME
git clone
cd $HOME/beignet
sudo apt-get install cmake pkg-config python ocl-icd-dev libegl1-mesa-dev ocl-icd-opencl-dev libdrm-dev libxfixes-dev libxext-dev llvm-3.6-dev clang-3.6 libclang-3.6-dev libtinfo-dev libedit-dev zlib1g-devD
mkdir build; cd build; cmake ..
make utest; . utests/; utests/utest_run
sudo make install