Skip to content

Added DmtcpCkptHeader struct#1144

Merged
karya0 merged 3 commits intomainfrom
dev/kaarya0/launch-refactor-prep-2
Feb 27, 2025
Merged

Added DmtcpCkptHeader struct#1144
karya0 merged 3 commits intomainfrom
dev/kaarya0/launch-refactor-prep-2

Conversation

@karya0
Copy link
Copy Markdown
Member

@karya0 karya0 commented Sep 18, 2024

This struct merges and replaces the previously separate DMTCP and MTCP headers. This would allow us to refactor dmtcp_launch/restart for MANA usage.

This unified struct is written twice to the ckpt-image-- the first copy is read by dmtcp_restart while the second copy is read by mtcp_restart binary. As an added benefit,

[From conversation with @gc00 : This is done because the ckpt image may be compressed, and so read through a pipe. We cannot use lseek on a pipe. So, we copy an identical copy of the header, so that when reading again from mtcp_restart, we don't need to lseek back to the beginning of the original header. ]

it also simplifies the mtcp_restart logic of searching for ckpt-header inside the ckpt image.

As part of the unified struct declaration, I used anonymous structs/unions to ensure size compatibility across 64-bit, 32-bit, and mixed-mode computation in a clean manner. This is primarily why this PR also moves the codebase to C11 mode. Note that we are already at C++14 (and will soon be at C++17).

@karya0 karya0 force-pushed the dev/kaarya0/launch-refactor-prep-2 branch 2 times, most recently from a17de56 to b431c50 Compare September 18, 2024 19:53
@karya0 karya0 force-pushed the dev/kaarya0/launch-refactor-prep-2 branch from b431c50 to f4a00bf Compare September 23, 2024 21:41
@gc00
Copy link
Copy Markdown
Contributor

gc00 commented Sep 24, 2024

@karya0 , I'll review this one after the 3.1.0 release. It would be good to add a stable release before doing a merge of the headers.

@karya0 karya0 requested review from gc00 and xuyao0127 September 24, 2024 07:49
@karya0 karya0 force-pushed the dev/kaarya0/launch-refactor-prep-2 branch 3 times, most recently from d2f5f08 to ee7abf4 Compare September 30, 2024 09:07
@karya0 karya0 force-pushed the dev/kaarya0/launch-refactor-prep-2 branch from ee7abf4 to 31c58ec Compare October 4, 2024 17:50
Copy link
Copy Markdown
Contributor

@gc00 gc00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the very clear description of the PR. And I agree that unifying the two headers is a big win, now that MTCP is not really an independent submodule.

QUESTIONL Have you done a quick test for m32 mode to make sure that we still support that? If not, then one of us should do that, before we push this in.

TWO MORE QUESTIONS: Changing the header means that the newest DMTCP will be incompatible with any previous checkpoint image. Should we:

  1. Change some header to change the version number in the header? (Or did you already do that?
  2. And also, when we do a future release, does this means that we must update DMTCP to version 3.2.0, or is it acceptable to do 3.1.1? What is the general practice in hese cases?

REQUEST: As I wrote in teh review, I'd much prefer just adding -std=gnu11 to the CFLAGS directly i configure.ac, if needed. This is far better than sprreading the logic in about 4 or 5 different files. Since 'gnu11' is really a different topic anyway, could we move that commit into a separate, independent PR, where we can discuss it? That will allow us to do a quick review of the more important commit: unifying the DMTCP/MTCP header.

@@ -28,6 +28,10 @@ AC_PROG_CPP
AC_CONFIG_MACRO_DIR([m4])
AX_CXX_COMPILE_STDCXX([14], [noext], [mandatory])

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand this code, it will always try to append -std=gnu11, assuming success. But if the default C compiler of the user is already C11-compatible, then this just adds confusion. Shouldn't we be conditionally appending, instead?

And if I misunderstood this code, then let's add a comment.

@@ -0,0 +1,50 @@
# ===========================================================================
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's easy in configure.ac to append to CFLAGS. Adding a special m4 file seems to add obfuscation, and the code is no longer local to a single file.

Am I missing something here?

@@ -112,7 +112,9 @@ dmtcplib_PROGRAMS = $(d_libdir)/libdmtcp.so$(EXEEXT)
@AARCH64_HOST_TRUE@am__append_2 = -latomic
subdir = src
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And see my note about the .m4 file.

@@ -100,7 +100,9 @@ libdmtcp_PROGRAMS = $(d_libdir)/libdmtcp_alloc.so$(EXEEXT) \
$(d_libdir)/libdmtcp_timer.so$(EXEEXT)
subdir = src/plugin
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto. And it would be nice to set the CFLAGS variable at top level, instead of spreading out some distributed code for eaach directory.

@@ -50,7 +50,7 @@ endif

DMTCP_INCLUDE=${top_srcdir}/include

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And ditto.

Copy link
Copy Markdown
Contributor

@gc00 gc00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm approving this in advance. Please see the two minor changes, requested.

@karya0 karya0 force-pushed the dev/kaarya0/launch-refactor-prep-2 branch from 31c58ec to 097ca6f Compare February 27, 2025 06:42
@karya0 karya0 force-pushed the dev/kaarya0/launch-refactor-prep-2 branch from 097ca6f to b448562 Compare February 27, 2025 06:47
@karya0 karya0 merged commit 8430267 into main Feb 27, 2025
1 check passed
@karya0 karya0 deleted the dev/kaarya0/launch-refactor-prep-2 branch February 27, 2025 06:59
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.

2 participants