Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

ROCm with dGPU(AMD GPU) using pyopencl (memo)

319 views

Published on

ROCm with dGPU(AMD GPU) using pyopencl (memo)

2018/04/27
SAKURA Internet, Inc.
Research Center
SR / Naoto MATSUMOTO

Published in: Technology
  • Be the first to comment

  • Be the first to like this

ROCm with dGPU(AMD GPU) using pyopencl (memo)

  1. 1. ROCm with dGPU(AMD GPU) using pyopencl (memo) 2018/04/27 SAKURA Internet, Inc. Research Center SR / Naoto MATSUMOTO (C) Copyright 1996-2018 SAKURA Internet Inc
  2. 2. ROCm with dGPU(AMD GPU) using pyopencl (memo) 2 # uname -sr; cat /etc/lsb-release Linux 4.4.0-116-generic DISTRIB_DESCRIPTION="Ubuntu 16.04.4 LTS" ( ROCm does not support 17.10) # lscpu Model name: Intel(R) Core(TM) i7-7800X CPU @ 3.50GHz # lspci | grep VGA 65:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Device 67ef (rev cf) ROCm Platform Supports Two Graphics Core Next (GCN) GPU Generations GFX8: Radeon RX 480,Radeon RX 470,Radeon RX 460,R9 Nano,Radeon R9 Fury,Radeon R9 Fury X Radeon Pro WX7100, FirePro S9300 x2 Radeon Vega Frointer Edition, Radeon Instinct: MI6, MI8, and MI25 (https://rocm.github.io/hardware.html) # apt update # apt dist-upgrade -y # apt-get install -y libnuma-dev # wget -qO - http://repo.radeon.com/rocm/apt/debian/rocm.gpg.key | sudo apt-key add - # sh -c 'echo deb [arch=amd64] http://repo.radeon.com/rocm/apt/debian/ xenial main > /etc/apt/sources.list.d/rocm.list' # apt update # apt-get install -y rocm-dkms # ln -s /opt/rocm/opencl/lib/x86_64/libOpenCL.so.1 /usr/lib/libOpenCL.so # usermod -a -G video $LOGNAME # sync; sync; sync; reboot # /opt/rocm/opencl/bin/x86_64/clinfo Platform Version: OpenCL 2.1 AMD-APP.internal (2576.0) Platform Name: AMD Accelerated Parallel Processing # apt install python-pip opencl-headers -y # pip install --upgrade pip # pip install --upgrade setuptools # pip install pyopencl Successfully installed pyopencl-2018.1.1 >>> import numpy as np >>> import pyopencl as cl >>> from pyopencl import array as clarray >>> from pyopencl import algorithm as clalg >>> ctx = cl.create_some_context(0) >>> queue = cl.CommandQueue(ctx) >>> R = np.random.randint(0, 99, 100000000).astype(np.int8) >>> a = clarray.to_device(queue, R) >>> b = clalg.copy_if(a, 'ary[i] >= 55') >>> print b

×