[Pvfs2-cvs] commit by aching in pvfs2-1/test/io/bmi: pingpong.c test-bmi-client-eagerbug.c test-bmi-server-eagerbug.c bench-initialize.c bench-initialize.h driver-fs-read.c module.mk.in test-bmi-client.c test-bmi.h

CVS commit program cvs at parl.clemson.edu
Mon Jul 21 14:22:38 EDT 2008


Update of /projects/cvsroot/pvfs2-1/test/io/bmi
In directory parlweb1:/tmp/cvs-serv20547/test/io/bmi

Modified Files:
      Tag: locking-branch
	bench-initialize.c bench-initialize.h driver-fs-read.c 
	module.mk.in test-bmi-client.c test-bmi.h 
Added Files:
      Tag: locking-branch
	pingpong.c test-bmi-client-eagerbug.c 
	test-bmi-server-eagerbug.c 
Log Message:

Reverse merged and ported to HEAD.


--- /dev/null	2004-06-24 14:04:38.000000000 -0400
+++ pingpong.c	2008-07-21 14:22:38.000000000 -0400
@@ -0,0 +1,712 @@
+/*
+ * (C) 2001 Clemson University and The University of Chicago
+ *
+ * See COPYING in top-level directory.
+ */
+
+
+
+
+/*
+ * This is an example of a server program that uses the BMI 
+ * library for communications
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+#include <netinet/in.h>
+#include <sys/time.h>
+#include <time.h>
+#include <math.h>
+
+#include "bmi.h"
+#include "gossip.h"
+#include "test-bmi.h"
+#include <src/common/misc/pvfs2-internal.h>  /* lld(), llu() */
+
+/**************************************************************
+ * Data structures 
+ */
+
+#define SERVER          1
+#define CLIENT          2
+#define MIN_BYTES       1
+#define MAX_BYTES       (4<<20)
+
+#define RECV            0
+#define SEND            1
+
+#define EXPECTED        0
+#define UNEXPECTED      1
+
+#define ITERATIONS      10000
+
+struct msg {
+        int test;
+};
+
+/* A little structure to hold program options, either defaults or
+ * specified on the command line 
+ */
+struct options
+{
+        char *hostid;           /* host identifier */
+        char *method;
+        int  which;
+        int  test;
+};
+
+
+/**************************************************************
+ * Internal utility functions
+ */
+
+static struct options *parse_args(int argc, char *argv[]);
+static int do_server(struct options *opts, bmi_context_id *context);
+static int do_client(struct options *opts, bmi_context_id *context);
+
+static void print_usage(void)
+{
+        fprintf(stderr, "usage: pingpong -h HOST_URI -s|-c [-u]\n");
+        fprintf(stderr, "       where:\n");
+        fprintf(stderr, "       HOST_URI is tcp://host:port, mx://host:board:endpoint, etc\n");
+        fprintf(stderr, "       -s is server and -c is client\n");
+        fprintf(stderr, "       -u will use unexpected messages (pass to client only)\n");
+        return;
+}
+
+/**************************************************************/
+
+int main(int argc, char **argv)
+{
+        struct options                  *opts = NULL;
+        int                             ret = -1;
+        bmi_context_id                  context;
+
+        /* grab any command line options */
+        opts = parse_args(argc, argv);
+        if (!opts) {
+                print_usage();
+                return (-1);
+        }
+
+        /* set debugging stuff */
+        gossip_enable_stderr();
+        gossip_set_debug_mask(0, GOSSIP_BMI_DEBUG_ALL);
+
+        /* initialize local interface (default options) */
+        if (opts->which == SERVER)
+            ret = BMI_initialize(opts->method, opts->hostid, BMI_INIT_SERVER);
+        else
+            ret = BMI_initialize(opts->method, NULL, 0);
+
+        if (ret < 0) {
+                errno = -ret;
+                perror("BMI_initialize");
+                return (-1);
+        }
+
+        ret = BMI_open_context(&context);
+        if (ret < 0) {
+                errno = -ret;
+                perror("BMI_open_context()");
+                return (-1);
+        }
+
+        if (opts->which == SERVER) {
+                ret = do_server(opts, &context);
+        } else {
+                ret = do_client(opts, &context);
+        }
+
+        /* shutdown the local interface */
+        BMI_close_context(context);
+        ret = BMI_finalize();
+        if (ret < 0) {
+                errno = -ret;
+                perror("BMI_finalize");
+                return (-1);
+        }
+
+        /* turn off debugging stuff */
+        gossip_disable();
+
+        return (0);
+}
+
+static int bytes_to_iterations(int bytes)
+{
+        int     ret     = ITERATIONS;
+        if (bytes >= (128*1024)) ret = 5000;
+        if (bytes >= (256*1024)) ret = 2500;
+        if (bytes >= (1024*1024)) ret = 1000;
+        if (bytes >= (2*1024*1024)) ret = 500;
+        if (bytes >= (4*1024*1024)) ret = 250;
+        return ret;
+}
+
+static int do_server(struct options *opts, bmi_context_id *context)
+{
+        int                             ret = 0;
+        int                             i = 0;
+        PVFS_BMI_addr_t                 peer_addr;
+        PVFS_BMI_addr_t                 server_addr;
+        void                            *recv_buffer = NULL;
+        void                            *send_buffer = NULL;
+        bmi_op_id_t                     op_id[2];
+        bmi_error_code_t                error_code;
+        int                             outcount = 0;
+        struct BMI_unexpected_info      request_info;
+        bmi_size_t                      actual_size;
+        struct msg                      *tx_msg  = NULL;
+        struct msg                      *rx_msg  = NULL;
+        int                             bytes   = MIN_BYTES;
+        int                             max_bytes       = MAX_BYTES;
+        int                             warmup  = 1;
+        int                             iterations      = 0;
+        int                             msg_len         = 0;
+        int                             run     = 0;
+
+        /* wait for an initial request to get size */
+        do {
+                ret = BMI_testunexpected(1, &outcount, &request_info, 10);
+        } while (ret == 0 && outcount == 0);
+
+        if (ret < 0) {
+                fprintf(stderr, "Request recv failure (bad state).\n");
+                errno = -ret;
+                perror("BMI_testunexpected");
+                return ret;
+        }
+        if (request_info.error_code != 0) {
+                fprintf(stderr, "Request recv failure (bad state).\n");
+                return ret;
+        }
+        
+        if (request_info.size != sizeof(struct msg)) {
+                fprintf(stderr, "Bad Request! Received %d bytes\n", 
+                                (int) request_info.size);
+                return ret;
+        }
+
+        rx_msg = (struct msg *) request_info.buffer;
+        opts->test = ntohl(rx_msg->test);
+
+        printf("Starting %s test\n", opts->test == EXPECTED ? "expected" : "unexpected");
+
+        peer_addr = request_info.addr;
+
+        BMI_unexpected_free(peer_addr, request_info.buffer);
+
+        ret = BMI_get_info(server_addr, BMI_CHECK_MAXSIZE,
+                           (void *)&max_bytes);
+        if (ret < 0) {
+                fprintf(stderr, "BMI_get_info() returned %d\n", ret);
+                return ret;
+        }
+        if (max_bytes > MAX_BYTES) max_bytes = MAX_BYTES;
+
+        if (opts->test == UNEXPECTED) {
+                ret = BMI_addr_lookup(&server_addr, opts->hostid);
+                if (ret < 0) {
+                        errno = -ret;
+                        perror("BMI_addr_lookup");
+                        return (-1);
+                }
+                ret = BMI_get_info(server_addr, BMI_GET_UNEXP_SIZE,
+                                   (void *)&max_bytes);
+                if (ret < 0) {
+                        fprintf(stderr, "BMI_get_info() returned %d\n", ret);
+                        return ret;
+                }
+        } else {
+                int     maxsize = 0;
+                ret = BMI_get_info(server_addr, BMI_CHECK_MAXSIZE,
+                                (void *)&maxsize);
+                if (ret < 0) {
+                        fprintf(stderr, "BMI_get_info() returned %d\n", ret);
+                        return ret;
+                }
+                if (maxsize < max_bytes) max_bytes = maxsize;
+        }
+
+        msg_len = sizeof(struct msg);
+    
+        /* create an ack */
+        send_buffer = BMI_memalloc(peer_addr, max_bytes, BMI_SEND);
+        if (!send_buffer) {
+                fprintf(stderr, "BMI_memalloc failed.\n");
+                return (-1);
+        }
+        memset(send_buffer, 0, max_bytes);
+
+        tx_msg = (struct msg *) send_buffer;
+        tx_msg->test = htonl(opts->test);
+    
+        /* create a buffer to recv into */
+        recv_buffer = BMI_memalloc(peer_addr, max_bytes, BMI_RECV);
+        if (!recv_buffer) {
+                fprintf(stderr, "BMI_memalloc failed.\n");
+                return (-1);
+        }
+
+        /* post the ack */
+        ret = BMI_post_send(&(op_id[SEND]), peer_addr, tx_msg,
+                        msg_len, BMI_PRE_ALLOC, 0, NULL,
+                        *context);
+        if (ret < 0) {
+                fprintf(stderr, "BMI_post_send failure.\n");
+                return (-1);
+        } else if (ret == 0) {
+                do {
+                        ret = BMI_test(op_id[SEND], &outcount, &error_code,
+                                   &actual_size, NULL, 10, *context);
+                } while (ret == 0 && outcount == 0);
+        
+                if (ret < 0 || error_code != 0) {
+                        fprintf(stderr, "ack send failed.\n");
+                        return (-1);
+                }
+
+                if (actual_size != (bmi_size_t) msg_len) {
+                        fprintf(stderr, "Expected %d but received %llu\n",
+                                        msg_len, llu(actual_size));
+                }
+        }
+
+        /* start iterations */
+        while (bytes <= max_bytes) {
+                iterations = bytes_to_iterations(bytes);
+
+                for (i=0; i < iterations; i++) {
+                        /* receive the ping */
+                        if (opts->test == EXPECTED) {
+                                ret = BMI_post_recv(&(op_id[RECV]), peer_addr, recv_buffer,
+                                                bytes, &actual_size, BMI_PRE_ALLOC, i, NULL,
+                                                *context);
+                    
+                                if (ret < 0) {
+                                        fprintf(stderr, "BMI_post_recv_failure.\n");
+                                        return (-1);
+                                } else if (ret == 0) {
+                                        do {
+                                                ret = BMI_test(op_id[RECV], &outcount, &error_code,
+                                                        &actual_size, NULL, 10, *context);
+                                        } while (ret == 0 && outcount == 0);
+                
+                                        if (ret < 0 || error_code != 0) {
+                                                fprintf(stderr, "data recv failed.\n");
+                                                return (-1);
+                                        }
+                                        if (actual_size != bytes) {
+                                                fprintf(stderr, "Expected %d but received %llu\n",
+                                                                bytes, llu(actual_size));
+                                                return (-1);
+                                        }
+                                }
+                        } else { /* UNEXPECTED */
+                                do {
+                                        ret = BMI_testunexpected(1, &outcount, &request_info, 10);
+                                } while (ret == 0 && outcount == 0);
+                        
+                                if (ret < 0) {
+                                        fprintf(stderr, "Request recv failure (bad state).\n");
+                                        errno = -ret;
+                                        perror("BMI_testunexpected");
+                                        return ret;
+                                }
+                                if (request_info.error_code != 0) {
+                                        fprintf(stderr, "Request recv failure (bad state).\n");
+                                        return ret;
+                                }
+                                
+                                if (request_info.size != bytes) {
+                                        fprintf(stderr, "Bad Request! Received %d bytes\n", 
+                                                        (int) request_info.size);
+                                        return ret;
+                                }
+                        }
+                        /* send the pong */
+                        ret = BMI_post_send(&(op_id[SEND]), peer_addr, send_buffer,
+                                        bytes, BMI_PRE_ALLOC, i, NULL, *context);
+                        if (ret < 0) {
+                                fprintf(stderr, "BMI_post_send failure.\n");
+                                return (-1);
+                        } else if (ret == 0) {
+                                do {
+                                        ret = BMI_test(op_id[SEND], &outcount, &error_code,
+                                                &actual_size, NULL, 10, *context);
+                                } while (ret == 0 && outcount == 0);
+        
+                                if (ret < 0 || error_code != 0) {
+                                        fprintf(stderr, "ack send failed.\n");
+                                        return (-1);
+                                }
+                                if (actual_size != bytes) {
+                                        fprintf(stderr, "Expected %d but received %llu\n",
+                                                        bytes, llu(actual_size));
+                                        return (-1);
+                                }
+                        }
+                }
+                if (!warmup) {
+                        bytes *= 2;
+                        run++;
+                }
+                else warmup = 0;
+        }
+
+        /* free up the message buffers */
+        BMI_memfree(peer_addr, recv_buffer, max_bytes, BMI_RECV);
+        BMI_memfree(peer_addr, send_buffer, max_bytes, BMI_SEND);
+
+        return ret;
+}
+
+static int do_client(struct options *opts, bmi_context_id *context)
+{
+        int                     ret             = 0;
+        int                     i               = 0;
+        PVFS_BMI_addr_t         peer_addr;
+        void                    *recv_buffer    = NULL;
+        void                    *send_buffer    = NULL;
+        bmi_op_id_t             op_id[2];
+        bmi_error_code_t        error_code;
+        int                     outcount        = 0;
+        bmi_size_t              actual_size;
+        struct msg              *tx_msg         = NULL;
+        int                     bytes           = MIN_BYTES;
+        int                     max_bytes       = MAX_BYTES;
+        int                     warmup          = 1;
+        int                     iterations      = 0;
+        int                     msg_len         = 0;
+        int                     run             = 0;
+        struct timeval          start;
+        struct timeval          end;
+        double                  *val            = NULL;
+        double                  lat             = 0.0;
+        double                  min             = 99999.9;
+        double                  max             = 0.0;
+        double                  avg             = 0.0;
+
+        /* get a bmi_addr for the server */
+        ret = BMI_addr_lookup(&peer_addr, opts->hostid);
+        if (ret < 0) {
+                errno = -ret;
+                perror("BMI_addr_lookup");
+                return (-1);
+        }
+
+        if (opts->test == UNEXPECTED) {
+                ret = BMI_get_info(peer_addr, BMI_GET_UNEXP_SIZE,
+                                   (void *)&max_bytes);
+                if (ret < 0) {
+                        fprintf(stderr, "BMI_get_info() returned %d\n", ret);
+                        return ret;
+                }
+        } else {
+                int     maxsize = 0;
+                ret = BMI_get_info(peer_addr, BMI_CHECK_MAXSIZE,
+                                (void *)&maxsize);
+                if (ret < 0) {
+                        fprintf(stderr, "BMI_get_info() returned %d\n", ret);
+                        return ret;
+                }
+                if (maxsize < max_bytes) max_bytes = maxsize;
+        }
+
+        msg_len = sizeof(struct msg);
+
+        /* create send buffer */
+        send_buffer = BMI_memalloc(peer_addr, max_bytes, BMI_SEND);
+        if (!send_buffer) {
+                fprintf(stderr, "BMI_memalloc failed.\n");
+                return (-1);
+        }
+        memset(send_buffer, 0, max_bytes);
+
+        tx_msg = (struct msg *) send_buffer;
+        tx_msg->test = htonl(opts->test);
+    
+        /* create a buffer to recv into */
+        recv_buffer = BMI_memalloc(peer_addr, max_bytes, BMI_RECV);
+        if (!recv_buffer) {
+                fprintf(stderr, "BMI_memalloc failed.\n");
+                return (-1);
+        }
+
+        /* post the test parameters */
+        ret = BMI_post_sendunexpected(&(op_id[SEND]), peer_addr, tx_msg,
+                        msg_len, BMI_PRE_ALLOC, 0, NULL, *context);
+        if (ret < 0) {
+                fprintf(stderr, "BMI_post_sendunexpected failure.\n");
+                return (-1);
+        } else if (ret == 0) {
+                do {
+                        ret = BMI_test(op_id[SEND], &outcount, &error_code,
+                                &actual_size, NULL, 10, *context);
+                } while (ret == 0 && outcount == 0);
+                if (ret < 0 || error_code != 0) {
+                        fprintf(stderr, "data send failed.\n");
+                        return (-1);
+                }
+                if (actual_size != msg_len) {
+                        fprintf(stderr, "Expected %d but received %llu\n",
+                                        msg_len, llu(actual_size));
+                        return (-1);
+                }
+        }
+
+        /* post a recv for the ack */
+        ret = BMI_post_recv(&(op_id[RECV]), peer_addr, recv_buffer,
+                        msg_len, &actual_size, BMI_PRE_ALLOC, 0, NULL, *context);
+        if (ret < 0) {
+                fprintf(stderr, "BMI_post_recv_failure.\n");
+                return (-1);
+        } else if (ret == 0) {
+                do {
+                        ret = BMI_test(op_id[RECV], &outcount, &error_code,
+                                &actual_size, NULL, 10, *context);
+                } while (ret == 0 && outcount == 0);
+
+                if (ret < 0 || error_code != 0) {
+                        fprintf(stderr, "data recv failed.\n");
+                        return (-1);
+                }
+                if (actual_size != msg_len) {
+                        fprintf(stderr, "Expected %d but received %llu\n",
+                                        msg_len, llu(actual_size));
+                        return (-1);
+                }
+        }
+
+        val = calloc(ITERATIONS, sizeof(double));
+        if (val == NULL) {
+                fprintf(stderr, "calloc() for val failed\n");
+                return -1;
+        }
+
+        /* make sure server has posted first recv */
+        sleep(1);
+
+        fprintf(stdout, "     Bytes        usecs         MB/s       StdDev          Min          Max\n");
+
+        /* start iterations */
+        while (bytes <= max_bytes) {
+
+                iterations = bytes_to_iterations(bytes);
+
+                for (i=0; i < iterations; i++) {
+
+                        gettimeofday(&start, NULL);
+
+                        /* post the recv for the pong */
+                        ret = BMI_post_recv(&(op_id[RECV]), peer_addr, recv_buffer,
+                                        bytes, &actual_size, BMI_PRE_ALLOC, i,
+                                        NULL, *context);
+            
+                        if (ret < 0) {
+                                fprintf(stderr, "BMI_post_recv_failure.\n");
+                                return (-1);
+                        }
+        
+                        /* send the ping */
+                        if (opts->test == EXPECTED) {
+                                ret = BMI_post_send(&(op_id[SEND]), peer_addr, send_buffer,
+                                                bytes, BMI_PRE_ALLOC, i, NULL, *context);
+                        } else {
+                                ret = BMI_post_sendunexpected(&(op_id[SEND]), peer_addr, 
+                                                send_buffer, bytes, BMI_PRE_ALLOC, i, 
+                                                NULL, *context);
+                        }
+                        if (ret < 0) {
+                                fprintf(stderr, "BMI_post_sendunexpected failure.\n");
+                                return (-1);
+                        } else if (ret == 0) {
+                                do {
+                                        ret = BMI_test(op_id[SEND], &outcount, &error_code,
+                                                        &actual_size, NULL, 10, *context);
+                                } while (ret == 0 && outcount == 0);
+                        
+                                if (ret < 0 || error_code != 0) {
+                                        fprintf(stderr, "send ping failed.\n");
+                                        return (-1);
+                                }
+                                if (actual_size != bytes) {
+                                        fprintf(stderr, "Expected %d but received %llu\n",
+                                                        bytes, llu(actual_size));
+                                        return (-1);
+                                }
+                        }
+                        /* complete the receive for the pong */
+                        do {
+                                ret = BMI_test(op_id[RECV], &outcount, &error_code,
+                                                &actual_size, NULL, 10, *context);
+                        } while (ret == 0 && outcount == 0);
+        
+                        if (ret < 0 || error_code != 0) {
+                                fprintf(stderr, "data recv failed.\n");
+                                return (-1);
+                        }
+                        if (actual_size != bytes) {
+                                fprintf(stderr, "Expected %d but received %llu\n",
+                                                bytes, llu(actual_size));
+                                return (-1);
+                        }
+
+                        gettimeofday(&end, NULL);
+
+                        if (!warmup) {
+                                val[i] =  (double) end.tv_sec + 
+                                          (double) end.tv_usec * 0.000001;
+                                val[i] -= (double) start.tv_sec + 
+                                          (double) start.tv_usec * 0.000001;
+                                lat += val[i];
+                        }
+                }
+                if (!warmup) {
+                        double stdev    = 0.0;
+
+                        lat = lat / (double) iterations * 1000000.0 / 2.0;
+                        min = 999999.9;
+                        max = 0.0;
+                        avg = 0.0;
+
+                        /* convert seconds to MB/s */
+                        for (i=0; i < iterations; i++) {
+                                val[i] = (double) bytes * 2 / val[i] / 1000000.0;
+                                avg += val[i];
+                                if (val[i] < min) min = val[i];
+                                if (val[i] > max) max = val[i];
+                        }
+                        avg /= iterations;
+
+                        if (iterations > 1) {
+                                for (i=0; i < iterations; i++) {
+                                        double diff = val[i] - avg;
+                                        stdev += diff * diff;
+                                }
+                                stdev = sqrt(stdev / (iterations - 1));
+                        }
+
+                        fprintf(stdout, "%10d %12.3f %12.3f +- %9.3f %12.3f %12.3f\n", bytes, lat, avg, stdev, min, max);
+
+                        lat = 0.0;
+                        bytes *= 2;
+                        run++;
+                } else warmup = 0;
+        }
+
+        /* free up the message buffers */
+        BMI_memfree(peer_addr, recv_buffer, max_bytes, BMI_RECV);
+        BMI_memfree(peer_addr, send_buffer, max_bytes, BMI_SEND);
+
+        return ret;
+}
+
+static int check_uri(char *uri)
+{
+        int ret = 0; /* failure */
+        if (uri[0] == ':' && uri[1] == '/' && uri[2] == '/') ret = 1;
+        return ret;
+}
+
+
+static void get_method(struct options *opts)
+{
+        char *id = opts->hostid;
+
+        if (id[0] == 't' && id[1] == 'c' && id[2] == 'p' && check_uri(&id[3])) {
+                opts->method = strdup("bmi_tcp");
+        } else if (id[0] == 'g' && id[1] == 'm' && check_uri(&id[2])) {
+                opts->method = strdup("bmi_gm");
+        } else if (id[0] == 'm' && id[1] == 'x' && check_uri(&id[2])) {
+                opts->method = strdup("bmi_mx");
+        } else if (id[0] == 'i' && id[1] == 'b' && check_uri(&id[2])) {
+                opts->method = strdup("bmi_ib");
+        }
+        return;
+}
+
+static struct options *parse_args(int argc, char *argv[])
+{
+
+        /* getopt stuff */
+        extern char *optarg;
+        char flags[] = "h:scu";
+        int one_opt = 0;
+
+        struct options *opts = NULL;
+
+        /* create storage for the command line options */
+        opts = (struct options *) calloc(1, sizeof(struct options));
+        if (!opts) {
+            goto parse_args_error;
+        }
+    
+        /* look at command line arguments */
+        while ((one_opt = getopt(argc, argv, flags)) != EOF) {
+                switch (one_opt) {
+                case ('h'):
+                        opts->hostid = (char *) strdup(optarg);
+                        if (opts->hostid == NULL) {
+                	        goto parse_args_error;
+                        }
+                        get_method(opts);
+                        break;
+                case ('s'):
+                        if (opts->which == CLIENT) {
+                                fprintf(stderr, "use -s OR -c, not both\n");
+                	        goto parse_args_error;
+                        }
+                        opts->which = SERVER;
+                        break;
+                case ('c'):
+                        if (opts->which == SERVER) {
+                                fprintf(stderr, "use -s OR -c, not both\n");
+                	        goto parse_args_error;
+                        }
+                        opts->which = CLIENT;
+                        break;
+                case ('u'):
+                        opts->test = UNEXPECTED;
+                        break;
+                default:
+                        break;
+                }
+        }
+    
+        /* if we didn't get a host argument, bail: */
+        if (opts->hostid == NULL) {
+                fprintf(stderr, "you must specify -h\n");
+                goto parse_args_error;
+        }
+        if (opts->method == NULL) {
+                fprintf(stderr, "you must use a valid HOST_URI\n");
+                goto parse_args_error;
+        }
+        if (opts->which == 0) {
+                fprintf(stderr, "you must specify -s OR -c\n");
+                goto parse_args_error;
+        }
+
+        return (opts);
+
+parse_args_error:
+
+        /* if an error occurs, just free everything and return NULL */
+        if (opts) {
+                if (opts->hostid) {
+                        free(opts->hostid);
+                }
+                free(opts);
+        }
+        return (NULL);
+}
+
+/*
+ * vim:expandtab:shiftwidth=8:tabstop=8:
+ */

--- /dev/null	2004-06-24 14:04:38.000000000 -0400
+++ test-bmi-client-eagerbug.c	2008-07-21 14:22:39.000000000 -0400
@@ -0,0 +1,419 @@
+/*
+ * (C) 2001 Clemson University and The University of Chicago
+ *
+ * See COPYING in top-level directory.
+ */
+
+
+
+
+/*
+ * This is an example of a client program that uses the BMI library
+ * for communications.
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "bmi.h"
+#include "test-bmi.h"
+#include "gossip.h"
+
+/**************************************************************
+ * Data structures 
+ */
+
+/* A little structure to hold program options, either defaults or
+ * specified on the command line 
+ */
+struct options
+{
+    char *hostid;		/* host identifier */
+    int message_size;		/* message size */
+};
+
+
+/**************************************************************
+ * Internal utility functions
+ */
+
+static struct options *parse_args(
+    int argc,
+    char *argv[]);
+
+
+/**************************************************************/
+
+int main(
+    int argc,
+    char **argv)
+{
+
+    struct options *user_opts = NULL;
+    struct server_request *my_req = NULL;
+    struct server_ack *my_ack = NULL;
+    int ret = -1;
+    PVFS_BMI_addr_t server_addr;
+    void *send_buffer = NULL;
+    bmi_op_id_t client_ops[2];
+    int outcount = 0;
+    bmi_error_code_t error_code;
+    void *in_test_user_ptr = &server_addr;
+    void *out_test_user_ptr = NULL;
+    bmi_size_t actual_size;
+    bmi_context_id context;
+    char method[24], *cp;
+    int len;
+    char testeagerbuf1[] = "aaaccc";
+
+    /* grab any command line options */
+    user_opts = parse_args(argc, argv);
+    if (!user_opts)
+    {
+	return (-1);
+    }
+
+    /* set debugging stuff */
+    gossip_enable_stderr();
+    /* gossip_set_debug_mask(1, GOSSIP_BMI_DEBUG_ALL); */
+
+    /* convert address to bmi method type by prefixing bmi_ */
+    cp = strchr(user_opts->hostid, ':');
+    if (!cp)
+        return 1;
+    len = cp - user_opts->hostid;
+    strcpy(method, "bmi_");
+    strncpy(method + 4, user_opts->hostid, len);
+    method[4+len] = '\0';
+
+    /* initialize local interface */
+    ret = BMI_initialize(NULL, NULL, 0);
+    if (ret < 0)
+    {
+	errno = -ret;
+	perror("BMI_initialize");
+	return (-1);
+    }
+
+    ret = BMI_open_context(&context);
+    if (ret < 0)
+    {
+	errno = -ret;
+	perror("BMI_open_context()");
+	return (-1);
+    }
+
+    /* get a bmi_addr for the server */
+    ret = BMI_addr_lookup(&server_addr, user_opts->hostid);
+    if (ret < 0)
+    {
+	errno = -ret;
+	perror("BMI_addr_lookup");
+	return (-1);
+    }
+
+    /* allocate a buffer for the initial request and ack */
+    my_req = (struct server_request *) BMI_memalloc(server_addr,
+						    sizeof(struct
+							   server_request),
+						    BMI_SEND);
+    my_ack =
+	(struct server_ack *) BMI_memalloc(server_addr,
+					   sizeof(struct server_ack), BMI_RECV);
+    if (!my_req || !my_ack)
+    {
+	fprintf(stderr, "BMI_memalloc failed.\n");
+	return (-1);
+    }
+
+    my_req->size = user_opts->message_size;
+
+    /* send the initial request on its way */
+    ret = BMI_post_sendunexpected(&(client_ops[1]), server_addr, my_req,
+				  sizeof(struct server_request), BMI_PRE_ALLOC,
+				  0, in_test_user_ptr, context);
+    if (ret < 0)
+    {
+	errno = -ret;
+	perror("BMI_post_send");
+	return (-1);
+    }
+    if (ret == 0)
+    {
+	/* turning this into a blocking call for testing :) */
+	/* check for completion of request */
+	do
+	{
+	    ret = BMI_test(client_ops[1], &outcount, &error_code, &actual_size,
+			   &out_test_user_ptr, 10, context);
+	} while (ret == 0 && outcount == 0);
+
+	if (ret < 0 || error_code != 0)
+	{
+	    fprintf(stderr, "Request send failed.\n");
+	    if (ret < 0)
+	    {
+		errno = -ret;
+		perror("BMI_test");
+	    }
+	    return (-1);
+	}
+
+	out_test_user_ptr = NULL;
+    }
+
+    /* post a recv for the server acknowledgement */
+    ret = BMI_post_recv(&(client_ops[0]), server_addr, my_ack,
+			sizeof(struct server_ack), &actual_size, BMI_PRE_ALLOC,
+			0, in_test_user_ptr, context);
+    if (ret < 0)
+    {
+	errno = -ret;
+	perror("BMI_post_recv");
+	return (-1);
+    }
+    if (ret == 0)
+    {
+	/* turning this into a blocking call for testing :) */
+	/* check for completion of ack recv */
+	do
+	{
+	    ret = BMI_test(client_ops[0], &outcount, &error_code,
+			   &actual_size, &out_test_user_ptr, 10, context);
+	} while (ret == 0 && outcount == 0);
+
+	if (ret < 0 || error_code != 0)
+	{
+	    fprintf(stderr, "Ack recv failed.\n");
+	    return (-1);
+	}
+	out_test_user_ptr = NULL;
+    }
+    else
+    {
+	if (actual_size != sizeof(struct server_ack))
+	{
+	    printf("Short recv.\n");
+	    return (-1);
+	}
+    }
+
+    /* look at the ack */
+    if (my_ack->status != 0)
+    {
+	fprintf(stderr, "Request denied.\n");
+	return (-1);
+    }
+
+    /* create a buffer to send */
+    send_buffer = BMI_memalloc(server_addr, user_opts->message_size, BMI_SEND);
+    if (!send_buffer)
+    {
+	fprintf(stderr, "BMI_memalloc.\n");
+	return (-1);
+    }
+
+    /* send the data payload on its way */
+    /* NOTE: intentionally sending short message here, testing
+     * ability to match eager send with rend. receive
+     */
+    ret = BMI_post_send(&(client_ops[0]), server_addr, send_buffer,
+			15000, BMI_PRE_ALLOC, 0, in_test_user_ptr, context);
+    if (ret < 0)
+    {
+	errno = -ret;
+	perror("BMI_post_send");
+	return (-1);
+    }
+    if (ret == 0)
+    {
+	/* turning this into a blocking call for testing :) */
+	/* check for completion of data payload send */
+	do
+	{
+	    ret = BMI_test(client_ops[0], &outcount, &error_code,
+			   &actual_size, &out_test_user_ptr, 10, context);
+	} while (ret == 0 && outcount == 0);
+
+	if (ret < 0 || error_code != 0)
+	{
+	    fprintf(stderr, "Data payload send failed.\n");
+	    return (-1);
+	}
+	if (in_test_user_ptr != out_test_user_ptr)
+	{
+	    fprintf(stderr, "3rd ptr failure.\n");
+	}
+	else
+	{
+	    fprintf(stderr, "3rd ptr success.\n");
+	}
+	out_test_user_ptr = NULL;
+    }
+
+    /* final send to test eager bug *****************************/
+    ret = BMI_post_send(&(client_ops[0]), server_addr, testeagerbuf1,
+			6, BMI_EXT_ALLOC, 1, NULL, context);
+    if (ret < 0)
+    {
+	errno = -ret;
+	perror("BMI_post_send");
+	return (-1);
+    }
+    if (ret == 0)
+    {
+	/* turning this into a blocking call for testing :) */
+	/* check for completion of data payload send */
+	do
+	{
+	    ret = BMI_test(client_ops[0], &outcount, &error_code,
+			   &actual_size, NULL, 10, context);
+	} while (ret == 0 && outcount == 0);
+
+	if (ret < 0 || error_code != 0)
+	{
+	    fprintf(stderr, "Data payload send failed.\n");
+	    return (-1);
+	}
+    }
+
+    /* let the server get ahead of us */
+    sleep(10);
+
+    ret = BMI_post_send(&(client_ops[0]), server_addr, testeagerbuf1,
+			6, BMI_EXT_ALLOC, 1, NULL, context);
+    if (ret < 0)
+    {
+	errno = -ret;
+	perror("BMI_post_send");
+	return (-1);
+    }
+    if (ret == 0)
+    {
+	/* turning this into a blocking call for testing :) */
+	/* check for completion of data payload send */
+	do
+	{
+	    ret = BMI_test(client_ops[0], &outcount, &error_code,
+			   &actual_size, NULL, 10, context);
+	} while (ret == 0 && outcount == 0);
+
+	if (ret < 0 || error_code != 0)
+	{
+	    fprintf(stderr, "Data payload send failed.\n");
+	    return (-1);
+	}
+    }
+
+    /* free up the message buffers */
+    BMI_memfree(server_addr, send_buffer, user_opts->message_size, BMI_SEND);
+    BMI_memfree(server_addr, my_req, sizeof(struct server_request), BMI_SEND);
+    BMI_memfree(server_addr, my_ack, sizeof(struct server_ack), BMI_RECV);
+
+    /* try out rev lookup */
+    /* printf("rev_lookup() output: %s\n", BMI_addr_rev_lookup(server_addr)); */
+
+    /* shutdown the local interface */
+    BMI_close_context(context);
+    ret = BMI_finalize();
+    if (ret < 0)
+    {
+	errno = -ret;
+	perror("BMI_finalize");
+	return (-1);
+    }
+
+    /* turn off debugging stuff */
+    gossip_disable();
+
+    free(user_opts->hostid);
+    free(user_opts);
+
+    return (0);
+}
+
+
+static struct options *parse_args(
+    int argc,
+    char *argv[])
+{
+    const char flags[] = "h:s:";
+    int one_opt = 0;
+
+    struct options *tmp_opts = NULL;
+    int len = -1;
+    int ret = -1;
+
+    /* create storage for the command line options */
+    tmp_opts = malloc(sizeof(struct options));
+    if (!tmp_opts)
+    {
+	goto parse_args_error;
+    }
+
+    /* fill in defaults (except for hostid) */
+    tmp_opts->hostid = NULL;
+    tmp_opts->message_size = 32000;
+
+    /* look at command line arguments */
+    while ((one_opt = getopt(argc, argv, flags)) != EOF)
+    {
+	switch (one_opt)
+	{
+	case ('h'):
+	    len = (strlen(optarg)) + 1;
+	    if ((tmp_opts->hostid = malloc(len)) == NULL)
+	    {
+		goto parse_args_error;
+	    }
+	    memcpy(tmp_opts->hostid, optarg, len);
+	    break;
+	case ('s'):
+	    ret = sscanf(optarg, "%d", &tmp_opts->message_size);
+	    if (ret < 1)
+	    {
+		goto parse_args_error;
+	    }
+	    break;
+	default:
+	    break;
+	}
+    }
+
+    /* if we didn't get a host argument, fill in a default: */
+    if (tmp_opts->hostid == NULL) {
+        len = (strlen(DEFAULT_HOSTID)) + 1;
+        if ((tmp_opts->hostid = malloc(len)) == NULL)
+        {
+            goto parse_args_error;
+        }
+        memcpy(tmp_opts->hostid, DEFAULT_HOSTID, len);
+    }
+
+    return (tmp_opts);
+
+  parse_args_error:
+
+    /* if an error occurs, just free everything and return NULL */
+    if (tmp_opts)
+    {
+	if (tmp_opts->hostid)
+	{
+	    free(tmp_opts->hostid);
+	}
+	free(tmp_opts);
+    }
+    return (NULL);
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */

--- /dev/null	2004-06-24 14:04:38.000000000 -0400
+++ test-bmi-server-eagerbug.c	2008-07-21 14:22:39.000000000 -0400
@@ -0,0 +1,409 @@
+/*
+ * (C) 2001 Clemson University and The University of Chicago
+ *
+ * See COPYING in top-level directory.
+ */
+
+
+
+
+/*
+ * This is an example of a server program that uses the BMI 
+ * library for communications
+ */
+
+#include <stdio.h>
+#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "bmi.h"
+#include "gossip.h"
+#include "test-bmi.h"
+
+/**************************************************************
+ * Data structures 
+ */
+
+/* A little structure to hold program options, either defaults or
+ * specified on the command line 
+ */
+struct options
+{
+    char *hostid;		/* host identifier */
+};
+
+
+/**************************************************************
+ * Internal utility functions
+ */
+
+static struct options *parse_args(
+    int argc,
+    char *argv[]);
+
+
+/**************************************************************/
+
+int main(
+    int argc,
+    char **argv)
+{
+
+    struct options *user_opts = NULL;
+    struct server_request *my_req = NULL;
+    struct server_ack *my_ack = NULL;
+    int ret = -1;
+    PVFS_BMI_addr_t client_addr;
+    void *recv_buffer = NULL;
+    bmi_op_id_t server_ops[2];
+    bmi_op_id_t server_ops_list[2];
+    bmi_error_code_t error_code;
+    int outcount = 0;
+    struct BMI_unexpected_info request_info;
+    bmi_size_t actual_size;
+    bmi_context_id context;
+    char method[24], *cp;
+    int len;
+    char testeagerbuf1[] = "bbbbbbbbb";
+    bmi_size_t size_list1[2];
+    void *buffer_list1[2];
+    bmi_op_id_t out_id;
+
+    /* grab any command line options */
+    user_opts = parse_args(argc, argv);
+    if (!user_opts)
+    {
+	return (-1);
+    }
+
+    /* set debugging stuff */
+    gossip_enable_stderr();
+    /* gossip_set_debug_mask(1, GOSSIP_BMI_DEBUG_ALL); */
+
+    /* convert address to bmi method type by prefixing bmi_ */
+    cp = strchr(user_opts->hostid, ':');
+    if (!cp)
+        return 1;
+    len = cp - user_opts->hostid;
+    strcpy(method, "bmi_");
+    strncpy(method + 4, user_opts->hostid, len);
+    method[4+len] = '\0';
+
+    /* initialize local interface (default options) */
+    ret = BMI_initialize(method, user_opts->hostid, BMI_INIT_SERVER);
+    if (ret < 0)
+    {
+	errno = -ret;
+	perror("BMI_initialize");
+	return (-1);
+    }
+
+    ret = BMI_open_context(&context);
+    if (ret < 0)
+    {
+	errno = -ret;
+	perror("BMI_open_context()");
+	return (-1);
+    }
+
+    /* wait for an initial request  */
+    do
+    {
+	ret = BMI_testunexpected(1, &outcount, &request_info, 10);
+    } while (ret == 0 && outcount == 0);
+    if (ret < 0)
+    {
+	fprintf(stderr, "Request recv failure (bad state).\n");
+	errno = -ret;
+	perror("BMI_testunexpected");
+	return (-1);
+    }
+    if (request_info.error_code != 0)
+    {
+	fprintf(stderr, "Request recv failure (bad state).\n");
+	return (-1);
+    }
+
+    if (request_info.size != sizeof(struct server_request))
+    {
+	fprintf(stderr, "Bad Request!\n");
+	exit(-1);
+    }
+
+    my_req = (struct server_request *) request_info.buffer;
+    client_addr = request_info.addr;
+
+    /* create an ack */
+    my_ack = (struct server_ack *) BMI_memalloc(client_addr,
+						sizeof(struct server_ack),
+						BMI_SEND);
+    if (!my_ack)
+    {
+	fprintf(stderr, "BMI_memalloc failed.\n");
+	return (-1);
+    }
+    memset(my_ack, 0, sizeof(struct server_ack));
+
+    /* create a buffer to recv into */
+    recv_buffer = BMI_memalloc(client_addr, my_req->size, BMI_RECV);
+    if (!recv_buffer)
+    {
+	fprintf(stderr, "BMI_memalloc failed.\n");
+	return (-1);
+    }
+    /* post the ack */
+    ret = BMI_post_send(&(server_ops[1]), client_addr, my_ack,
+			sizeof(struct server_ack), BMI_PRE_ALLOC, 0, NULL,
+			context);
+    if (ret < 0)
+    {
+	fprintf(stderr, "BMI_post_send_failure.\n");
+	return (-1);
+    }
+    if (ret == 0)
+    {
+	/* turning this into a blocking call for testing :) */
+	/* check for completion of ack send */
+	do
+	{
+	    ret = BMI_test(server_ops[1], &outcount, &error_code,
+			   &actual_size, NULL, 10, context);
+	} while (ret == 0 && outcount == 0);
+
+	if (ret < 0 || error_code != 0)
+	{
+	    fprintf(stderr, "ack send failed.\n");
+	    return (-1);
+	}
+    }
+
+    /* post the recv */
+    ret = BMI_post_recv(&(server_ops[0]), client_addr, recv_buffer,
+			my_req->size, &actual_size, BMI_PRE_ALLOC, 0, NULL,
+			context);
+    if (ret < 0)
+    {
+	fprintf(stderr, "BMI_post_recv_failure.\n");
+	return (-1);
+    }
+    if (ret == 0)
+    {
+	/* turning this into a blocking call for testing :) */
+	/* check for completion of data payload recv */
+	do
+	{
+	    ret = BMI_test(server_ops[0], &outcount, &error_code,
+			   &actual_size, NULL, 10, context);
+	} while (ret == 0 && outcount == 0);
+
+	if (ret < 0 || error_code != 0)
+	{
+	    fprintf(stderr, "data recv failed.\n");
+	    return (-1);
+	}
+    }
+
+    if (actual_size != 15000)
+    {
+	printf("Didn't get short recv when expected.\n");
+	printf("actual_size: %d\n", (int) actual_size);
+	return (0);
+    }
+
+    /* sleep a bit to let client get ahead of us */
+    sleep(3);
+
+    /* poke at BMI to make it buffer the eager message */
+    ret = BMI_testcontext(1, &out_id, &outcount, &error_code,
+			   &actual_size, NULL, 10, context);
+    if(ret != 0 || outcount != 0)
+    {
+        fprintf(stderr, "Error: testcontext found something that it shouldn't have.\n");
+        return(-1);
+    }
+
+    size_list1[0] = 3;
+    size_list1[1] = 3;
+    buffer_list1[0] = &testeagerbuf1[0];
+    buffer_list1[1] = &testeagerbuf1[6];
+    
+    ret = BMI_post_recv_list(&(server_ops_list[0]), client_addr, buffer_list1,
+			size_list1, 2, 6, &actual_size, BMI_EXT_ALLOC, 1, NULL,
+			context);
+    if (ret < 0)
+    {
+	fprintf(stderr, "BMI_post_recv_failure.\n");
+	return (-1);
+    }
+    if (ret == 0)
+    {
+	/* turning this into a blocking call for testing :) */
+	/* check for completion of data payload recv */
+	do
+	{
+	    ret = BMI_test(server_ops_list[0], &outcount, &error_code,
+			   &actual_size, NULL, 10, context);
+	} while (ret == 0 && outcount == 0);
+
+	if (ret < 0 || error_code != 0)
+	{
+	    fprintf(stderr, "data recv failed.\n");
+	    return (-1);
+	}
+    }
+
+    printf("Recv 1 (recv posted after msg arrival)\n");
+    printf("   Expected: \"aaabbbccc\"\n");
+    printf("   Got: \"%s\"\n", testeagerbuf1);
+    if(strcmp(testeagerbuf1, "aaabbbccc") != 0)
+    {
+        fprintf(stderr, "   FAILURE!\n");
+    }
+    else
+    {
+        printf("   SUCCESS!\n");
+    }
+
+    sprintf(testeagerbuf1, "bbbbbbbbb");
+    size_list1[0] = 3;
+    size_list1[1] = 3;
+    buffer_list1[0] = &testeagerbuf1[0];
+    buffer_list1[1] = &testeagerbuf1[6];
+    
+    ret = BMI_post_recv_list(&(server_ops_list[0]), client_addr, buffer_list1,
+			size_list1, 2, 6, &actual_size, BMI_EXT_ALLOC, 1, NULL,
+			context);
+    if (ret < 0)
+    {
+	fprintf(stderr, "BMI_post_recv_failure.\n");
+	return (-1);
+    }
+    if (ret == 0)
+    {
+	/* turning this into a blocking call for testing :) */
+	/* check for completion of data payload recv */
+	do
+	{
+	    ret = BMI_test(server_ops_list[0], &outcount, &error_code,
+			   &actual_size, NULL, 10, context);
+	} while (ret == 0 && outcount == 0);
+
+	if (ret < 0 || error_code != 0)
+	{
+	    fprintf(stderr, "data recv failed.\n");
+	    return (-1);
+	}
+    }
+
+    printf("Recv 2 (recv posted before msg arrival)\n");
+    printf("   Expected: \"aaabbbccc\"\n");
+    printf("   Got: \"%s\"\n", testeagerbuf1);
+    if(strcmp(testeagerbuf1, "aaabbbccc") != 0)
+    {
+        fprintf(stderr, "   FAILURE!\n");
+    }
+    else
+    {
+        printf("   SUCCESS!\n");
+    }
+
+    /* free up the message buffers */
+    BMI_memfree(client_addr, recv_buffer, my_req->size, BMI_RECV);
+    BMI_memfree(client_addr, my_ack, sizeof(struct server_ack), BMI_SEND);
+    BMI_unexpected_free(client_addr, my_req);
+
+    /* try out rev lookup */
+    /* printf("rev_lookup() output: %s\n", BMI_addr_rev_lookup(client_addr)); */
+
+    /* shutdown the local interface */
+    BMI_close_context(context);
+    ret = BMI_finalize();
+    if (ret < 0)
+    {
+	errno = -ret;
+	perror("BMI_finalize");
+	return (-1);
+    }
+
+    /* turn off debugging stuff */
+    gossip_disable();
+
+    free(user_opts->hostid);
+    free(user_opts);
+
+    return (0);
+}
+
+
+static struct options *parse_args(
+    int argc,
+    char *argv[])
+{
+    const char flags[] = "h:";
+    int one_opt = 0;
+
+    struct options *tmp_opts = NULL;
+    int len = -1;
+
+    /* create storage for the command line options */
+    tmp_opts = malloc(sizeof(struct options));
+    if (!tmp_opts)
+    {
+	goto parse_args_error;
+    }
+    tmp_opts->hostid = NULL;
+
+    /* look at command line arguments */
+    while ((one_opt = getopt(argc, argv, flags)) != EOF)
+    {
+	switch (one_opt)
+	{
+	case ('h'):
+	    len = (strlen(optarg)) + 1;
+	    if ((tmp_opts->hostid = malloc(len)) == NULL)
+	    {
+		goto parse_args_error;
+	    }
+	    memcpy(tmp_opts->hostid, optarg, len);
+	    break;
+	default:
+	    break;
+	}
+    }
+
+    /* if we didn't get a host argument, fill in a default: */
+    if (tmp_opts->hostid == NULL) {
+        len = (strlen(DEFAULT_SERVERID)) + 1;
+        if ((tmp_opts->hostid = malloc(len)) == NULL)
+        {
+            goto parse_args_error;
+        }
+        memcpy(tmp_opts->hostid, DEFAULT_SERVERID, len);
+    }
+
+    return (tmp_opts);
+
+  parse_args_error:
+
+    /* if an error occurs, just free everything and return NULL */
+    if (tmp_opts)
+    {
+	if (tmp_opts->hostid)
+	{
+	    free(tmp_opts->hostid);
+	}
+	free(tmp_opts);
+    }
+    return (NULL);
+}
+
+/*
+ * Local variables:
+ *  c-indent-level: 4
+ *  c-basic-offset: 4
+ * End:
+ *
+ * vim: ts=8 sts=4 sw=4 expandtab
+ */

Index: bench-initialize.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/io/bmi/bench-initialize.c,v
diff -p -u -r1.11 -r1.11.22.1
--- bench-initialize.c	22 Aug 2006 15:41:15 -0000	1.11
+++ bench-initialize.c	21 Jul 2008 18:22:38 -0000	1.11.22.1
@@ -155,6 +155,10 @@ int bench_initialize_bmi_interface(
     {
 	sprintf(local_address, "gm://NULL:%d\n", BMI_GM_PORT);
     }
+    else if (strcmp(method, "bmi_mx") == 0)
+    {
+	sprintf(local_address, "mx://foo:0:%d\n", BMI_MX_ENDPOINT);
+    }
     else if (strcmp(method, "bmi_ib") == 0)
     {
 	sprintf(local_address, "ib://NULL:%d\n", BMI_IB_PORT);
@@ -319,6 +323,10 @@ int bench_initialize_bmi_addresses_clien
 	else if (strcmp(method_name, "bmi_gm") == 0)
 	{
 	    sprintf(bmi_server_name, "gm://%s:%d", server_name, BMI_GM_PORT);
+	}
+	else if (strcmp(method_name, "bmi_mx") == 0)
+	{
+	    sprintf(bmi_server_name, "mx://%s:0:%d", server_name, BMI_MX_ENDPOINT);
 	}
 	else if (strcmp(method_name, "bmi_ib") == 0)
 	{

Index: bench-initialize.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/io/bmi/bench-initialize.h,v
diff -p -u -r1.7 -r1.7.24.1
--- bench-initialize.h	25 Jun 2006 16:49:46 -0000	1.7
+++ bench-initialize.h	21 Jul 2008 18:22:38 -0000	1.7.24.1
@@ -17,6 +17,7 @@
 
 #define BMI_TCP_PORT 3334
 #define BMI_GM_PORT 5
+#define BMI_MX_ENDPOINT 3
 #define BMI_IB_PORT 3335
 
 int bench_initialize_bmi_interface(

Index: driver-fs-read.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/io/bmi/driver-fs-read.c,v
diff -p -u -r1.6 -r1.6.12.1
--- driver-fs-read.c	22 Aug 2006 15:41:15 -0000	1.6
+++ driver-fs-read.c	21 Jul 2008 18:22:38 -0000	1.6.12.1
@@ -482,7 +482,7 @@ int client_handle_next(struct svr_xfer_s
 
             for(i=0; i<state->list_factor; i++)
             {
-                state->buffer_list[i] = state->buffer_array[state->step-3] +
+                state->buffer_list[i] = (char *) state->buffer_array[state->step-3] +
                     ((MSG_SIZE/state->list_factor)*i);
             }
             ret = BMI_post_recv_list(&tmp_id, state->addr,

Index: module.mk.in
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/io/bmi/module.mk.in,v
diff -p -u -r1.12 -r1.12.50.1
--- module.mk.in	10 Jan 2005 14:48:35 -0000	1.12
+++ module.mk.in	21 Jul 2008 18:22:38 -0000	1.12.50.1
@@ -2,9 +2,15 @@ DIR := io/bmi
 
 TESTSRC += \
 	$(DIR)/test-bmi-client.c \
+	$(DIR)/test-bmi-client-eagerbug.c \
 	$(DIR)/test-bmi-client-list.c \
 	$(DIR)/test-bmi-server.c \
-	$(DIR)/test-bmi-server-list.c
+	$(DIR)/test-bmi-server-eagerbug.c \
+	$(DIR)/test-bmi-server-list.c \
+	$(DIR)/pingpong.c
+
+# need math lib for sqrt
+MODLDFLAGS_$(DIR)/pingpong.o := -lm
 
 ifdef BUILD_GM
 TESTSRC += \

Index: test-bmi-client.c
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/io/bmi/test-bmi-client.c,v
diff -p -u -r1.12 -r1.12.32.1
--- test-bmi-client.c	17 Jun 2006 17:23:20 -0000	1.12
+++ test-bmi-client.c	21 Jul 2008 18:22:38 -0000	1.12.32.1
@@ -89,7 +89,7 @@ int main(
     method[4+len] = '\0';
 
     /* initialize local interface */
-    ret = BMI_initialize(method, NULL, 0);
+    ret = BMI_initialize(NULL, NULL, 0);
     if (ret < 0)
     {
 	errno = -ret;

Index: test-bmi.h
===================================================================
RCS file: /projects/cvsroot/pvfs2-1/test/io/bmi/test-bmi.h,v
diff -p -u -r1.7 -r1.7.60.1
--- test-bmi.h	28 Jul 2004 14:33:02 -0000	1.7
+++ test-bmi.h	21 Jul 2008 18:22:38 -0000	1.7.60.1
@@ -18,8 +18,10 @@
 /* default hostid of server when none is given */
 #define DEFAULT_HOSTID  "tcp://localhost:3334"
 #define DEFAULT_HOSTID_GM  "gm://playtoy:5"
+#define DEFAULT_HOSTID_MX  "mx://foo:0:3/"
 #define DEFAULT_SERVERID  "tcp://NULL:3334"
 #define DEFAULT_SERVERID_GM  "gm://NULL:5"
+#define DEFAULT_SERVERID_MX  "mx://foo:0:3/"
 
 /* test server request format */
 struct server_request



More information about the Pvfs2-cvs mailing list