Fix Fortran Wrapper Parameter Passing Bug in barrier and forget Functions#116
Fix Fortran Wrapper Parameter Passing Bug in barrier and forget Functions#116kellih wants to merge 3 commits into
Conversation
|
Hi @kellih, Many thanks for your contribution! Overall, the PR looks good to me. I just have one comment regarding the removal of the following lines in src/mui.h:
These should be kept. I believe the If you could revert these changes, I will carry out a final round of testing and then proceed with the merge. Thanks again for your contribution! |
| #include "samplers/temporal/temporal_sampler_gauss_adaptive.h" | ||
| #include "samplers/temporal/temporal_sampler_mean.h" | ||
| #include "samplers/temporal/temporal_sampler_sum.h" | ||
| #include "samplers/temporal/temporal_sampler_linear.h" |
There was a problem hiding this comment.
Please keep this include. temporal_sampler_linear has now been merged and is required.
| DECLARE_SAMPLER_0ARG(temporal_sampler_gauss,SUFFIX,config_##SUFFIX);\ | ||
| DECLARE_SAMPLER_0ARG(temporal_sampler_sum,SUFFIX,config_##SUFFIX);\ | ||
| DECLARE_SAMPLER_0ARG(temporal_sampler_mean,SUFFIX,config_##SUFFIX);\ | ||
| DECLARE_SAMPLER_0ARG(temporal_sampler_linear,SUFFIX,config_##SUFFIX);\ |
There was a problem hiding this comment.
Please keep this declaration. temporal_sampler_linear is now part of the main codebase.
| DECLARE_SAMPLER_0ARG(temporal_sampler_gauss,SUFFIX,CONFIG);\ | ||
| DECLARE_SAMPLER_0ARG(temporal_sampler_sum,SUFFIX,CONFIG);\ | ||
| DECLARE_SAMPLER_0ARG(temporal_sampler_mean,SUFFIX,CONFIG);\ | ||
| DECLARE_SAMPLER_0ARG(temporal_sampler_linear,SUFFIX,CONFIG);\ |
There was a problem hiding this comment.
Please keep this declaration. temporal_sampler_linear is now part of the main codebase.
| //Include temporal samplers | ||
| #include "samplers/temporal/temporal_sampler_exact.h" | ||
| #include "samplers/temporal/temporal_sampler_gauss.h" | ||
| #include "samplers/temporal/temporal_sampler_gauss_adaptive.h" |
There was a problem hiding this comment.
I don't think temporal_sampler_gauss_adaptive is a part of the code base. Suggest removing this include
Problem:
Fortran wrapper interfaces for barrier_* and forget_* functions incorrectly used the value attribute on scalar parameters (time values and reset flags), causing segmentation faults when called from Fortran code. The C++ implementation expects pointers (double *t, int *reset_log), but Fortran's value attribute passes by-value instead of by-reference.
Additional bug uncovered by commit 3ffd697 in CMakeLists.txt where MPI REQUIRED was not included for Fortran wrapper.
Scope:
Affects 90 function interfaces across all three spatial dimensions:
Changes Made:
unit_test.f90: Added barrier calls after commit and forget calls after fetch for 1D, 2D, and 3D interfacesunit_test_multi.f90: Added barrier/forget loops for all dimensions in multi-interface testBackward Compatibility:
No API changes - this is a pure bug fix correcting the ABI between Fortran and C++.
Resolves issue #115