Commit 35ff2d80 authored by Darius Buntinas's avatar Darius Buntinas
Browse files

[svn-r500] Fixed alignment and 32/64-bit integer bugs in gm

parent bfcba603
......@@ -52,9 +52,9 @@ int MPID_nem_gm_module_do_get (void *target_p, void *source_p, int len, int node
/* gm module packet */
#define PKT_HEADER_LEN (sizeof(packet_t) - SENDPKT_DATALEN)
#define SENDPKT_DATALEN (64*1024)
typedef volatile struct packet
typedef struct packet
{
int source_id;
MPI_Aint source_id;
char buf[SENDPKT_DATALEN];
} packet_t;
......
......@@ -10,7 +10,7 @@
typedef struct recv_buffer
{
struct recv_buffer *next;
packet_t pkt;
volatile packet_t pkt;
} recv_buffer_t;
static recv_buffer_t *recv_buffers;
......@@ -94,7 +94,7 @@ inline int MPID_nem_gm_module_recv()
e = gm_receive (MPID_nem_module_gm_port);
while (gm_ntoh_u8 (e->recv.type) != GM_NO_RECV_EVENT)
{
packet_t *pkt;
volatile packet_t *pkt;
int msg_len;
switch (gm_ntoh_u8 (e->recv.type))
......@@ -112,21 +112,21 @@ inline int MPID_nem_gm_module_recv()
DO_PAPI (PAPI_accum_var (PAPI_EventSet, PAPI_vvalues5));
DO_PAPI (PAPI_reset (PAPI_EventSet));
pkt = (packet_t *)gm_ntohp(e->recv.message);
pkt = (volatile packet_t *)gm_ntohp(e->recv.message);
msg_len = gm_ntoh_u32(e->recv.length) - PKT_HEADER_LEN;
MPIDI_PG_Get_vc (MPIDI_Process.my_pg, pkt->source_id, &vc);
mpi_errno = MPID_nem_handle_pkt(vc, (char *)pkt->buf, msg_len);
if (mpi_errno) MPIU_ERR_POP(mpi_errno);
RECVBUF_S_PUSH(PKT_TO_RECVBUF((packet_t *)gm_ntohp(e->recv.buffer)));
RECVBUF_S_PUSH(PKT_TO_RECVBUF((volatile packet_t *)gm_ntohp(e->recv.buffer)));
++num_recv_tokens;
DO_PAPI (PAPI_accum_var (PAPI_EventSet, PAPI_vvalues7));
break;
case GM_PEER_RECV_EVENT:
case GM_RECV_EVENT:
pkt = (packet_t *)gm_ntohp(e->recv.buffer);
pkt = (volatile packet_t *)gm_ntohp(e->recv.buffer);
msg_len = gm_ntoh_u32(e->recv.length) - PKT_HEADER_LEN;
MPIDI_PG_Get_vc (MPIDI_Process.my_pg, pkt->source_id, &vc);
......
......@@ -12,11 +12,7 @@ typedef struct sendbuf
int node_id;
int port_id;
MPIDI_msg_sz_t datalen;
struct
{
int source_id;
char buf[SENDPKT_DATALEN];
} pkt;
packet_t pkt;
} sendbuf_t;
static struct {sendbuf_t *top;} sendbuf_stack;
......@@ -237,7 +233,7 @@ int MPID_nem_send_from_queue()
{
int mpi_errno = MPI_SUCCESS;
char *dataptr;
int datalen;
MPIDI_msg_sz_t datalen;
int complete;
while (active_send || !SEND_Q_EMPTY())
......@@ -349,7 +345,7 @@ int MPID_nem_gm_iStartContigMsg(MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hdr_sz
MPID_Request **sreq_ptr)
{
int mpi_errno = MPI_SUCCESS;
int dataleft = data_sz;
MPIDI_msg_sz_t dataleft = data_sz;
char *dataptr = (char *)data;
MPID_Request * sreq = NULL;
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_GM_ISTARTCONTIGMSG);
......@@ -428,7 +424,7 @@ int MPID_nem_gm_iSendContig(MPIDI_VC_t *vc, MPID_Request *sreq, void *hdr, MPIDI
void *data, MPIDI_msg_sz_t data_sz)
{
int mpi_errno = MPI_SUCCESS;
int dataleft = data_sz;
MPIDI_msg_sz_t dataleft = data_sz;
char *dataptr = (char *)data;
MPIDI_STATE_DECL(MPID_STATE_MPID_NEM_GM_ISENDCONTIGMSG);
......
......@@ -213,7 +213,7 @@ typedef struct MPIDI_Request {
unexpected eager messages and packing/unpacking
buffers. tmpuf_off is the current offset into the temporary buffer. */
void *tmpbuf;
int tmpbuf_off;
MPIDI_msg_sz_t tmpbuf_off;
MPIDI_msg_sz_t tmpbuf_sz;
MPIDI_msg_sz_t recv_data_sz;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment