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

Is it allowed to have big matrix? #298

Closed
zhaoli-IHEP opened this issue Jan 31, 2020 · 3 comments
Closed

Is it allowed to have big matrix? #298

zhaoli-IHEP opened this issue Jan 31, 2020 · 3 comments

Comments

@zhaoli-IHEP
Copy link

zhaoli-IHEP commented Jan 31, 2020

We are trying big matrix multiplication, but we found when matrix size reaches about 400x400, the function "fgemm" will give segmentation fault. Do we have other choices?
Also if what we need is only multiplication of two matrices, do we have to use fgemm?

@ClementPernet
Copy link
Member

Of course, you can use matrices as large as your memory permits. 400x400 is typically still a small matrix.
Please feel free to share you code, so we can inspect it.
Maybe you are allocating the matrix on the stack, as in the tutorial file, which of course should be avoided for larger matrices. Consider allocating them on the heap using

Field::Element_prt A = fflas_new (F,Nrows,Ncols);
fgemm(...);
fflas_delete(A);

@zhaoli-IHEP
Copy link
Author

Of course, you can use matrices as large as your memory permits. 400x400 is typically still a small matrix.
Please feel free to share you code, so we can inspect it.
Maybe you are allocating the matrix on the stack, as in the tutorial file, which of course should be avoided for larger matrices. Consider allocating them on the heap using

Field::Element_prt A = fflas_new (F,Nrows,Ncols);
fgemm(...);
fflas_delete(A);

Thank you for the reply.
Yes, we just modified the tutorial example.
But we just got another question. Is the function "fgemm" using multi-thread? If so, can we turn it into single-thread?
Also if we only need multiplication of two matrices, is "fgemm" the only function we can use?

@ClementPernet
Copy link
Member

fgemm is by default single-threaded, and pfgemm is for the multi-threaded (OpenMP) variant.
And yes, this is the routine for multiplying arbitrary dense matrices.

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