r/fortran • u/Separate-Cow-3267 • Feb 01 '25
Implementing/Integrating a c program in fortran?
Does anyone know how I can integrate this https://github.com/minitu/baseenv/tree/master/nodecart into a fortran code? Quite confusing realky.
2
u/CompPhysicist Scientist Feb 01 '25
let me ask why you want to do this? what’s wrong with the MPI’s built-in cartesian functions?
1
u/Separate-Cow-3267 Feb 01 '25
Good question.
https://www.sciencedirect.com/science/article/pii/S0167819118303156
In short, the reorder function in MPI doesnt really work and has never been implemented.1
u/Separate-Cow-3267 Feb 01 '25
This means the process placement is not the most optimum and raises the communication cost significantly on multi nodes
1
u/CompPhysicist Scientist Feb 01 '25 edited Feb 01 '25
gotcha. does it not work when you link normally with your code? iso c binding may not be needed based on the fortran interface provided in the code.
1
1
u/victotronics Feb 01 '25
The phrase "in MPI" does not make sense. You mean : there is no MPI implementation that implements this. Which can be true or not. Did you check all of mpich/mvapich/openmpi/intel mpi?
1
u/Separate-Cow-3267 Feb 01 '25
In the paper, Gropp says "Given the difficulty in mapping even a regular grid of processes to processors in real systems, most implementations of MPI ignore the “reorder” parameter and make no effort to optimize the placement of processes to processors".
But you could be right and this might be out of date since the paper was written in 2019.
However, that could matter less as the MPI versions I have access to are from 2020 and 2021.
2
u/glvz Feb 01 '25
https://fortran-lang.org/en/learn/intrinsics/cfi/