Multi-GPU and multi-core CPU heterogeneous computing--1 for OpenCL

Source: Internet
Author: User
Tags data structures arch linux

Original Author: Fei Hong surprised snow address Click to open the link

This paper mainly explores the problem of the heterogeneous computing of the GPU and multi-core CPUs of OpenCL, and briefly expounds what is the OpenCL heterogeneous computing, describes the characteristics of CPU and GPU, and combines them to make the foreground of heterogeneous computing. Then specifically how to build a multi-GPU and multi-core CPU heterogeneous OPENCL environment on a high performance Lab Linux workstation. Finally, the experimental results show that the installed OPENCL heterogeneous computing environment can work properly, which shows the platform,device of the multi-GPU and multi-core CPU heterogeneous environment of OPENCL. 1 What is OpenCL heterogeneous computing
OpenCL is not only a computer language, but also a very good API, it can make it easy for developers to develop a cross-platform GPU computing program, take advantage of the GPU's powerful computing power and then apply in various fields. At the same time, OPENCL support for heterogeneous operations is beginning to become clearer.

Figure 1 Cpu-gpu heterogeneous computing advocated by the OPENCL standard

We know that CPUs and GPUs have strengths, and the CPU is generally adept at handling irregular data structures and unpredictable access patterns, as well as recursive algorithms, branch-intensive code, and single-threaded threads. Such program tasks have complex instruction scheduling, looping, branching, logical judgments, and execution steps. For example, system software such as operating system, word processing, interactive application debugging, General computing, system control and virtualization technology, and general applications, etc. The GPU is adept at processing rule data structures and predictable access patterns. For example, light and shadow processing, 3D coordinate transformation, oil and gas exploration, financial analysis, medical imaging, finite element, genetic analysis and geographic information systems, as well as scientific computing and other applications.

Figure 2 AMD GPU Storage System under OpenCL

Although in many ways the GPU performance is excellent, but for a period of time, will maintain the CPU and GPU development of the situation, they can continue to play a role in their respective areas of expertise, and the future direction of evolution is complementary to each other, toward integration, and OpenCL is their integration and parallel development of the bridge. From the CPU point of view, in order to improve processing power, formerly multi-threading, is currently multicore, the future direction of development is the majority of the core.
The standard of OpenCL largely determines its future. Getting support from the entire computer/video hardware industry will also help. From an independent software developer's point of view, OpenCL is the gateway to mixed (GPU/CPU) computing. Anyone involved in high-performance computing will tell you that investing money and time on non-standard APIs is a risky business, and OpenCL clearly has greater potential.

Figure 3 ATI Stream programming model under open CL

The CPU is moving in the direction of increasing throughput and increasing energy efficiency, and from a GPU perspective, its programmable performance would have been a program that was cured inside the chip, then developed to be locally programmable and finally fully programmable. In other words, the GPU is developing in the direction of general processing while increasing the throughput being processed.

2 build OpenCL environment under Linux workstations

High-Performance lab, the OPENCL environment for Linux has been configured on both workstations.

The hardware and operating system configurations are as follows:

High Performance Lab workstation-1:

1 Redhat Linux 6.1 64-bit operating system
2 64-bit AMD 6-core processor, 32G memory, 500G HDD, dual graphics
3 graphics 1: ASUS HD 6870:AMD GPU chip ATI Radeon HD 6870
4 Graphics 2:nvidia Quadro FX 4800

High Performance Lab Workstation-2:
1. Arch Linux 64-bit operating system
2.64-bit AMD 6-core processor, 32G memory, 500G HDD, dual graphics
3. Graphics 1:nvidia Quadro FX 4800
4. Graphics 2:nvidia Quadro FX 4800

In general, the main step of the GPU graphics environment configuration is to install the video driver first, then the OpenCL SDK, and the AMD CPU environment configuration as long as the AMD's OpenCL SDK is installed directly, like Workstation-1, has installed AMD OpenCL for the video card The SDK can therefore use the CPU directly, and like workstation-2 if you intend to run the program on a multi-core CPU, you also need to install an AMD OpenCL SDK for AMD's CPU to provide an OPENCL environment. The configuration of the specific environment is as follows.

2.1 RedHat Linux 6.1 Working Environment Setup

Install the ATI graphics driver in linux text mode first, and then install the AMD OpenCL SDK in the graphical interface.

2.1.1 Installing ATI graphics card Drivers
ASUS HD 6870 graphics GPU chip for ATI Radeon HD 6870, to the AMD home page to download the latest graphics driver, here is
Installation drive

Enter the text command line mode under Linux (that is, start mode is 3), run the command under root user:
[CPP]View plain copy./ until the graphics card driver is successful, the following appears:
[CPP]View plain Copy Created Directory fglrx-install.0pft89 verifying archive integrity ...   All good.   Uncompressing ATI Catalyst (TM) proprietary Driver-8.911 ......................................................................................................   ========= ========================================================= ATI Technologies Catalyst (TM) proprietary Driver Installer  /packager ================================================================== Detected configuration:architecture: i686 (32-bit) X 6.9 or later configure the driver, run the following command
[CPP]The view plain copy aticonfig--initial does not output an error message stating that the installation is normal.

Reset to X Window mode (that is, start mode 5), reboot, install AMD OpenCL SDK below.

2.1.2 Installing the AMD OpenCL SDK
Download the 64-bit AMD OpenCL SDK software amd-app-sdk-v2.5-rc2-lnx64.tgz
Unzip the original AMD OpenCL SDK package
[CPP] view plain copy su mkdir sdk-install CD sdk-install CP amd-app-sdk-v2.5-lnx64.tgz./TAR-XVZF AM D-APP-SDK-V2.5-LNX64.TGZ RM amd-app-sdk-v2.5-lnx64.tgz Run automatic installation sh
[CPP] view plain copy./ Restart Machine
[CPP] view plain copy reboot run the test program to activate the OPENCL environment
[CPP] view plain copy cd/opt/amdapp/samples make

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.