Skip to content

JungleComputing/reduction-mcl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

reduction-mcl

Introduction

This repository contains a simple reduction implemented in Many-Core Levels (MCL). The kernel is written on the highest level of abstraction perfect, conform to an idealized many-core device. To verify the outcome it is possible to run the CPU version as well.

Directory structure

The repository contains two source directories cpp and mcl. The mcl directory contains the MCL kernel that should be compiled with the MCL compiler. This directory has its own Makefile. By means of the Makefile, the MCL compiler generates a header file, a C++ file, and an OpenCL file in the directory cpp/reduction that will subsequently be compiled by the C++ compiler.

The cpp directory contains the main application that will call the MCL kernel. As discussed above, it will contain a generated directory reduction with C++ files generated by MCL. This directory has its own Makefile that will create the binary reduce.

The main applications uses three libraries in the directory cpp/lib that are provided with git submodules. The three libraries lib-io-data, lib-timer, and lib-opencl-wrapper are independent and each have their own Makefile.

Prerequisites

This application has the following prerequisites:

  • An OpenCL device, see the specifics below
  • A C++ compiler (tested with GCC)
  • make (tested with GNU make)
  • MCL version 0.1.5 with the binary mcl in the path

We currently support the following devices:

  • A CPU with an OpewnCL runtime installed (default), tested with OpenCL 1.2 LINUX with an Intel Core i7 device.
  • An Intel GPU by means of the Beignet library, tested with Beignet 1.3.2. To use this, choose as target intel_gpu for compilation below.
  • A CUDA device, at least of architecture Fermi with an NVIDIA CUDA OpenCL runtime (tested with CUDA 9, OpenCL 1.2). To use this, choose as target fermi for compilation below.

Obtaining the code

We first clone and enter this repository:

git clone https://github.com/JungleComputing/reduction-mcl.git
cd reduction-mcl

We then fetch the submodules:

git submodule init
git submodule update

Building code

As mentioned earlier, each directory contains its own Makefile, but there is a global one in the root directory as well. To build all the sources, perform:

make all

Currently, the target hardware description is xeon_e5620 that describes the Xeon e5620 CPU. It is possible to run this on any CPU. To choose an alternate target, choose one from intel_gpu or fermi, and build with:

make TGT=<your choice> all

Running the code

To run the application, move to directory cpp:

cd cpp

And call the reduce program:

./reduce

About

A simple reduction with atomic adds

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published