mpickpt / mana

MANA for MPI
35 stars 24 forks source link

[MANA-286]Trim replay log of Type_indexed/Type_create_struct #295

Closed dahongli closed 1 year ago

dahongli commented 1 year ago

This PR has two changes related to MPI_Type record in the replay log.

[1] Support Type_indexed and Type_create_struct

This change supports record removal for two new type operations,
Type_indexed and Type_create_struct. It frees the record memory
once the record which creates or commits the type is removed from
Type_free.

[2] Fast way to find MPI_Type record to be freed

This slowness is introduced in the change of free MPI_Type records. The change goes
through all record-replay logs to find the MPI_Type record. The log has
tons of other MPI-like MPI_Request in addition to MPI_Type. That causes slowness.
This fix goes through the log records in the reverse
order. The latest MPI_Type operations is near the end. We stop walking
through the log once we find the creator of the MPI_Type record.

[ Added comment by @gc00 ] Current measurements show that the overhead incurred in this PR by removing the datatypes is negligible. If a non-negligible overhead is discovered in the future, then a possible further optimization is to create a hashmap of all datatypes, with the value pointing to the record that created it (Type_indexed or Type_create_struct). When the reference count of a datatype goes to zero, then the correcponding Type_indexed/Type_create_struct record in the log can be removed,