Skip to content

Remove string copies in fckit_mpi_broadcast_string and fckit_mpi_broadcast_file (fixes #81)#89

Open
wdeconinck wants to merge 1 commit into
developfrom
fix/81-nag_broadcast_file
Open

Remove string copies in fckit_mpi_broadcast_string and fckit_mpi_broadcast_file (fixes #81)#89
wdeconinck wants to merge 1 commit into
developfrom
fix/81-nag_broadcast_file

Conversation

@wdeconinck
Copy link
Copy Markdown
Member

Description

Alternative fix for #81 than attempted with #88.
This fix removes the copies of buffers within Fortran to which append a null terminator character.

@DJDavies2 could you review this with NAG compiler as well?

Contributor Declaration

By opening this pull request, I affirm the following:

  • All authors agree to the Contributor License Agreement.
  • The code follows the project's coding standards.
  • I have performed self-review and added comments where needed.
  • I have added or updated tests to verify that my changes are effective and functional.
  • I have run all existing tests and confirmed they pass.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 51.15%. Comparing base (9496879) to head (da52c90).

Files with missing lines Patch % Lines
src/fckit/module/fckit_mpi.cc 0.00% 4 Missing ⚠️
src/fckit/module/fckit_mpi.fypp 0.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop      #89      +/-   ##
===========================================
+ Coverage    51.07%   51.15%   +0.08%     
===========================================
  Files           58       58              
  Lines         4854     4846       -8     
  Branches       453      452       -1     
===========================================
  Hits          2479     2479              
+ Misses        2375     2367       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@DJDavies2
Copy link
Copy Markdown
Contributor

Unfortunately I get this failure:

Runtime Error: /home/users/david.davies/cylc-run/mo-bundle-415/share/mo-bundle/fckit/src/fckit/module/fckit_shared_ptr.F90, line 193: Attempt to DEALLOCATE an undefined pointer
Program terminated by fatal error

@wdeconinck
Copy link
Copy Markdown
Member Author

Hmmm I'm now thinking this has to be due to another issue then related to fckit_shared_ptr which is quite hard to debug.
The pointer this%refcount_ in fckit_shared_ptr.F90, line 193 has to be associated. In my local tests with prints it is.
Does valgrind point to any memory issue?

@DJDavies2
Copy link
Copy Markdown
Contributor

I think there are issues with fckit_shared_ptr, I am having issues with that with other compilers as well (see #86). When I print the association status of this % refcount_ just before the deallocate statement it returns true for both gnu and nag, but the actual deallocate then fails for nag. This implies that the pointer has got corrupted somewhere, but I don't know where.

@DJDavies2
Copy link
Copy Markdown
Contributor

I don't really know what to do about this. I don't like saying how I think there is a problem with fckit_shared_ptr because currently the other fckit tests work with NAG (#86 is invalid for now, but I don't know why, I will close it). However running tests in other codes that use fckit sometimes run in to failures that die in fckit, often fckit_shared_ptr.

@DJDavies2
Copy link
Copy Markdown
Contributor

If I put

write(0, '(a,a)') "in broadcast_file 1, trim(path) = ", trim(path); flush(0)

in the broadcast_file function the broadcast_file ctest passes.

@wdeconinck
Copy link
Copy Markdown
Member Author

Sounds indeed like a memory corruption. I wonder what valgrind has to say about it.
Also can you give me the output of the cmake configuration similar to the following?

Feature FINAL enabled
FCKIT_HAVE_FINAL [1]
FCKIT_FINAL_FUNCTION_RESULT                      = 1
FCKIT_FINAL_UNINITIALIZED_LOCAL                  = 0
FCKIT_FINAL_UNINITIALIZED_INTENT_OUT             = 1
FCKIT_FINAL_UNINITIALIZED_INTENT_INOUT           = 0
FCKIT_FINAL_NOT_PROPAGATING                      = 0
FCKIT_FINAL_NOT_INHERITING                       = 0
FCKIT_FINAL_BROKEN_FOR_ALLOCATABLE_ARRAY         = 1
FCKIT_FINAL_BROKEN_FOR_AUTOMATIC_ARRAY           = 0
FCKIT_FINAL_NOT_INHERITING_FOR_ALLOCATABLE_ARRAY = 0
FCKIT_FINAL_NOT_INHERITING_FOR_AUTOMATIC_ARRAY   = 0

@DJDavies2
Copy link
Copy Markdown
Contributor

Regarding the FINAL stuff the cmake output is:

-- Checking Fortran support for "finalization"
-- Checking Fortran support for "finalization" -- works
-- Feature FINAL enabled
-- FCKIT_HAVE_FINAL [1]
-- FCKIT_FINAL_FUNCTION_RESULT = 1
-- FCKIT_FINAL_UNINITIALIZED_LOCAL = 0
-- FCKIT_FINAL_UNINITIALIZED_INTENT_OUT = 1
-- FCKIT_FINAL_UNINITIALIZED_INTENT_INOUT = 0
-- FCKIT_FINAL_NOT_PROPAGATING = 0
-- FCKIT_FINAL_NOT_INHERITING = 0
-- FCKIT_FINAL_BROKEN_FOR_ALLOCATABLE_ARRAY = 1
-- FCKIT_FINAL_BROKEN_FOR_AUTOMATIC_ARRAY = 0
-- FCKIT_FINAL_NOT_INHERITING_FOR_ALLOCATABLE_ARRAY = 0
-- FCKIT_FINAL_NOT_INHERITING_FOR_AUTOMATIC_ARRAY = 0

Regarding valgrind, which options to you want me to use?

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

Successfully merging this pull request may close these issues.

3 participants