Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Split into several files to explain how it can be done
[simgrid.git] / examples / gras / mmrpc / mmrpc_common.c
1 /* $Id$ */
2
3 /* GridRPC - Fake Grid RPC thingy doing matrix multiplications (as expected)*/
4
5 /* Copyright (c) 2005 Martin Quinson. All rights reserved.                  */
6
7 /* This program is free software; you can redistribute it and/or modify it
8  * under the terms of the license (GNU LGPL) which comes with this package. */
9
10 #include "mmrpc.h"
11
12 XBT_LOG_NEW_DEFAULT_CATEGORY(MatMult,"Messages specific to this example");
13
14 /* register messages which may be sent and their payload
15    (common to client and server) */
16 void mmrpc_register_messages(void) {
17   gras_datadesc_type_t matrix_type, request_type;
18
19   matrix_type=gras_datadesc_by_symbol(s_matrix);
20   request_type=gras_datadesc_array_fixed("matrix_t[2]",matrix_type,2);
21   
22   gras_msgtype_declare("answer", matrix_type);
23   gras_msgtype_declare("request", request_type);
24 }
25
26 void mat_dump(matrix_t *mat, const char* name) {
27   int i,j;
28
29   printf(">>> Matrix %s dump (%d x %d)\n",name,mat->rows,mat->cols);
30   for (i=0; i<mat->rows; i++) {
31     printf("  ");
32     for (j=0; j<mat->cols; j++)
33       printf(" %.2f",mat->ctn[i*mat->cols + j]);
34     printf("\n");
35   }
36   printf("<<< end_of_matrix %s dump\n",name);
37 }
38
39
40