[mpich-discuss] Displaying source after attaching to an MPI job

Peter Thompson peter.thompson at roguewave.com
Mon Sep 28 12:54:08 CDT 2015


Understood.   People have been using it like this for a while, and it's not 
earth shattering,  so no need to rush it in.   It just seems like a nice thing 
to have for debugger users, and it shouldn't have any harmful side effects that 
I can think of.

Cheers,
PeterT

On 09/28/2015 09:52 AM, Rob Latham wrote:
>
>
> On 09/22/2015 03:38 PM, Peter Thompson wrote:
>> This question came to me in my support role for TotalVIew.   When you
>> are debugging an MPI job, and attach after the job goes parallel, why
>> don't you see the source for the main program? Instead you are usually
>> located in the assembler code someplace, in some library above
>> MPI_Init,  and you have to go down the stack frame to see the source for
>> your program.
>
> We're trying our hardest to get a release out the door, so since this doesn't 
> quite rise to the level of freeze-breaking worthy, I've stashed this in a 
> ticket to help us not forget about it:
>
> http://trac.mpich.org/projects/mpich/ticket/2305
>
> ==rob
>
>>
>> There is a solution though.   Way back when, when the MPIR_proctable
>> interface was designed to help the debugger acquire processes
>> automatically, there was a global variable defined MPIR_force_to_main.
>> If this is defined in debugger.c as a global variable, then indeed, when
>> you start up TotalView.   Here's a diff of the change:
>>
>> *** debugger.c~ 2015-07-22 17:59:51.000000000 -0400
>> --- debugger.c  2015-09-22 16:18:21.000000000 -0400
>> ***************
>> *** 11,17 ****
>>    int MPIR_proctable_size = 0;
>>    int MPIR_i_am_starter = 0;
>>    int MPIR_partial_attach_ok = 0;
>> !
>>    volatile int MPIR_debug_state = 0;
>>    char *MPIR_debug_abort_string = 0;
>>
>> --- 11,17 ----
>>    int MPIR_proctable_size = 0;
>>    int MPIR_i_am_starter = 0;
>>    int MPIR_partial_attach_ok = 0;
>> ! int MPIR_force_to_main = 0;
>>    volatile int MPIR_debug_state = 0;
>>    char *MPIR_debug_abort_string = 0;
>>
>>
>> The MPI being discussed was Intel MPI, but I've always understood that
>> to be based on MPICH, and I thought this would be a good place to
>> start.   I had the same discussion in the Open MPI group a few years
>> ago, and they had dropped the variable at one point since it did not
>> appear to be used in any way.   The code certainly doesn't make use of
>> it, but when the debugger starts looking for it, that's when the magic
>> happens.  ;-)  I tried just defining the variable in debugger.h, but I
>> think it got optimized away since I just set up
>>
>> extern int MPIR_force_to_main;
>>
>> and didn't assign a value at that point.
>>
>> Cheers,
>> PeterT
>>
>

-- 
Peter Thompson | Principal Technical Support Engineer |
Rogue Wave Software, Inc.
Accelerating Great Code


| P 508-652-7734 | F 508-652-7701 |
www.roguewave.com / peter.thompson at roguewave.com


_______________________________________________
discuss mailing list     discuss at mpich.org
To manage subscription options or unsubscribe:
https://lists.mpich.org/mailman/listinfo/discuss


More information about the discuss mailing list