X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/60894e585d7f494d9ad32afd452a57f8849ceff6..187ba0c05f9fbe51175179b9f637b6554f947468:/examples/gras/mmrpc/mmrpc.c?ds=sidebyside diff --git a/examples/gras/mmrpc/mmrpc.c b/examples/gras/mmrpc/mmrpc.c deleted file mode 100644 index b64153b01f..0000000000 --- a/examples/gras/mmrpc/mmrpc.c +++ /dev/null @@ -1,213 +0,0 @@ -/* $Id$ */ - -/* GridRPC - Fake Grid RPC thingy doing matrix multiplications (as expected)*/ - -/* Copyright (c) 2005 Martin Quinson. All rights reserved. */ - -/* This program is free software; you can redistribute it and/or modify it - * under the terms of the license (GNU LGPL) which comes with this package. */ - -#include "gras.h" - -#define MATSIZE 128 - -XBT_LOG_NEW_DEFAULT_CATEGORY(MatMult,"Messages specific to this example"); - -GRAS_DEFINE_TYPE(s_matrix, -struct s_matrix { - int rows; - int cols; - double *ctn GRAS_ANNOTE(size, rows*cols); -};); -typedef struct s_matrix matrix_t; - -static 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; irows; i++) { - printf(" "); - for (j=0; jcols; j++) - printf(" %.2f",mat->ctn[i*mat->cols + j]); - printf("\n"); - } - printf("<<< end of matrix %s dump\n",name); -} - -/* register messages which may be sent and their payload - (common to client and server) */ -static void register_messages(void) { - gras_datadesc_type_t matrix_type, request_type; - - matrix_type=gras_datadesc_by_symbol(s_matrix); - request_type=gras_datadesc_array_fixed("matrix_t[2]",matrix_type,2); - - gras_msgtype_declare("answer", matrix_type); - gras_msgtype_declare("request", request_type); -} - -/* Function prototypes */ -int server (int argc,char *argv[]); -int client (int argc,char *argv[]); - -/* ********************************************************************** - * Server code - * **********************************************************************/ - -static int server_cb_request_handler(gras_socket_t expeditor, void *payload_data) { - - /* 1. Get the payload into the data variable */ - matrix_t *data=(matrix_t*)payload_data; - matrix_t 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); - - /* 3. Do the computation */ - for (i=0; i>>>>>>> Connected to server which is on %s:%d <<<<<<<<", - gras_socket_peer_name(toserver),gras_socket_peer_port(toserver)); - - /* 7. Prepare and send the request to the server */ - - request[0].rows=request[0].cols=request[1].rows=request[1].cols=MATSIZE; - - request[0].ctn=xbt_malloc0(sizeof(double)*MATSIZE*MATSIZE); - request[1].ctn=xbt_malloc0(sizeof(double)*MATSIZE*MATSIZE); - - for (i=0; i>>>>>>> Request sent to %s:%d <<<<<<<<", - gras_socket_peer_name(toserver),gras_socket_peer_port(toserver)); - - /* 8. Wait for the answer from the server, and deal with issues */ - gras_msg_wait(6000,gras_msgtype_by_name("answer"),&from,&answer); - - // mat_dump(&answer,"C:answer"); - for (i=0; i>>>>>>> Got answer from %s:%d <<<<<<<<", - gras_socket_peer_name(from),gras_socket_peer_port(from)); - - /* 10. Free the allocated resources, and shut GRAS down */ - gras_socket_close(toserver); - gras_exit(); - INFO0("Done."); - return 0; -} /* end_of_client */