[mpich-discuss] Debugging MPI Window
Jeff Hammond
jeff.science at gmail.com
Fri Apr 19 00:25:35 CDT 2019
MPI_Win_{get,set}_name might be an even simpler way to do that.
Jeff
On Thu, Apr 18, 2019 at 1:04 AM Joachim Protze via discuss <
discuss at mpich.org> wrote:
> Hi Bruce,
>
> I think, you could use the keyval and set/get-attr functions for that
> purpose and it should even be portable :)
> Without testing the code, I would so something like the following:
>
>
> #define S1(x) #x
> #define S2(x) S1(x)
> #define LOCATION __FILE__ " : " S2(__LINE__)
> int win_debug_string_key;
> const int max_win_debug_string_len = 30;
>
> int My_copy_attr_function(
> MPI_Win oldwin, int win_keyval,
> void *extra_state, void *attribute_val_in,
> void *attribute_val_out, int *flag)
> {
> attribute_val_out = strndup(attribute_val_in, *(int*)extra_state);
> flag = 1; /* or set 0 if a copy is intended to be different */
> }
>
> int My_delete_attr_function(
> MPI_Win win, int win_keyval,
> void *attribute_val, void *extra_state)
> {
> free(attribute_val);
> }
>
>
>
> /* Define the keyval once */
> MPI_Win_create_keyval( My_copy_attr_function, My_delete_attr_function,
> &win_debug_string_key, &max_win_debug_string_len );
>
>
> /* When creating a window */
> MPI_Win_create( ..., &win );
>
> /* be aware of the extra byte for the \0 byte */
> char * win_debug_string =
> malloc(sizeof(char)*(max_win_debug_string_len+1));
> /* Write the current location in there: */
> strncpy(win_debug_string, LOCATION);
> /* Bind the debug-string to the new window */
> MPI_Win_set_attr( win, win_debug_string_key, win_debug_string );
>
>
> Best
> Joachim
>
>
> On 4/18/19 12:32 AM, Palmer, Bruce J via discuss wrote:
> > Hi,
> >
> > Strictly for debugging purposes, is there a way in MPICH to determine if
> > a MPI_Win created at point A in a code is the same window being accessed
> > at point B? It doesn’t need to be portable, I’m just interested in using
> > it to fix some bugs (that are probably not associated with MPI).
> >
> > Bruce Palmer
> >
> > Computer Scientist
> >
> > Pacific Northwest National Laboratory
> >
> > (509) 375-3899
> >
> >
> > _______________________________________________
> > discuss mailing list discuss at mpich.org
> > To manage subscription options or unsubscribe:
> > https://lists.mpich.org/mailman/listinfo/discuss
> >
>
>
> --
> Dipl.-Inf. Joachim Protze
>
> IT Center
> Group: High Performance Computing
> Division: Computational Science and Engineering
> RWTH Aachen University
> Seffenter Weg 23
> D 52074 Aachen (Germany)
> Tel: +49 241 80- 24765
> Fax: +49 241 80-624765
> protze at itc.rwth-aachen.de
> www.itc.rwth-aachen.de
>
> _______________________________________________
> discuss mailing list discuss at mpich.org
> To manage subscription options or unsubscribe:
> https://lists.mpich.org/mailman/listinfo/discuss
>
--
Jeff Hammond
jeff.science at gmail.com
http://jeffhammond.github.io/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20190418/1fffb341/attachment.html>
More information about the discuss
mailing list