This repository contains several applications that drive kernels generated by Many-Core Levels (MCL) for OpenCL and CUDA. For a particular application, there is a CUDA version and an OpenCL version. Both these versions run a CPU kernel and then the MCL kernel comparing the output.
The repository contains a library directory lib
with three libraries for I/O,
timing, and conveniently calling OpenCL applications. Besides this, the
repository contains application directories, for example vectoradd
. Each
application directory has three subdirectories:
generic
cuda
opencl
The generic
directory contains C++ files that are used to drive both the
OpenCL and CUDA kernels. The files in this directory are symlinked into cuda
and opencl
. The cuda
and opencl
directory contain a Makefile and the
output from MCL should be symlinked into this directory. For example, for
vector addition, the MCL compiler creates a vectoradd
directory that should
be symlinked or copied into this directory. The Makefile will compile the
program.
To be able to compile the OpenCL and CUDA programs, it is first necessary to
compile the libraries in lib
. For each library, go to the src
directory
and run make
.
This application has the following prerequisites:
- A CUDA device, see the specifics below
- A CUDA installation with
nvcc
- make (tested with GNU make)
We first clone and enter this repository:
git clone https://github.com/JungleComputing/mcl-applications.git
cd mcl-applications
We then fetch the submodules:
git submodule init
git submodule update
Each applications has its own Makefile
for both CUDA and OpenCL. First it is
necessary to compile the shared libraries:
cd lib/lib-io-data/src
make
cd -
cd lib/lib-opencl-wrapper/src
make
cd -
cd lib/lib-timer/src
make
cd -
Then it is necessary to symlink or copy the output from the MCL compiler. For
example, for vector addition, we assume that the MCL compiler generated output
for OpenCL in $(MCL_OUTPUT_DIR)
.
cd vectoradd/opencl
ln -s $(MCL_OUTPUT_DIR)/vectoradd
We can then run make
For example, for vector addition, to run an application, move to directory
vectoradd/cuda
or vectoradd/opencl
and run:
./vecadd