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

Fortran MPI seems not implemented #24

Open
sheltongeosx opened this issue Aug 10, 2023 · 8 comments
Open

Fortran MPI seems not implemented #24

sheltongeosx opened this issue Aug 10, 2023 · 8 comments

Comments

@sheltongeosx
Copy link

Running MPI tests with Recorder library preloaded, it looks that the error flag is not set after calling any MPI interface.

@wangvsa
Copy link
Member

wangvsa commented Aug 10, 2023

Recorder does has Fortran wrappers and the error flag is set when the C interface has a return parameter.

@sheltongeosx
Copy link
Author

Thank you for your quick response!
I did not see the error flags being set in Fortran interfaces. The following is a little test code in Fortran:

PROGRAM Hello_from
IMPLICIT NONE
INCLUDE "mpif.h"
INTEGER:: np,myid,err
CALL MPI_INIT (err)	
CALL MPI_COMM_SIZE (MPI_COMM_WORLD, np, err)
err=2001
write(*,*)"==> Starting err=", err
CALL MPI_COMM_RANK (MPI_COMM_WORLD, myid, err)
WRITE(*,*) "Hello world! from", myid, " of", np, " ending err=", err
CALL MPI_FINALIZE (err)	
END PROGRAM Hello_from

Here is the output from running it with 2 mpi processes, without Recorder preloaded:
==> Starting err= 2001
Hello world! from 0 of 2 ending err= 0
==> Starting err= 2001
Hello world! from 1 of 2 ending err= 0

Here is with Recorder preloaded:
==> Starting err= 2001
Hello world! from 0 of 2 ending err= 2001
==> Starting err= 2001
Hello world! from 1 of 2 ending err= 2001

@wangvsa
Copy link
Member

wangvsa commented Aug 10, 2023

@sheltongeosx You are right! I just checked the code and the current implementation simply returns the error code from the C interface but didn't set it for the Fortran wrappers. I will fix this. Thanks for catching this.

@wangvsa wangvsa pinned this issue Aug 11, 2023
@wangvsa
Copy link
Member

wangvsa commented Aug 17, 2023

@sheltongeosx This has been fixed in the latest updates.

@sheltongeosx
Copy link
Author

sheltongeosx commented Aug 23, 2023

@wangvsa Thank you very much for your work!

Yes testing with the code provided above seems that the issue is gone. But it still has issue with Fortran mpi_bcast() call in my application - error flag is still not set after the call (values are correctly broadcasted though). It is found that it returned from the the line 267 during executing RECORDER_INTERCEPTOR_PROLOGUE macro in file lib/recorder-mpi.c without setting the error flag. Looking it further a bit it returned from the macro at line 163 of file include/recorder.h, where it can tell that the logger was not initialized.
Bye the way, testing fortran mpi_bcast() standalone with Recorder shows no issue. Unfortunately bcast in my app runs into the issue....

@wangvsa
Copy link
Member

wangvsa commented Aug 23, 2023

Recorder is initialized at MPI initialization time. When bcast is called, recorder should already be initialized. Nevertheless, even it was not initialized, I should still set the error flag. Will fix this soon, btw, which application are you running?

@sheltongeosx
Copy link
Author

It is Quantum ESPRESSO: https://gitlab.com/QEF/q-e

@wangvsa
Copy link
Member

wangvsa commented Aug 24, 2023

The error flag issue has been solved. But I found an even more problematic issue #25 when running Quantum ESPRESSO. I may need to check with the MPICH team on this.

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