0

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?

2
  • 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.
1

Background

To mine a block, one must perform calculations. There's nothing magical about computers -- you can do the same thing with pen and paper, just much more slowly. Normally, computation on your computer is done using a CPU which is capable of performing a large variety of computations in rapid succession. A graphics card has a GPU (graphics processing unit) which is optimized for rapidly performing a more limited set of operations on different data at the same time. Instead of adding a single pair of numbers at a time, you can now add thousands of pairs of numbers at the same time. Now imagine trying to add random pairs of numbers together and stopping if any of the pairs adds up to 100. Even if a GPU takes 10x longer to do an addition than a CPU, if it can do more than 10x more additions at the same time as a CPU, it's still faster at this task. This is a gross simplification of what mining is, but it shows how GPUs can be much faster than CPUs. This is one of the reasons why people use GPUs instead of CPUs. Other reasons include energy efficiency (for this specialized task), cost per computation per second, and physical space.

CUDA and OpenCL

So how do CUDA and OpenCL fit in? They're a common language for programming graphics cards (nVidia only in the first case right now, AFAIK). Just like how a smartphone and your typical desktop computer are vastly different yet are both able to display web pages written in the same language, CUDA and OpenCL enable different GPUs to be instructed to carry out a particular set of operations. These just happen to be the standards that graphics cards manufacturers have settled upon and have no direct bearing on Ethereum.

Alternatives

Alternatives to using CUDA and OpenCL include mining on a CPU, custom building a chip to do the computation for Ethereum -- an application-specific integrated chip (ASIC) -- as is now used for Bitcoin, using pen and paper, or developing a new programming language for GPUs.

Since I'm sure one of your next questions is why ASICs aren't used for mining Ethereum but are used for Bitcoin, I'm going to pre-empt it: ASICs cost a lot of money to build and, because there is a large cost to produce even a single ASIC, it doesn't make economic sense to design/build something for low-volume applications. But if an ASIC is so expensive, why is it used for Bitcoin? ASICs can be optimized to perform particular sequences of operations or do certain things. But the expensive part of the graphics cards used for mining that is relevant to Ethereum is the memory on the card (not the GPU, which is part of the card, itself). Memory is expensive to manufacture; as such, the cost savings and efficiency gains from custom-designing an ASIC are not as good as they are for the hashing algorithm Bitcoin uses for mining blocks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.