[Ethereum] What are CUDA and OpenCL? How and why are they used for PoW Mining

miningnvidiaproof-of-work

It is often suggested that, to practically participate in mining, one must obtain a graphics card and install CUDA and/or OpenCL libraries.

From their wikipeda definitions:

CUDA is a parallel computing platform and application programming
interface (API) model created by Nvidia. It allows software
developers and software engineers to use a CUDA-enabled graphics
processing unit (GPU) for general purpose processing – an approach
termed GPGPU (General-Purpose computing on Graphics Processing Units).
The CUDA platform is a software layer that gives direct access to the
GPU's virtual instruction set and parallel computational elements, for
the execution of compute kernels.

Open Computing Language (OpenCL) is a framework for writing programs
that execute across heterogeneous platforms consisting of central
processing units (CPUs), graphics processing units (GPUs), digital
signal processors (DSPs), field-programmable gate arrays (FPGAs) and
other processors or hardware accelerators. OpenCL specifies
programming languages (based on C99 and C++11) for programming these
devices and application programming interfaces (APIs) to control the
platform and execute programs on the compute devices. OpenCL provides
a standard interface for parallel computing using task- and data-based
parallelism.

How and why are CUDA and OpenCL used in PoW Mining?

How much, if at all, does the Ethereum platform depend on these?

What are the alternatives?

Best Answer

  • Cuda and OpenCL are used to program highly parallel processors. Cuda was creted by Nvidia for its GPUs. OpenCL was proposed by Apple but is backed by major industry players like AMD, Intel, etc, it can be used to program from GPUs to billion processors supercomputers.
  • Ethash is the algorithm used for the Ethereum PoW. From its design rationale you can read it was designed to be GPU friendly.
  • Being AMD and Nvidia are the dominant companies in the GPU market, programming in Cuda (Nvidia) and OpenCL (AMD) should cover most GPUs available today.
  • Ethereum doesn't require a GPU to mine, there are CPU miners. But from an economical point of view it is not very convenient. To obtain a similar hashrate you need more CPUs consuming more electricity.
  • Ethereum has plans to switch from PoW to PoS so in the long term there is no dependency into GPUs and Cuda/OpenCL.
Related Topic