Reference-LAPACK / lapack

LAPACK development repository
Other
1.49k stars 433 forks source link

Having problem with finding inverse of a square matrix by using Lapacke with MPI #422

Closed amamun closed 4 years ago

amamun commented 4 years ago

I am trying to find the inverse of a square matrix using LAPACKE_dgetrf and LAPACKE_dgetri in parallel processing using MPI. I am putting just that part of the code,

        int piv[innerDim+1];
        lapack_int ret;
        ret=LAPACKE_dgetrf(LAPACK_COL_MAJOR, innerDim, innerDim, dummyAP, innerDim, piv);
        if (ret!=0) {
              printf("The Matrix is singular\n");
        }
        LAPACKE_dgetri(LAPACK_COL_MAJOR, innerDim, dummyAP, innerDim, piv);

If I use gcc the result is right, but if I use mpicc I have errors.

Any suggestions would be greatly appreciate. Thanks in advance.

mu578 commented 4 years ago

Hello @amamun (Hi is a vulgarity, please don't) not really the place; use a debugger and at least dump assembly instruction set produced; this is a minimum syndicale as we say it in french; the problem described by your title doesn't match the issue. Please update and provide minimum stack frame. Thank you. My personal suggestion is the C99 VLA feature used causing the issue.

amamun commented 4 years ago

I am just a beginner in MPI and LAPACKE and I felt kind of dumb to see the responses I have been seeing here. I thought to myself that I should learn more about these and come back here to ask questions. I mean I came to know I am not even qualified to ask questions here. Thanks a lot.

mu578 commented 4 years ago

Hello @amamun insolence with no style, isn't a proof of sincerity. Even if this issue has been closed; please provide what has been asked from you. Thank you.

amamun commented 4 years ago

Hello @amamun insolence with no style, isn't a proof of sincerity. Even if this issue has been closed; please provide what has been asked from you. Thank you.

I am really really sorry if my comments somehow did not show any sincerity. Actually I did not quite get your question and before I can ask anything the post was closed. That's why I said Thanks a lot guys. My intention was truly nothing else. Again thanks a lot and I am sorry .

langou commented 4 years ago

No worries @amamun. If you want to run GETRF+GETRI in parallel distributed (with MPI), then LAPACK is not going to do it for you, you need to use SLATE for example ( https://icl.utk.edu/slate/ ). If you want to run many sequential GETRF+GETRI in parallel using MPI, then yes, LAPACK should work and compiling with mpicc should have done the trick.

mu578 commented 4 years ago

Hello, @amamun don't be sorry; just answer; there is an issue with people born in this time frame; they just need to excuse themselves or beg, worse fell; where basic informations were inquired.

amamun commented 4 years ago

No worries @amamun. If you want to run GETRF+GETRI in parallel distributed (with MPI), then LAPACK is not going to do it for you, you need to use SLATE for example ( https://icl.utk.edu/slate/ ). If you want to run many sequential GETRF+GETRI in parallel using MPI, then yes, LAPACK should work and compiling with mpicc should have done the trick.

@langou My Goal is to find the inverse of a square matrix only one time in rank 0 where the information about the aforementioned square matrix is collected by using MPI_Gather. Don't know whether I made myself clear. Thank you very very much.

mu578 commented 4 years ago

if the rank is zero there is strictly no linear dependencies. Now absolute zero rank computer side means nothing. + Your issue seats on computer coding/programming skill set realm; optionally on mathematical side of things too. + Still we don't have the nature of error neither the two compilers instruction set outputs; may we finally have them? that was the genuinely sense and intend of my previous remark; stop feeling; provide. Thank you.

langou commented 4 years ago

So you have a matrix spread on various processes, you gather it on process 0 using MPI_Gather, then you want to compute the inverse of this matrix in sequential on process 0. Sounds good. You can use LAPACK for this. I do not now why gcc works and mpicc does not. Maybe recompile LAPACKE with mpicc. This question would be better on LAPACK forum: https://icl.cs.utk.edu/lapack-forum/ I think I will delete the thread soon. I do not think this is related to an LAPACK software issue. @langou

zerothi commented 4 years ago

First debug path; check that the matrix is the same for serial and mpi runs!