Skip to content

Commit 918ec3a

Browse files
committed
Patch darshan-apmpi.c to fix variable redefinition problem
* Make __darshan_disabled a local variable. * Without this fix, the compile error messages shown below will appear. In file included from darshan-apmpi.c:18: darshan-apmpi.c: In function ‘__wrap_MPI_Barrier’: /home/runner/work/darshan/darshan/darshan-runtime/lib/darshan.h:227:9: error: redefinition of ‘__darshan_disabled’ 227 | int __darshan_disabled = darshan_core_disabled_instrumentation() | ^~~~~~~~~~~~~~~~~~ darshan-apmpi.c:32:11: note: in expansion of macro ‘MAP_OR_FAIL’ 32 | MAP_OR_FAIL(PMPI_Barrier);\ | ^~~~~~~~~~~ darshan-apmpi.c:1389:5: note: in expansion of macro ‘TIME_SYNC’ 1389 | TIME_SYNC(__real_PMPI_Barrier(comm)); | ^~~~~~~~~
1 parent 4202cf1 commit 918ec3a

File tree

4 files changed

+52
-2
lines changed

4 files changed

+52
-2
lines changed

Makefile.am

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
ACLOCAL_AMFLAGS = -I maint/config
77

8-
SUBDIRS =
8+
SUBDIRS = modules .
99

1010
if BUILD_DARSHAN_RUNTIME
1111
SUBDIRS += darshan-runtime

configure.ac

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ fi
5757
dnl must configure subpackages even if they are not built
5858
AC_CONFIG_SUBDIRS([darshan-util])
5959

60-
AC_CONFIG_FILES(Makefile)
60+
AC_CONFIG_FILES(Makefile modules/Makefile)
6161

6262
AC_OUTPUT
6363

modules/Makefile.am

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#
2+
# See COPYRIGHT notice in top-level directory.
3+
#
4+
# @configure_input@
5+
6+
apmpi_c_src = $(srcdir)/autoperf/apmpi/lib/darshan-apmpi.c
7+
apmpi_c_saved = $(srcdir)/autoperf/apmpi/lib/saved_darshan-apmpi.c
8+
apmpi_c_patch = $(srcdir)/apmpi.patch
9+
10+
# Rule to apply the patch
11+
$(apmpi_c_saved): $(apmpi_c_src) $(apmpi_c_patch)
12+
cp -f $(apmpi_c_src) $(apmpi_c_saved)
13+
patch -f -p0 $(apmpi_c_src) < $(apmpi_c_patch)
14+
touch $@
15+
16+
BUILT_SOURCES = $(apmpi_c_saved)
17+
18+
EXTRA_DIST = apmpi.patch
19+
20+
clean: $(apmpi_c_saved)
21+
cp -f $(apmpi_c_saved) $(apmpi_c_src)
22+
rm -f $(apmpi_c_saved) $(apmpi_c_src).*
23+

modules/apmpi.patch

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--- darshan-apmpi.c.orig 2025-10-03 14:11:57.395296967 -0500
2+
+++ darshan-apmpi.c 2025-10-03 14:22:12.684565527 -0500
3+
@@ -29,14 +29,16 @@
4+
#define TIME_SYNC(FUNC) \
5+
double tm1, tm2, tm3, tdiff, tsync;\
6+
int ret; \
7+
- MAP_OR_FAIL(PMPI_Barrier);\
8+
- tm1 = APMPI_WTIME(); \
9+
- ret = __real_PMPI_Barrier(comm); \
10+
- tm2 = APMPI_WTIME(); \
11+
- ret = FUNC; \
12+
- tm3 = APMPI_WTIME(); \
13+
- tdiff = tm3-tm2; \
14+
- tsync = tm2-tm1
15+
+ { \
16+
+ MAP_OR_FAIL(PMPI_Barrier);\
17+
+ tm1 = APMPI_WTIME(); \
18+
+ ret = __real_PMPI_Barrier(comm); \
19+
+ tm2 = APMPI_WTIME(); \
20+
+ ret = FUNC; \
21+
+ tm3 = APMPI_WTIME(); \
22+
+ tdiff = tm3-tm2; \
23+
+ tsync = tm2-tm1; \
24+
+ }
25+
#else
26+
27+
#define TIME_SYNC(FUNC) \

0 commit comments

Comments
 (0)