From: amad206 Date: Fri, 19 May 2006 20:23:00 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: v3.3~3101 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d27239d695b18203a5b53cae488067deb9446e26?ds=inline *** empty log message *** git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@2257 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/examples/gras/pmm/pmm.c b/examples/gras/pmm/pmm.c new file mode 100755 index 0000000000..379cbb5705 --- /dev/null +++ b/examples/gras/pmm/pmm.c @@ -0,0 +1,394 @@ +/* pmm - paralel matrix multiplication "double diffusion" */ + +/* Copyright (c) 2006- Ahmed Harbaoui. 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 MATRIX_SIZE 3 + +XBT_LOG_NEW_DEFAULT_CATEGORY(pmm,"Messages specific to this example"); + +GRAS_DEFINE_TYPE(s_matrix,struct s_matrix { + int rows; + int cols; + double *data GRAS_ANNOTE(size, rows*cols); +};) +typedef struct s_matrix matrix_t; + +/* struct for recovering results */ +GRAS_DEFINE_TYPE(s_result,struct s_result { + int i; + int j; + double value; +}); +typedef struct s_result result_t; + +/* struct to send initial data to sensor */ +GRAS_DEFINE_TYPE(s_init_data,struct s_init_data { + int myrow; + int mycol; + double a; + double b; +}); +typedef struct s_init_data init_data_t; + +/* register messages which may be sent (common to client and server) */ +static void register_messages(void) { + gras_datadesc_type_t result_type; + gras_datadesc_type_t init_data_type; + result_type=gras_datadesc_by_symbol(s_result); + init_data_type=gras_datadesc_by_symbol(s_init_data); + + gras_msgtype_declare("result", result_type); + gras_msgtype_declare("init_data", init_data_type); + + gras_msgtype_declare("ask_result", gras_datadesc_by_name("int")); + gras_msgtype_declare("step", gras_datadesc_by_name("int")); + gras_msgtype_declare("step_ack", gras_datadesc_by_name("int")); + gras_msgtype_declare("data", gras_datadesc_by_name("int")); +} + +/* Function prototypes */ +int maestro (int argc,char *argv[]); +int sensor (int argc,char *argv[]); + +/* ********************************************************************** + * Maestro code + * **********************************************************************/ + +/* Global private data */ +typedef struct { + int nbr_col,nbr_row; + int remaining_step; + int remaining_ack; +} maestro_data_t; + + +static int maestro_cb_data_handler(gras_msg_cb_ctx_t ctx, void *payload) { + + xbt_ex_t e; + /* 1. Get the payload into the msg variable */ + int msg=*(int*)payload_data; + + gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx); + + /*code of callback */ + + /* 8. Make sure we don't leak sockets */ + gras_socket_close(expeditor); + + /* 9. Tell GRAS that we consummed this message */ + return 1; +} /* end_of_maestro_cb_data_handler */ + +/*** Function initilaze matrixs ***/ + +static void initmatrix(matrix_t *X){ + int i; + for(i=0 ; i>>>>>>> Result: %d sent to %s:%d <<<<<<<<", + bC, + gras_socket_peer_name(from),gras_socket_peer_port(from)); + /* Free the allocated resources, and shut GRAS down */ + gras_socket_close(from); + gras_exit(); + INFO0("Done."); + return 0; +} /* end_of_sensor */ \ No newline at end of file diff --git a/examples/gras/pmm/pmm_deployment.xml b/examples/gras/pmm/pmm_deployment.xml new file mode 100644 index 0000000000..c5b1712ee6 --- /dev/null +++ b/examples/gras/pmm/pmm_deployment.xml @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/gras/pmm/pmm_plateform.xml b/examples/gras/pmm/pmm_plateform.xml new file mode 100644 index 0000000000..57e4219feb --- /dev/null +++ b/examples/gras/pmm/pmm_plateform.xml @@ -0,0 +1,327 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file