Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can I run Cuda or opencl on intel iris?

Tags:

xcode

gpu

opencl

I have a Macbook pro mid 2014 with intel iris and intel core i5 processor 16GB of RAM. I am planing to learn some ray-traced 3D. But, I am not sure, if my laptop can render fast without any nvidia's hardware.

So, I would appreciate it, if someone can tell me if I can use Cuda if not, then could you please teach me in a very easy way how to enable OpenCL in after affects. I am looking for any tutorial for beginners to learn how to create or build OpenCL?

like image 727
Fudoli Avatar asked Nov 12 '16 06:11

Fudoli


People also ask

Does CUDA work with Intel Iris?

CUDA is only available for NVIDIA* GPUs. To use the CUDA functionality of TensorFlow, use an Nvidia GPU. Machine learning can still be done without the CUDA feature.

Does Intel Iris support OpenCL?

Yes, you can, because OpenCL is supported by MacOS natively.

Can I use CUDA without Nvidia GPU?

CUDA code will not run on AMD CPU or Intel HD graphics unless you have NVIDIA hardware inside your machine. On Colab you can take advantage of Nvidia GPU as well as being a fully functional Jupyter Notebook with pre-installed Tensorflow and some other ML/DL tools.

Is Intel Iris Graphics a GPU?

Intel® Iris® Xe MAX Graphics is the first discrete graphics processing unit (GPU) for thin and light laptops based on Intel Xe architecture.


2 Answers

Cuda works only on nvidia hardware but there may be some libraries converting it to run on cpu cores(not igpu).

AMD is working on "hipify"ing old cuda kernels to translate them to opencl or similar codes so they can become more general.

Opencl works everywhere as long as both hardware and os supports. Amd, Nvidia, Intel, Xilinx, Altera, Qualcomm, MediaTek, Marvell, Texas Instruments .. support this. Maybe even Raspberry pi-x can support in future.

Documentation for opencl in stackoverflow.com is under development. But there are some sites:

  • Amd's tutorial

  • Amd's parallel programming guide for opencl

  • Nvidia's learning material

  • Intel's HD graphics coding tutorial

  • Some overview of hardware, benchmark and parallel programming subjects

  • blog

  • Scratch-a-pixel-raytracing-tutorial (I read it then wrote its teraflops gpu version)

If it is Iris Graphics 6100:

Your integrated gpu has 48 execution units each having 8 ALU units that can do add,multiply and many more operations. Its clock frequency can rise to 1GHz. This means a maximum of 48*8*2(1 add+1multiply)*1G = 768 Giga floating point operations per second but only if each ALU is capable of concurrently doing 1 addition and 1 multiplication. 768 Gflops is more than a low-end discrete gpu such as R7-240 of AMD.(As of 19.10.2017, AMD's low-end is RX550 with 1200 GFlops, faster than Intel's Iris Plus 650 which is nearly 900 GFlops). Ray tracing needs re-accessing to too many geometry data so a device should have its own memory(such as with Nvidia or Amd), to let CPU do its work.

How you install opencl on a computer can change by OS and hardware type, but building a software with an opencl-installed computer is similar:

  • Query platforms. Result of this can be AMD, Intel, Nvidia,duplicate of these because of overlapped installations of wrong drivers,experimental platforms prior to newer opencl version supports.
  • Query devices of a platform(or all platforms). This gives individual devices (and their duplicates if there are driver errors or some other things to fix).
  • Create a context(or multiple) using a platform
  • Using a context(so everything will have implicit sync in it):

    • Build programs using kernel strings. Usually CPU can take less time than a GPU to build a program.(there is binary load option to shurtcut this)
    • Build kernels(as objects now) from programs.
    • Create buffers from host-side buffers or opencl-managed buffers.
    • Create a command queue (or multiple)

Just before computing(or an array of computations):

  • Select buffers for a kernel as its arguments.
  • Enqueue buffer write(or map/unmap) operations on "input" buffers

Compute:

  • Enqueue nd range kernel(with specifying which kernel runs and with how many threads)
  • Enqueue buffer read(or map/unmap) operations on "output" buffers
  • Don't forget to synchronize with host using clFinish() if you haven't used blocking type enqueueBufferRead.
  • Use your accelerated data.

After opencl is no more needed:

  • Be sure all command queues are empty / finished doing kernel work.
  • Release all in the opposite order of creation

If you need to accelerate an open source software, you can switch a hotspot parallelizable loop with a simple opencl kernel, if it doesn't have another acceleration support already. For example, you can accelerate air-pressure and heat-advection part of powdertoy sand-box simulator.

like image 71
huseyin tugrul buyukisik Avatar answered Oct 12 '22 10:10

huseyin tugrul buyukisik


Yes, you can, because OpenCL is supported by MacOS natively.

From your question it appears you are not seeking advice on programming, which would have been the appropriate subject for Stack Overflow. The first search hit on Google explains how to turn on OpenCL accelerated effects in After Effects (Project Settings dialog -> Video Rendering and Effects), but I have no experience with that myself.

like image 32
tera Avatar answered Oct 12 '22 09:10

tera