Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tutorial Request] Elementwise Operation #285

Open
WenyinWei opened this issue Nov 30, 2019 · 10 comments
Open

[Tutorial Request] Elementwise Operation #285

WenyinWei opened this issue Nov 30, 2019 · 10 comments

Comments

@WenyinWei
Copy link

Hello Karl,

I am looking for the elementwise operation for a quick initialization of matrices on the GPU. And I found that viennacl uses the compile-time definitions to make these functions matrix_operations.hpp, line 701-825 . It is pretty concise, yeah, but it really needs a tutorial or some like that to illustrate how to use these functions. They even do not appear in the doxygen document that new comers would have no idea about how to do the function.

Best wishes,
Wenyin

@WenyinWei
Copy link
Author

WenyinWei commented Feb 26, 2020

Hello, Karl, @karlrupp I have some trouble while using element_op functions.

When I use the following command to get the element_geq, _greater, _less and etc, I got the result matrix_expression but I don't know how to handle it. I can't impose copy functions to fetch the result back to CPU or do other things. And I have no idea about what it would return, if 1 for geq, 0 for less or -1 for less?

@karlrupp
Copy link
Collaborator

Assign it to a matrix object, e.g. A = element_geq(B, C);

@WenyinWei
Copy link
Author

WenyinWei commented Feb 26, 2020

2020-02-26 16-28-29 Screenshot
Yeah, I have tried, but still stuck by a bug.

I tried to select the binary elementwise functions which can work.
element_prod, _div, _pow works,
_eq, _neq, _greater, etc. don't work.

2020-02-26 16-42-58 的屏幕截图

@karlrupp
Copy link
Collaborator

Uh, then I guess that these other operators have not been implemented for matrices yet.

@WenyinWei
Copy link
Author

Uh, Karl, I found that arctan function works well. Maybe that could serve as a temporary workaround, but just temp.

@WenyinWei
Copy link
Author

Hello Karl, would you mind requesting the original maintainers to have a minor update? Though atan function serves as a kind of workaround, it sacrifices too much performance.

@WenyinWei
Copy link
Author

2020-03-01 16-49-14 的屏幕截图
Here is my test error of viennacl::linalg::element_abs on matrix.

@WenyinWei
Copy link
Author

Hello @karlrupp , may I ask about whether viennacl is not maintained anymore and shall I turn to PETSc?

@karlrupp
Copy link
Collaborator

As I said, element_abs is not implemented for matrices yet. Thus, this is not a question about maintenance, but a feature request ;-)

Do you need abs for the full matrix, or just for a submatrix? For a full matrix you could reuse the existing vector kernels (I can show you how to do it).

@WenyinWei
Copy link
Author

Yeah, Karl, I would appreciate it if you could show me how to do that when you are free. It would be better if the trick is generic for geq and max.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants