mpich ch_gm device and totalview
Douglas Johnson <[email protected]>
| Newsgroups | gmane.network.myrinet.general |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Attached is a patch to make the ch_gm device work properly with
the TotalView multi-process debugger. Beware, there seems to be a bug in
the gm driver that if you are stopped at a breakpoint in the debugger and
you exit the program, it will hang the computer. I'm told that there will
be a fix in a future version of gm.
diff -u -r clean/mpich-1.2..2/mpid/ch_gm/adi2init.c mpich-1.2..2/mpid/ch_gm/adi2init.c
--- clean/mpich-1.2..2/mpid/ch_gm/adi2init.c Wed Apr 19 03:10:54 2000
+++ mpich-1.2..2/mpid/ch_gm/adi2init.c Tue Aug 15 14:01:02 2000
@@ -12,6 +12,8 @@
#include "../util/cmnargs.h"
#include "../util/queue.h"
#include "reqalloc.h"
+#include "gmpi.h"
+#include <unistd.h>
/* Home for these globals */
int MPID_MyWorldSize, MPID_MyWorldRank;
@@ -55,8 +57,12 @@
void *config;
char ***argv;
{
- int i, np;
+ int i, ii, np, err, msgrp = 0, j, jj;
MPID_Device *dev;
+ int mypid;
+ struct MPIR_COMMUNICATOR *comm = 0;
+ struct gm_global *gm_intermediate, *g;
+ MPI_Status status;
#ifdef SMP_PLUG
/* here we bypass the default fake config function. Instead, we call
@@ -162,7 +168,52 @@
MPID_devset->req_pending = 0;
*error_code = MPI_SUCCESS;
+
+ /* Initialize the array on node with MPI process 0 that contains
+ pid information for all processes. The index of the array is the same
+ as the mpi rank of the process. We associate this with a node by
+ matching it to the values in gmpi.node_name[].
+ */
+
+ mypid = (int ) getpid();
+ printf ("PID is, %d, index is %d\n",mypid,MPID_MyWorldRank);
+ printf("Getting PIDs\n");
+
+ printf("host name is, %s\n", gmpi.node_names[MPID_MyWorldRank]);
+ if (MPID_MyWorldRank == 0){
+ gmpi.mpi_pid[MPID_MyWorldRank] = mypid;
+ for (ii=1; ii<np; ii++) {
+ printf("recv started\n");
+ MPID_RecvContig(comm, &j, sizeof(int), ii, 0, 0,
+ &status ,&err);
+ gmpi.mpi_pid[ii] = j;
+ printf("PID, %d\n", j);
+ }
+ }
+ else
+ {
+ MPID_SendContig(comm, &mypid, sizeof(int), MPID_MyWorldRank,
+ 0, 0, 0, msgrp, &err);
+ }
+}
+
+/* Created a routine for remote PID's for TotalView debugger */
+
+int MPID_getpid(int i, char **host, char **exename){
+ int pid;
+
+ if (i == 0)
+ pid = (int) getpid();
+ else
+ pid = gmpi.mpi_pid[i];
+
+ *host = gmpi.node_names[i];
+ printf ("PID, %d on node, %s, index %d\n", pid, host,i);
+ printf ("I'm pid %d\n", getpid());
+ return(pid);
+
}
+
/* Barry Smith suggests that this indicate who is aborting the program.
There should probably be a separate argument for whether it is a
diff -u -r clean/mpich-1.2..2/mpid/ch_gm/chconfig.h mpich-1.2..2/mpid/ch_gm/chconfig.h
--- clean/mpich-1.2..2/mpid/ch_gm/chconfig.h Wed Mar 8 19:49:24 2000
+++ mpich-1.2..2/mpid/ch_gm/chconfig.h Wed Aug 2 13:11:51 2000
@@ -15,7 +15,8 @@
#endif
-/* #define MPID_HAS_PROC_INFO */
+#define MPID_HAS_PROC_INFO
+
/* This is needed if you want TotalView to acquire all of the processes
* automagically.
* If it is defined you must also define
diff -u -r clean/mpich-1.2..2/mpid/ch_gm/gmpi.h mpich-1.2..2/mpid/ch_gm/gmpi.h
--- clean/mpich-1.2..2/mpid/ch_gm/gmpi.h Wed Apr 19 03:10:54 2000
+++ mpich-1.2..2/mpid/ch_gm/gmpi.h Wed Aug 2 13:11:51 2000
@@ -126,6 +126,7 @@
unsigned int node_ids[GMPI_MAX_NUMNODES];/* node ids */
char *node_names[GMPI_MAX_NUMNODES];/* names of machines */
+ unsigned int mpi_pid[GMPI_MAX_NUMNODES];/*PID of remote processes */
unsigned int port_ids[GMPI_MAX_NUMNODES];/* port ids */
unsigned int board_ids[GMPI_MAX_NUMNODES];/* board/unit number */
#ifdef GMPI_CREDITS
--
Doug Johnson
Systems Developer/Engineer
The Ohio Supercomputer Center
[email protected]