Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
stupid me. col means row in french, so use line/row and not row/col, which means...
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 22 May 2006 09:02:31 +0000 (09:02 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Mon, 22 May 2006 09:02:31 +0000 (09:02 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2274 48e7efb5-ca39-0410-a469-dd3cf9ba447f

examples/gras/mmrpc/mmrpc.h
examples/gras/mmrpc/mmrpc_client.c
examples/gras/mmrpc/mmrpc_common.c
examples/gras/mmrpc/mmrpc_server.c

index 4e5e1e6..d33d1c8 100644 (file)
@@ -16,9 +16,9 @@
 
 GRAS_DEFINE_TYPE(s_matrix,
 struct s_matrix {
 
 GRAS_DEFINE_TYPE(s_matrix,
 struct s_matrix {
+  int lines;
   int rows;
   int rows;
-  int cols;
-  double *ctn GRAS_ANNOTE(size, rows*cols);
+  double *ctn GRAS_ANNOTE(size, lines*rows);
 };)
 typedef struct s_matrix matrix_t;
 
 };)
 typedef struct s_matrix matrix_t;
 
index edab230..2e45edb 100644 (file)
@@ -56,7 +56,7 @@ int client(int argc,char *argv[]) {
 
   /* 7. Prepare and send the request to the server */
 
 
   /* 7. Prepare and send the request to the server */
 
-  request[0].rows=request[0].cols=request[1].rows=request[1].cols=MATSIZE;
+  request[0].lines=request[0].rows=request[1].lines=request[1].rows=MATSIZE;
 
   request[0].ctn=xbt_malloc0(sizeof(double)*MATSIZE*MATSIZE);
   request[1].ctn=xbt_malloc0(sizeof(double)*MATSIZE*MATSIZE);
 
   request[0].ctn=xbt_malloc0(sizeof(double)*MATSIZE*MATSIZE);
   request[1].ctn=xbt_malloc0(sizeof(double)*MATSIZE*MATSIZE);
index ba4d0f5..27dc89e 100644 (file)
@@ -26,11 +26,11 @@ void mmrpc_register_messages(void) {
 void mat_dump(matrix_t *mat, const char* name) {
   int i,j;
 
 void mat_dump(matrix_t *mat, const char* name) {
   int i,j;
 
-  printf(">>> Matrix %s dump (%d x %d)\n",name,mat->rows,mat->cols);
-  for (i=0; i<mat->rows; i++) {
+  printf(">>> Matrix %s dump (%d x %d)\n",name,mat->lines,mat->rows);
+  for (i=0; i<mat->lines; i++) {
     printf("  ");
     printf("  ");
-    for (j=0; j<mat->cols; j++)
-      printf(" %.2f",mat->ctn[i*mat->cols + j]);
+    for (j=0; j<mat->rows; j++)
+      printf(" %.2f",mat->ctn[i*mat->rows + j]);
     printf("\n");
   }
   printf("<<< end_of_matrix %s dump\n",name);
     printf("\n");
   }
   printf("<<< end_of_matrix %s dump\n",name);
index 9d8bc21..8d94a0d 100644 (file)
@@ -22,15 +22,15 @@ static int server_cb_request_handler(gras_msg_cb_ctx_t ctx, void *payload_data)
   int i,j,k;
    
   /* 2. Make some room to return the result */
   int i,j,k;
    
   /* 2. Make some room to return the result */
-  result.rows = data[0].rows;
-  result.cols = data[1].cols;
-  result.ctn = xbt_malloc0(sizeof(double) * result.rows * result.cols);
+  result.lines = data[0].lines;
+  result.rows = data[1].rows;
+  result.ctn = xbt_malloc0(sizeof(double) * result.lines * result.rows);
 
   /* 3. Do the computation */
 
   /* 3. Do the computation */
-  for (i=0; i<result.rows; i++) 
-    for (j=0; j<result.cols; j++) 
-      for (k=0; k<data[1].rows; k++) 
-       result.ctn[i*result.cols + j] +=  data[0].ctn[i*result.cols +k] *data[1].ctn[k*result.cols +j];
+  for (i=0; i<result.lines; i++) 
+    for (j=0; j<result.rows; j++) 
+      for (k=0; k<data[1].lines; k++) 
+       result.ctn[i*result.rows + j] +=  data[0].ctn[i*result.rows +k] *data[1].ctn[k*result.rows +j];
 
   /* 4. Send it back as payload of a pong message to the expeditor */
   gras_msg_send(expeditor, gras_msgtype_by_name("answer"), &result);
 
   /* 4. Send it back as payload of a pong message to the expeditor */
   gras_msg_send(expeditor, gras_msgtype_by_name("answer"), &result);