Update Fortran MPI interface: "use mpi" instead of "include mpif.h"#46
Update Fortran MPI interface: "use mpi" instead of "include mpif.h"#46danielhollas merged 2 commits intomasterfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## master #46 +/- ##
=======================================
Coverage 54.67% 54.67%
=======================================
Files 36 36
Lines 5536 5536
=======================================
Hits 3027 3027
Misses 2509 2509
|
033c723 to
404b2cd
Compare
| @@ -1,5 +1,5 @@ | |||
| CXX = g++ | |||
| CXXFLAGS = -g -O2 -Wall | |||
| CXXFLAGS = -O2 -Wall -std=c++11 | |||
There was a problem hiding this comment.
This was overlooked in the last PR. :-(
| end if | ||
|
|
||
| timer = MPI_WTIME(ierr) | ||
| timer = MPI_WTIME() |
There was a problem hiding this comment.
MPI_WTIME() does not return any errors. This kind of error can be caught by using use mpi instead of include mpif.h.
| call MPI_recv(fyc_new ,size1*size2, MPI_DOUBLE_PRECISION, dest, tag_fy, MPI_COMM_WORLD, status, ierr ) | ||
| call MPI_recv(fzc_new, size1*size2, MPI_DOUBLE_PRECISION, dest, tag_fz, MPI_COMM_WORLD, status, ierr ) | ||
| call MPI_recv(irank, 1, MPI_INTEGER, dest, tag_fz, MPI_COMM_WORLD, status, ierr ) | ||
| call MPI_Send(x, size1*size2, MPI_DOUBLE_PRECISION, dest, tag_x, MPI_COMM_WORLD, ierr) |
There was a problem hiding this comment.
Here again, the status parameter should not be there in MPI_Send(). Hopefully, this did not introduce any practical problem in the REMD code, since we're not checking the ierr variable anyway (but we really should).
|
|
||
| # TODO: This is extremely brittle, we should at least | ||
| # verify that the number of parameters is correct! | ||
| if [[ $# -ne 7 ]]; then |
There was a problem hiding this comment.
Changes in test.sh and Makefile do not actually pertain to MPI, but they were a nice cleanup.
| .cpp.o: | ||
| $(CXX) $(CXXLAGS) $(DFLAGS) -c $< | ||
| %.o: %.cpp | ||
| $(CXX) $(CXXFLAGS) $(DFLAGS) -c $< |
There was a problem hiding this comment.
Whoops, previous PR had a typo, CXXLAGS -> CXXFLAGS
|
|
||
| .cpp.o: | ||
| $(CXX) $(CXXLAGS) $(DFLAGS) -c $< | ||
| %.o: %.cpp |
There was a problem hiding this comment.
This is a more modern approach, as per:
https://www.gnu.org/software/make/manual/html_node/Suffix-Rules.html
| testclean : | ||
| /bin/bash TESTS/test.sh ${BIN} clean ${MPI} ${FFTW} $(PLUMED) ${CP2K} | ||
| testclean: | ||
| /bin/bash TESTS/test.sh ${BIN} $(TEST) ${MPI} ${FFTW} $(PLUMED) ${CP2K} clean |
There was a problem hiding this comment.
This is now more consistent.
Closes #33. We might be able to use 'use mpi_f08', which is recommended, but need to test whether it's supported by all compiler versions in our CI suite. It might also require some code changes. See https://www.mpi-forum.org/docs/mpi-3.1/mpi31-report/node408.htm As an unfortunate side-effect, we now need to build our own MPICH and OpenMPI in Github Actions, for each GFortran version, since use mpi does not allow using different GFortran versions for MPI compiler and ABIN. Probably a good thing to do anyway. The MPICH and OpenMPI builds take a long time, but we cache them so it's not so bad (GA cache should last at least a week).
Closes #33. This change uncovered a couple of bugs we had in various MPI calls, fortunately nothing critical.
As an unfortunate side-effect, we now need to build our own MPICH and OpenMPI in Github Actions, for each GFortran version,
since
use mpidoes not allow using different GFortran versions for MPI compiler and ABIN. That is unfortunate, but probably a good thing to do anyway. The MPICH and OpenMPI builds take a long time, but we cache them so it's not so bad (GA cache should last at least a week).As part of this, I also did a bit more cleanup of
MakefileandTEST/test.sh.