Description
Background information
What version of Open MPI are you using? (e.g., v3.0.5, v4.0.2, git branch name and hash, etc.)
v3.1.6 and v4.0.3
Describe how Open MPI was installed (e.g., from a source/distribution tarball, from a git clone, from an operating system distribution package, etc.)
from source tarball with PGI 19.5 and 20.1
Please describe the system on which you are running
- Operating system/version: RHEL7
- Computer hardware: x86_64
- Network type: self
Details of the problem
GDB unable to stop at MPIR_Breakpoint when debugging mpirun process with the MPIR interface with out-of-the-box OpenMPI installations. MPIR_Breakpoint is being optimized out.
#5501 relates to this issue and the reproducer can be re-used. This issue is not occurring with PGI 18.7.
However, providing CFLAGS=-O1
, FCFLAGS=-O1
and CXXFLAGS=-O1
when building OpenMPI allows GDB to stop at MPIR_Breakpoint.
It does not work if you use -O2
.
Upon looking at the building of orted/orted_submit.c
, it is being built with CFLAGS when it shouldn't be.
The compile and link lines being generated by automake in orte/Makefile
are:
liborted_mpir_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \
$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \
$(liborted_mpir_la_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
$(AM_V_CC_no)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(liborted_mpir_la_CFLAGS) $(CFLAGS) -c -o orted/liborted_mpir_la-orted_submit.lo \
`test -f 'orted/orted_submit.c' || echo '$(srcdir)/'`orted/orted_submit.c
In orte/orted/Makefile.am
, the CFLAGS are defined to remove the optimzations, but $(CFLAGS) is being added to the compile line, adding the optimzations anyway.
liborted_mpir_la_CFLAGS = $(CFLAGS_WITHOUT_OPTFLAGS) $(DEBUGGER_CFLAGS)
By manually removing CFLAGS from the compile and link line for orted_submit.c
, there would be no optimization when building orted/orted_submit.c
, as described in the comments.