Skip to content

Optimize matrix_cl constructors #1420

Closed

Description

@t4c1

Description

When constructing a matrix_cl from Eigen::Map it creates a copy of the data by calling .eval(). Instead of this the data in Map should be directly accessed.

When constructing a matrix_cl from a rvalue (temporary object), it uses blocking calls to OpenCL to avoid accessing these objects after they are destroyed. Instead these objects could be moved (or evaluated in case of Eigen expressions) on heap and deleted after the copy to OpenCL device is complete.

Example

int rows, cols;
double* data;
Eigen::Map<Eigen::MatrixXd> map(data, rows, cols);
matrix_cl(map);
Eigen::MatrixXd a, b;
matrix_cl(a + b);

Expected Output

Constructing matrix_cl from a Map is faster. Constructing matrix_cl from a temporary does not block.

Current Version:

v3.0.0

Activity

  1. added this to the 3.0.0++ milestone on Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions