[ofw] [patch] [TOOLS] performance tests interoperabilty with Linux

Leonid Keller leonid at mellanox.co.il
Mon Oct 27 02:33:44 PDT 2008


We came accross the fact, that Windows performance tests (ib_send_bw,
ib_read_lat et al) do not work with the same tests in Linux.
The main problem was, that Linux stores values like qpn, psn, lid in
little endian format, while Windows - in big endian one.
The included patch solves the problem.
 
 
Index: tools/perftests/user/perf_defs.h
===================================================================
--- tools/perftests/user/perf_defs.h (revision 1697)
+++ tools/perftests/user/perf_defs.h (working copy)
@@ -54,7 +54,7 @@
 #include <iba/ib_al.h>
 
 #define KEY_MSG_SIZE (sizeof
"0000:000000:000000:00000000:0000000000000000")
-#define KEY_PRINT_FMT "%04x:%06x:%06x:%08x:%x"
+#define KEY_PRINT_FMT "%04x:%06x:%06x:%08x:%016I64x"
 #define KEY_SCAN_FMT "%x:%x:%x:%x:%x"
 
 #define VERSION 2.0
Index: tools/perftests/user/perf_utils.c
===================================================================
--- tools/perftests/user/perf_utils.c (revision 1697)
+++ tools/perftests/user/perf_utils.c (working copy)
@@ -76,8 +76,8 @@
 {
  char msg[KEY_MSG_SIZE];
  PERF_ENTER;
- sprintf(msg, KEY_PRINT_FMT,my_dest->lid, my_dest->qpn,
-  my_dest->psn, my_dest->rkey, my_dest->vaddr);
+ sprintf(msg, KEY_PRINT_FMT,cl_hton16(my_dest->lid),
cl_hton32(my_dest->qpn), 
+  cl_hton32(my_dest->psn), cl_hton32(my_dest->rkey), my_dest->vaddr);
 
  if (send(sockfd, msg, sizeof msg,0) != sizeof msg) {
   perror("pp_write_keys");
@@ -101,8 +101,12 @@
   return -1;
  }
  
- parsed = sscanf(msg, KEY_SCAN_FMT, &rem_dest->lid, &rem_dest->qpn,
+ parsed = sscanf(msg, KEY_PRINT_FMT, &rem_dest->lid, &rem_dest->qpn,
    &rem_dest->psn,&rem_dest->rkey, &rem_dest->vaddr);
+ rem_dest->lid = cl_ntoh16(rem_dest->lid);
+ rem_dest->qpn = cl_ntoh32(rem_dest->qpn);
+ rem_dest->psn = cl_ntoh32(rem_dest->psn);
+ rem_dest->rkey = cl_ntoh32(rem_dest->rkey);
 
  if (parsed != 5) {
   fprintf(stderr, "Couldn't parse line <%.*s > parsed = %d %s\n",
Index: tools/perftests/user/read_bw/read_bw.c
===================================================================
--- tools/perftests/user/read_bw/read_bw.c (revision 1697)
+++ tools/perftests/user/read_bw/read_bw.c (working copy)
@@ -399,7 +399,7 @@
   * We do it by exchanging data over a TCP socket connection. */
   
   my_dest[i].lid = ctx->ca_attr->p_port_attr[ib_port-1].lid;
-  my_dest[i].psn = rand() & 0xffffff;
+  my_dest[i].psn = cl_hton32(rand() & 0xffffff);
   if (!my_dest[i].lid) {
    fprintf(stderr, "Local lid 0x0 detected. Is an SM running?\n");
    return 1;
Index: tools/perftests/user/read_lat/read_lat.c
===================================================================
--- tools/perftests/user/read_lat/read_lat.c (revision 1697)
+++ tools/perftests/user/read_lat/read_lat.c (working copy)
@@ -410,7 +410,7 @@
   * We do it by exchanging data over a TCP socket connection. */
   
   my_dest[i].lid = ctx->ca_attr->p_port_attr[ib_port-1].lid;
-  my_dest[i].psn = rand() & 0xffffff;
+  my_dest[i].psn = cl_hton32(rand() & 0xffffff);
   if (!my_dest[i].lid) {
    fprintf(stderr, "Local lid 0x0 detected. Is an SM running?\n");
    return 1;
Index: tools/perftests/user/send_bw/send_bw.c
===================================================================
--- tools/perftests/user/send_bw/send_bw.c (revision 1697)
+++ tools/perftests/user/send_bw/send_bw.c (working copy)
@@ -502,7 +502,7 @@
   * We do it by exchanging data over a TCP socket connection. */
   
   my_dest[i].lid = ctx->ca_attr->p_port_attr[ib_port-1].lid;
-  my_dest[i].psn = rand() & 0xffffff;
+  my_dest[i].psn = cl_hton32(rand() & 0xffffff);
   if (!my_dest[i].lid) {
    fprintf(stderr, "Local lid 0x0 detected. Is an SM running?\n");
    return 1;
@@ -606,16 +606,16 @@
  /*********************************************
   * Important note :
   * In case of UD/UC this is NOT the way to measure
-  * BW sicen we are running with loop on the send side
-  * while we should run on the recieve side or enable retry in SW
+  * BW since we are running with loop on the send side
+  * while we should run on the receive side or enable retry in SW
   * Since the sender may be faster than the reciver than although
   * we had posted recieve it is not enough and might end this will
   * result in deadlock of test since both sides are stuck on poll cq
   * In this test i do not solve this for the general test ,need to
write
-  * seperate test for UC/UD but in case the tx_depth is ~1/3 from the
+  * separate test for UC/UD but in case the tx_depth is ~1/3 from the
   * number of iterations this should be ok .
   * Also note that the sender is limited in the number of send, ans
-  * i try to make the reciver full 
+  * i try to make the receiver full 
   *********************************************/
  /* send */
  if (user_param->connection_type==UD) {
Index: tools/perftests/user/send_lat/send_lat.c
===================================================================
--- tools/perftests/user/send_lat/send_lat.c (revision 1697)
+++ tools/perftests/user/send_lat/send_lat.c (working copy)
@@ -488,7 +488,7 @@
   * We do it by exchanging data over a TCP socket connection. */
   
   my_dest[i].lid = ctx->ca_attr->p_port_attr[ib_port-1].lid;
-  my_dest[i].psn = rand() & 0xffffff;
+  my_dest[i].psn = cl_hton32(rand() & 0xffffff);
   if (!my_dest[i].lid) {
    fprintf(stderr, "Local lid 0x0 detected. Is an SM running?\n");
    return 1;
Index: tools/perftests/user/write_bw/write_bw.c
===================================================================
--- tools/perftests/user/write_bw/write_bw.c (revision 1697)
+++ tools/perftests/user/write_bw/write_bw.c (working copy)
@@ -429,7 +429,7 @@
   * We do it by exchanging data over a TCP socket connection. */
   
   my_dest[i].lid = ctx->ca_attr->p_port_attr[ib_port-1].lid;
-  my_dest[i].psn = rand() & 0xffffff;
+  my_dest[i].psn = cl_hton32(rand() & 0xffffff);
   if (!my_dest[i].lid) {
    fprintf(stderr, "Local lid 0x0 detected. Is an SM running?\n");
    return 1;
Index: tools/perftests/user/write_lat/write_lat.c
===================================================================
--- tools/perftests/user/write_lat/write_lat.c (revision 1697)
+++ tools/perftests/user/write_lat/write_lat.c (working copy)
@@ -419,7 +419,7 @@
   * We do it by exchanging data over a TCP socket connection. */
   
   my_dest[i].lid = ctx->ca_attr->p_port_attr[ib_port-1].lid;
-  my_dest[i].psn = rand() & 0xffffff;
+  my_dest[i].psn = cl_hton32(rand() & 0xffffff);
   if (!my_dest[i].lid) {
    fprintf(stderr, "Local lid 0x0 detected. Is an SM running?\n");
    return 1;

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20081027/78596147/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: perf_tests.patch
Type: application/octet-stream
Size: 6281 bytes
Desc: perf_tests.patch
URL: <http://lists.openfabrics.org/pipermail/ofw/attachments/20081027/78596147/attachment.obj>


More information about the ofw mailing list