matpool
matpool

矩池云 专注于人工智能领域的云服务商 https://matpool.com/

Installation and testing tutorial of nvidia opencl on moment pool cloud


This tutorial rents a 2080ti, 3.7 multi-frame mirror.

Add ali source of nvidia-cuda


 curl -fsSL https://mirrors.aliyun.com/nvidia-cuda/ubuntu1804/x86_64/7fa2af80.pub | apt-key add -
echo "deb https://mirrors.aliyun.com/nvidia-cuda/ubuntu1804/x86_64/ /" > /etc/apt/sources.list.d/cuda.list
apt update

install nvidia opencl


 apt search nvidia-opencl


 apt-get install nvidia-opencl-dev

Create link

 mkdir -p /etc/OpenCL/vendors/
cd /etc/OpenCL/vendors
ls


 vim nvidia.icd

Fill in the link below at nvidia.icd

 /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.1


Verify that the correct link is released

 cat nvidia.icd
ll /usr/lib/x86_64-linux-gnu/libnvidia-opencl.so.1


test opencl

Contents of clGetPlatformIDs.c

 #include <stdio.h>
#include <CL/opencl.h>

int main(int argc, char **argv)
{
    int status;
    cl_uint n_platform;

    status = clGetPlatformIDs(0, NULL, &n_platform);

     if(status != CL_SUCCESS)
    {
    fprintf(stderr, "no platforms %d\n", status);
    return -1;
    } else
    {
    fprintf(stderr, "number of CL platforms %d\n", n_platform);
    return 0;
    }
}

Enter the solution, my folder here is 22, you can follow your own habits

 cd /22
ls
gcc clGetPlatformIDs.c -lOpenCL -o main
chmod +x main
./main 


The number of CL platforms 1 appears, and the installation and testing are complete

Reference article

Install OpenCL on Ubuntu 14.04 and Nvidia

Ubuntu 18.10 with Nvidia 410: OpenCL not working anymore (clinfo: 0 platforms)

Opencl clGetPlatformIDs error -1001

OpenCL crashes on call to clGetPlatformIDs

ERROR: clGetPlatformIDs -1001 when running OpenCL code (Linux)

CC BY-NC-ND 2.0

Like my work?
Don't forget to support or like, so I know you are with me..

Loading...

Comment