[mpich-discuss] Debugging MPI Window
Joachim Protze
protze at itc.rwth-aachen.de
Thu Apr 18 03:04:03 CDT 2019
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4915 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://lists.mpich.org/pipermail/discuss/attachments/20190418/bdfebc72/attachment.p7s>
More information about the discuss
mailing list