Class MatrixVectorMul

java.lang.Object
org.apache.flink.streaming.examples.gpu.MatrixVectorMul

public class MatrixVectorMul extends Object
Implements the matrix-vector multiplication program that shows how to use GPU resources in Flink.

The input is a vector stream, which will generate random vectors with specified dimension. The data size of the vector stream could be specified by user. Each vector will be multiplied with a random dimension * dimension matrix in MatrixVectorMul.Multiplier and the result would be emitted to output.

Usage: MatrixVectorMul [--output <path>] [--dimension <dimension> --data-size <data_size>]

If no parameters are provided, the program is run with default vector dimension 10 and data size 100.

This example shows how to:

  • leverage external resource in operators,
  • accelerate complex calculation with GPU resources.

Notice that you need to add JCuda natives libraries in your Flink distribution by the following steps:

  • download the JCuda native libraries bundle for your CUDA version from http://www.jcuda.org/downloads/
  • copy the native libraries jcuda-natives and jcublas-natives for your CUDA version, operating system and architecture to the "lib/" folder of your Flink distribution
  • Constructor Details

    • MatrixVectorMul

      public MatrixVectorMul()
  • Method Details