--- /dev/null
+############ PROJECT COMPILING AND ARCHIVING #########
+PROJECT_NAME=alltoall
+DISTDIR=gras-$(PROJECT_NAME)
+
+GRAS_ROOT?= $(shell echo "\"<<<< GRAS_ROOT undefined !!! >>>>\"")
+CFLAGS = -O3 -w -g
+INCLUDES = -I$(GRAS_ROOT)/include
+LIBS_SIM = -lm -L$(GRAS_ROOT)/lib/ -lsimgrid
+LIBS_RL = -lm -L$(GRAS_ROOT)/lib/ -lgras
+LIBS =
+
+C_FILES = _alltoall_simulator.c _alltoall_node.c alltoall.c
+OBJ_FILES =
+BIN_FILES = alltoall_simulator alltoall_node
+
+all: $(BIN_FILES)
+
+alltoall_simulator: _alltoall_simulator.o alltoall.o
+ $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS_SIM) $(LIBS) $(LDADD) -o $@
+alltoall_node : _alltoall_node.o alltoall.o
+ $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS_RL) $(LIBS) $(LDADD) -o $@
+
+%: %.o
+ $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) $^ $(LIBS) $(LDADD) -o $@
+
+%.o: %.c
+ $(CC) $(INCLUDES) $(DEFS) $(CFLAGS) -c -o $@ $<
+
+DIST_FILES= $(C_FILES) alltoall.Makefile.local alltoall.Makefile.remote
+distdir: $(DIST_FILES)
+ rm -rf $(DISTDIR)
+ mkdir -p $(DISTDIR)
+ cp $^ $(DISTDIR)
+
+dist: clean distdir
+ tar c $(DISTDIR) | gzip -c > $(DISTDIR).tar.gz
+
+clean:
+ rm -f $(BIN_FILES) $(OBJ_FILES) *~ alltoall.o _alltoall_simulator.o _alltoall_node.o
+ rm -rf $(DISTDIR)
+
+.SUFFIXES:
+.PHONY : clean
+
+############ REMOTE COMPILING #########
+MACHINES ?= Bourassa Fafard Ginette Jupiter Tremblay
+INSTALL_PATH ?='$$HOME/tmp/src' ### Has to be an absolute path !!!
+GRAS_ROOT ?='$(INSTALL_PATH)' ### Has to be an absolute path !!!
+SRCDIR ?= ./
+SIMGRID_URL ?=http://gcl.ucsd.edu/simgrid/dl/
+SIMGRID_VERSION ?=2.92
+GRAS_PROJECT ?= alltoall
+GRAS_PROJECT_URL ?= http://www-id.imag.fr/Laboratoire/Membres/Legrand_Arnaud/gras_test/
+
+remote:
+ @echo;echo "----[ Compile the package on remote hosts ]----"
+ @test -e $(SRCDIR)/buildlogs/ || mkdir -p $(SRCDIR)/buildlogs/
+ for site in $(MACHINES) ; do \
+ machine=`echo $$site |sed 's/^\([^%]*\)%.*$$/\1/'`;\
+ machine2=`echo $$site |sed 's/^\([^%]*\)%\(.*\)$$/\2/'`;\
+ cmd_mkdir="\"sh -c 'env INSTALL_PATH=$(INSTALL_PATH) GRAS_ROOT=$(GRAS_ROOT) \
+ SIMGRID_URL=$(SIMGRID_URL) SIMGRID_VERSION=$(SIMGRID_VERSION) GRAS_PROJECT=$(GRAS_PROJECT) \
+ GRAS_PROJECT_URL=$(GRAS_PROJECT_URL) mkdir -p $(INSTALL_PATH) 2>&1'\"";\
+ cmd_make="\"sh -c 'env INSTALL_PATH=$(INSTALL_PATH) GRAS_ROOT=$(GRAS_ROOT) \
+ SIMGRID_URL=$(SIMGRID_URL) SIMGRID_VERSION=$(SIMGRID_VERSION) GRAS_PROJECT=$(GRAS_PROJECT) \
+ GRAS_PROJECT_URL=$(GRAS_PROJECT_URL) make -C $(INSTALL_PATH) -f alltoall.Makefile.remote $(ACTION) 2>&1'\"";\
+ if echo $$site | grep '%' >/dev/null ; then \
+ echo "----[ Compile on $$machine2 (behind $$machine) ]----";\
+ else \
+ machine=$$site;\
+ echo "----[ Compile on $$machine ]----";\
+ fi;\
+ if echo $$site | grep '%' >/dev/null ; then \
+ if ssh $$machine "ssh -A $$machine2 $$cmd_mkdir" 2>&1 > $(SRCDIR)/buildlogs/$$site.log;\
+ then true; else failed=1;echo "Failed (check $(SRCDIR)/buildlogs/$$site.log)"; fi;\
+ else \
+ if ssh $$machine "eval $$cmd_mkdir" 2>&1 > $(SRCDIR)/buildlogs/$$site.log ;\
+ then true; else failed=1;echo "Failed (check $(SRCDIR)/buildlogs/$$site.log)"; fi; \
+ fi;\
+ echo "-- Copy the data over"; \
+ scp alltoall.Makefile.remote $$site:$(INSTALL_PATH) ;\
+ echo "-- Compiling... (the output gets into $(SRCDIR)/buildlogs/$$site.log)"; \
+ if echo $$site | grep '%' >/dev/null ; then \
+ if ssh $$machine "ssh -A $$machine2 $$cmd_make" 2>&1 >> $(SRCDIR)/buildlogs/$$site.log;\
+ then echo "Sucessful"; else failed=1;echo "Failed (check $(SRCDIR)/buildlogs/$$site.log)"; fi;echo; \
+ else \
+ if ssh $$machine "eval $$cmd_make" 2>&1 >> $(SRCDIR)/buildlogs/$$site.log ;\
+ then echo "Sucessful"; else failed=1;echo "Failed (check $(SRCDIR)/buildlogs/$$site.log)"; fi;echo; \
+ fi;\
+ done;
--- /dev/null
+INSTALL_PATH ?= $(shell pwd)
+
+compile-simgrid:
+ cd $$GRAS_ROOT ; \
+ retrieved=`LANG=C;wget -N $(SIMGRID_URL)/simgrid-$(SIMGRID_VERSION).tar.gz 2>&1 | grep newer | sed 's/.*no newer.*/yes/'`; \
+ echo $$retrieved; \
+ if test "x$$retrieved" = x; then \
+ tar zxf simgrid-$(SIMGRID_VERSION).tar.gz ; \
+ cd simgrid-$(SIMGRID_VERSION)/; \
+ ./configure --prefix=$$GRAS_ROOT ; \
+ make all install ;\
+ fi
+
+compile-gras: compile-simgrid
+ not_retrieved=`LANG=C;wget -N $(GRAS_PROJECT_URL)/gras-$(GRAS_PROJECT).tar.gz 2>&1 | grep newer | sed 's/.*no newer.*/yes/'`; \
+ echo $$not_retrieved; \
+ if test "x$$not_retrieved" != xyes; then \
+ tar zxf gras-$(GRAS_PROJECT).tar.gz ; \
+ make -C gras-$(GRAS_PROJECT)/ -f $(GRAS_PROJECT).Makefile.local all ; \
+ fi
+
+clean-simgrid:
+ rm -rf simgrid-$(SIMGRID_VERSION)*
+clean-gras clean-gras-$(GRAS_PROJECT):
+ rm -rf gras-$(GRAS_PROJECT)*
+clean: clean-simgrid clean-gras-$(GRAS_PROJECT)
+
+.PHONY: clean clean-simgrid clean-gras clean-gras-$(GRAS_PROJECT) \
+ compile-simgrid compile-gras
--- /dev/null
+/* $Id$ */
+
+/* ALLTOALL - alltoall of GRAS features */
+
+/* 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"
+#include "xbt/ex.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(alltoall,"Messages specific to this example");
+
+/* register data which may be sent (common to client and server) */
+static void register_messages(void) {
+ gras_msgtype_declare("data", gras_datadesc_by_name("int"));
+}
+
+/* Function prototypes */
+int node (int argc,char *argv[]);
+
+
+/* **********************************************************************
+ * node code
+ * **********************************************************************/
+
+/* Global private data */
+typedef struct {
+ gras_socket_t sock;
+ int done;
+} node_data_t;
+
+static void free_host(void *d){
+ xbt_host_t h=*(xbt_host_t*)d;
+ free(h->name);
+ free(h);
+}
+
+static void kill_buddy(char *name,int port){
+ gras_socket_t sock=gras_socket_client(name,port);
+ gras_msg_send(sock,gras_msgtype_by_name("kill"),NULL);
+ gras_socket_close(sock);
+}
+
+static void kill_buddy_dynar(void *b) {
+ xbt_host_t buddy=*(xbt_host_t*)b;
+ kill_buddy(buddy->name,buddy->port);
+}
+
+static int node_cb_data_handler(gras_msg_cb_ctx_t ctx,
+ void *payload_data) {
+
+ /* Get the payload into the msg variable */
+ int data=*(int*)payload_data;
+
+ gras_socket_t expeditor = gras_msg_cb_ctx_from(ctx);
+
+ /* Retrieve the server's state (globals) */
+
+ node_data_t *globals=(node_data_t*)gras_userdata_get();
+ globals->done = 0;
+
+ /* Log which client connected */
+ INFO3(">>>>>>>> Got Data(%d) from %s:%d <<<<<<<<",
+ data,
+ gras_socket_peer_name(expeditor), gras_socket_peer_port(expeditor));
+
+ /* Set the done boolean to true (and make sure the server stops after receiving it). */
+ globals->done = 1;
+
+ /* Make sure we don't leak sockets */
+ //gras_socket_close(expeditor);
+
+ /* Tell GRAS that we consummed this message */
+ return 1;
+} /* end_of_server_cb_ping_handler */
+
+int node (int argc,char *argv[]) {
+
+ xbt_ex_t e;
+
+ int port,nb_hosts,data,
+ i,done;
+
+ xbt_host_t h1;
+
+ gras_socket_t peer; /* socket to node */
+
+ node_data_t *globals;
+
+ /* xbt_dynar for hosts */
+ xbt_dynar_t hosts = xbt_dynar_new(sizeof(xbt_host_t),&free_host);
+
+ /* Init the GRAS infrastructure and declare my globals */
+ gras_init(&argc,argv);
+
+ globals=gras_userdata_new(node_data_t *);
+
+ /* Get the port I should listen on from the command line, if specified */
+ if (argc > 2) {
+ port=atoi(argv[1]);
+ }
+
+ /* Get the node location from argc/argv */
+ for (i=2; i<argc; i++){
+ xbt_host_t host=xbt_new(s_xbt_host_t,1);
+ host->name=strdup(argv[i]);
+ host->port=atoi(argv[1]);
+ INFO2("New node : %s:%d",host->name,host->port);
+ xbt_dynar_push(hosts,&host);
+ }
+ nb_hosts = xbt_dynar_length(hosts);
+
+ INFO1("Launch current node (port=%d)", port);
+
+ /* Create my master socket */
+ globals->sock = gras_socket_server(port);
+
+ /* Register the known messages */
+ register_messages();
+ register_messages();
+
+ /* 3. Wait for others nodesthe startup */
+ gras_os_sleep(1);
+
+
+ /* Register my callback */
+ gras_cb_register(gras_msgtype_by_name("data"),&node_cb_data_handler);
+
+ INFO1(">>>>>>>> Listening on port %d <<<<<<<<", gras_socket_my_port(globals->sock));
+ globals->done=0;
+
+ data =1000;
+ xbt_dynar_foreach(hosts,i,h1) {
+ peer = gras_socket_client(h1->name,h1->port);
+ done=0;
+ while (!done){
+ TRY {
+ gras_msg_handle(0);
+ }CATCH(e){
+ if (e.category != timeout_error)
+ RETHROW;
+ xbt_ex_free(e);
+ done = 1;
+ }
+ }
+
+ gras_msg_send(peer,gras_msgtype_by_name("data"),&data);
+ INFO3(">>>>>>>> Send Data (%d) from %s to %s <<<<<<<<",
+ data,argv[0],h1->name);
+ }
+
+ if (!globals->done)
+ WARN0("An error occured, the done was not set by the callback");
+
+ /* Free the allocated resources, and shut GRAS down */
+ gras_socket_close(globals->sock);
+ free(globals);
+ gras_exit();
+
+ //xbt_dynar_map(hosts,kill_buddy_dynar);
+ //xbt_dynar_free(&hosts);
+
+ INFO0("Done.");
+ return 0;
+} /* end_of_node */
\ No newline at end of file
--- /dev/null
+#!/bin/sh
+############ DEPLOYMENT FILE #########
+if test "${MACHINES+set}" != set; then
+ export MACHINES='Bourassa Fafard Ginette Jupiter Tremblay ';
+fi
+if test "${INSTALL_PATH+set}" != set; then
+ export INSTALL_PATH='`echo $HOME`/tmp/src'
+fi
+if test "${GRAS_ROOT+set}" != set; then
+ export GRAS_ROOT='`echo $INSTALL_PATH`'
+fi
+if test "${SRCDIR+set}" != set; then
+ export SRCDIR=./
+fi
+if test "${SIMGRID_URL+set}" != set; then
+ export SIMGRID_URL=http://gcl.ucsd.edu/simgrid/dl/
+fi
+if test "${SIMGRID_VERSION+set}" != set; then
+ export SIMGRID_VERSION=2.91
+fi
+if test "${GRAS_PROJECT+set}" != set; then
+ export GRAS_PROJECT=alltoall
+fi
+if test "${GRAS_PROJECT_URL+set}" != set; then
+ export GRAS_PROJECT_URL=http://www-id.imag.fr/Laboratoire/Membres/Legrand_Arnaud/gras_test/
+fi
+
+test -e runlogs/ || mkdir -p runlogs/
+cmd_prolog="env INSTALL_PATH=$INSTALL_PATH GRAS_ROOT=$GRAS_ROOT \
+ SIMGRID_URL=$SIMGRID_URL SIMGRID_VERSION=$SIMGRID_VERSION GRAS_PROJECT=$GRAS_PROJECT \
+ GRAS_PROJECT_URL=$GRAS_PROJECT_URL LD_LIBRARY_PATH=$GRAS_ROOT/lib/ sh -c ";
+cmd="\$INSTALL_PATH/gras-alltoall/alltoall_node 4000 Jupiter Fafard Ginette Bourassa ";
+ssh Tremblay "$cmd_prolog 'export LD_LIBRARY_PATH=\$INSTALL_PATH/lib:\$LD_LIBRARY_PATH; echo \"$cmd\" ; $cmd 2>&1'" > runlogs/Tremblay_0.log &
+cmd="\$INSTALL_PATH/gras-alltoall/alltoall_node 4000 Tremblay Fafard Ginette Bourassa ";
+ssh Jupiter "$cmd_prolog 'export LD_LIBRARY_PATH=\$INSTALL_PATH/lib:\$LD_LIBRARY_PATH; echo \"$cmd\" ; $cmd 2>&1'" > runlogs/Jupiter_1.log &
+cmd="\$INSTALL_PATH/gras-alltoall/alltoall_node 4000 Tremblay Jupiter Ginette Bourassa ";
+ssh Fafard "$cmd_prolog 'export LD_LIBRARY_PATH=\$INSTALL_PATH/lib:\$LD_LIBRARY_PATH; echo \"$cmd\" ; $cmd 2>&1'" > runlogs/Fafard_2.log &
+cmd="\$INSTALL_PATH/gras-alltoall/alltoall_node 4000 Tremblay Jupiter Fafard Bourassa ";
+ssh Ginette "$cmd_prolog 'export LD_LIBRARY_PATH=\$INSTALL_PATH/lib:\$LD_LIBRARY_PATH; echo \"$cmd\" ; $cmd 2>&1'" > runlogs/Ginette_3.log &
+cmd="\$INSTALL_PATH/gras-alltoall/alltoall_node 4000 Tremblay Jupiter Fafard Ginette ";
+ssh Bourassa "$cmd_prolog 'export LD_LIBRARY_PATH=\$INSTALL_PATH/lib:\$LD_LIBRARY_PATH; echo \"$cmd\" ; $cmd 2>&1'" > runlogs/Bourassa_4.log &
--- /dev/null
+<?xml version='1.0'?>
+<!DOCTYPE platform_description SYSTEM "surfxml.dtd">
+<platform_description>
+ <!-- ljlkj -->
+ <cpu name="Tremblay" power="98.094999999999999"/>
+ <cpu name="Jupiter" power="76.296000000000006"/>
+ <cpu name="Fafard" power="76.296000000000006"/>
+ <cpu name="Ginette" power="48.492"/>
+ <cpu name="Bourassa" power="48.492"/>
+ <network_link name="6" bandwidth="41.279125" latency="5.9904e-05"/>
+ <network_link name="11" bandwidth="0.25275" latency="0.00570455"/>
+ <network_link name="3" bandwidth="34.285625" latency="0.000514433"/>
+ <network_link name="7" bandwidth="11.618875" latency="0.00018998"/>
+ <network_link name="9" bandwidth="7.20975" latency="0.001461517"/>
+ <network_link name="12" bandwidth="1.792625" latency="0.007877863"/>
+ <network_link name="2" bandwidth="118.6825" latency="0.000136931"/>
+ <network_link name="8" bandwidth="8.158" latency="0.000270544"/>
+ <network_link name="1" bandwidth="34.285625" latency="0.000514433"/>
+ <network_link name="4" bandwidth="10.099625" latency="0.00047978"/>
+ <network_link name="0" bandwidth="41.279125" latency="5.9904e-05"/>
+ <network_link name="10" bandwidth="4.67975" latency="0.000848712"/>
+ <network_link name="5" bandwidth="27.94625" latency="0.000278066"/>
+ <network_link name="loopback_FATPIPE" bandwidth="10.00" latency="0.1" sharing_policy="FATPIPE"/>
+ <network_link name="loopback" bandwidth="498.00" latency="0.000015"/>
+ <route src="Tremblay" dst="Tremblay"><route_element name="loopback"/></route>
+ <route src="Jupiter" dst="Jupiter"><route_element name="loopback"/></route>
+ <route src="Fafard" dst="Fafard"><route_element name="loopback"/></route>
+ <route src="Ginette" dst="Ginette"><route_element name="loopback"/></route>
+ <route src="Bourassa" dst="Bourassa"><route_element name="loopback"/></route>
+ <route src="Tremblay" dst="Jupiter">
+ <route_element name="9"/>
+ </route>
+ <route src="Tremblay" dst="Fafard">
+ <route_element name="4"/><route_element name="3"/><route_element name="2"/><route_element name="0"/><route_element name="1"/><route_element name="8"/>
+ </route>
+ <route src="Tremblay" dst="Ginette">
+ <route_element name="4"/><route_element name="3"/><route_element name="5"/>
+ </route>
+ <route src="Tremblay" dst="Bourassa">
+ <route_element name="4"/><route_element name="3"/><route_element name="2"/><route_element name="0"/><route_element name="1"/><route_element name="6"/><route_element name="7"/>
+ </route>
+ <route src="Jupiter" dst="Tremblay">
+ <route_element name="9"/>
+ </route>
+ <route src="Jupiter" dst="Fafard">
+ <route_element name="9"/><route_element name="4"/><route_element name="3"/><route_element name="2"/><route_element name="0"/><route_element name="1"/><route_element name="8"/>
+ </route>
+ <route src="Jupiter" dst="Ginette">
+ <route_element name="9"/><route_element name="4"/><route_element name="3"/><route_element name="5"/>
+ </route>
+ <route src="Jupiter" dst="Bourassa">
+ <route_element name="9"/><route_element name="4"/><route_element name="3"/><route_element name="2"/><route_element name="0"/><route_element name="1"/><route_element name="6"/><route_element name="7"/>
+ </route>
+ <route src="Fafard" dst="Tremblay">
+ <route_element name="8"/><route_element name="1"/><route_element name="0"/><route_element name="2"/><route_element name="3"/><route_element name="4"/>
+ </route>
+ <route src="Fafard" dst="Jupiter">
+ <route_element name="8"/><route_element name="1"/><route_element name="0"/><route_element name="2"/><route_element name="3"/><route_element name="4"/><route_element name="9"/>
+ </route>
+ <route src="Fafard" dst="Ginette">
+ <route_element name="8"/><route_element name="1"/><route_element name="0"/><route_element name="2"/><route_element name="5"/>
+ </route>
+ <route src="Fafard" dst="Bourassa">
+ <route_element name="8"/><route_element name="6"/><route_element name="7"/>
+ </route>
+ <route src="Ginette" dst="Tremblay">
+ <route_element name="5"/><route_element name="3"/><route_element name="4"/>
+ </route>
+ <route src="Ginette" dst="Jupiter">
+ <route_element name="5"/><route_element name="3"/><route_element name="4"/><route_element name="9"/>
+ </route>
+ <route src="Ginette" dst="Fafard">
+ <route_element name="5"/><route_element name="2"/><route_element name="0"/><route_element name="1"/><route_element name="8"/>
+ </route>
+ <route src="Ginette" dst="Bourassa">
+ <route_element name="5"/><route_element name="2"/><route_element name="0"/><route_element name="1"/><route_element name="6"/><route_element name="7"/>
+ </route>
+ <route src="Bourassa" dst="Tremblay">
+ <route_element name="7"/><route_element name="6"/><route_element name="1"/><route_element name="0"/><route_element name="2"/><route_element name="3"/><route_element name="4"/>
+ </route>
+ <route src="Bourassa" dst="Jupiter">
+ <route_element name="7"/><route_element name="6"/><route_element name="1"/><route_element name="0"/><route_element name="2"/><route_element name="3"/><route_element name="4"/><route_element name="9"/>
+ </route>
+ <route src="Bourassa" dst="Fafard">
+ <route_element name="7"/><route_element name="6"/><route_element name="8"/>
+ </route>
+ <route src="Bourassa" dst="Ginette">
+ <route_element name="7"/><route_element name="6"/><route_element name="1"/><route_element name="0"/><route_element name="2"/><route_element name="5"/>
+ </route>
+</platform_description>
--- /dev/null
+#! /bin/sh -e
+if [ x = x ] ; then
+# exenv="libtool --mode=execute valgrind --show-reachable=yes --run-libc-freeres=no "
+ exenv=$SG_TEST_EXENV
+else
+ exenv=wine
+fi
+
+$exenv ./ping_server 4002 $@ &
+sleep 1
+$exenv ./ping_client 127.0.0.1 4002 $@
--- /dev/null
+#! @BASH@ -e
+if [ x@EXEEXT@ = x ] ; then
+# exenv="libtool --mode=execute valgrind --show-reachable=yes --run-libc-freeres=no "
+ exenv=$SG_TEST_EXENV
+else
+ exenv=wine
+fi
+
+$exenv ./ping_server@EXEEXT@ 4002 $@ &
+sleep 1
+$exenv ./ping_client@EXEEXT@ 127.0.0.1 4002 $@
--- /dev/null
+#! /bin/sh
+if [ x = x ] ; then
+ exenv=$SG_TEST_EXENV
+else
+ exenv=wine
+fi
+
+exec $exenv ./alltoall_simulator ./small_platform.xml ./alltoall_deployment.xml $@
+
--- /dev/null
+#! @BASH@
+if [ x@EXEEXT@ = x ] ; then
+ exenv=$SG_TEST_EXENV
+else
+ exenv=wine
+fi
+
+exec $exenv ./alltoall_simulator@EXEEXT@ @top_srcdir@/examples/msg/small_platform.xml @srcdir@/alltoall_deployment.xml $@
+