From 4013e1acba325a4f7ef4192c13ec39f64b4d098a Mon Sep 17 00:00:00 2001 From: bustico Date: Fri, 8 Feb 2008 09:33:07 +0000 Subject: fix makefile for non omp target --- src/Makefile | 14 ++++++++++---- src/ivy.c | 5 ++++- src/ivysocket.c | 20 ++++++++++++++++++-- src/ivythroughput.cpp | 2 +- 4 files changed, 33 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/Makefile b/src/Makefile index b56c92e..6bdde25 100644 --- a/src/Makefile +++ b/src/Makefile @@ -264,7 +264,6 @@ installlibs: static-libs shared-libs -test -d $(DESTDIR)$(X11_PREFIX)$(LIB) || mkdirhier $(DESTDIR)$(X11_PREFIX)$(LIB) install -m644 libivy.a $(DESTDIR)$(PREFIX)$(LIB) - install -m644 libivy_omp.a $(DESTDIR)$(PREFIX)$(LIB) install -m644 libgivy.a $(DESTDIR)$(PREFIX)$(LIB) -install -m644 libxtivy.a $(DESTDIR)$(X11_PREFIX)$(LIB) install -m644 libtclivy.a $(DESTDIR)$(PREFIX)$(LIB) @@ -275,6 +274,12 @@ installlibs: static-libs shared-libs -install -m644 libxtivy.so.$(MAJOR).$(MINOR) $(DESTDIR)$(X11_PREFIX)$(LIB) install -m644 libtclivy.so.$(MAJOR).$(MINOR) $(DESTDIR)$(PREFIX)$(LIB) install -m644 libglibivy.so.$(MAJOR).$(MINOR) $(DESTDIR)$(PREFIX)$(LIB) + +installlibs_omp: static-libs shared-libs + test -d $(DESTDIR)$(PREFIX)$(LIB) || mkdirhier $(DESTDIR)$(PREFIX)$(LIB) + -test -d $(DESTDIR)$(X11_PREFIX)$(LIB) || mkdirhier $(DESTDIR)$(X11_PREFIX)$(LIB) + + install -m644 libivy_omp.a $(DESTDIR)$(PREFIX)$(LIB) install -m644 libivy_omp.so.$(MAJOR).$(MINOR) $(DESTDIR)$(PREFIX)$(LIB) includes: @@ -308,10 +313,10 @@ installliblinks: installlibs installbins: commands test -d $(DESTDIR)$(PREFIX)/bin || mkdirhier $(DESTDIR)$(PREFIX)/bin install -m755 ivyprobe $(DESTDIR)$(PREFIX)/bin + +installbins_omp: commands + test -d $(DESTDIR)$(PREFIX)/bin || mkdirhier $(DESTDIR)$(PREFIX)/bin install -m755 ivyprobe_omp $(DESTDIR)$(PREFIX)/bin - #install -m755 ivyxtprobe $(DESTDIR)$(PREFIX)/bin - #install -m755 ivyglibprobe $(DESTDIR)$(PREFIX)/bin - #install -m755 ivyglutprobe $(DESTDIR)$(PREFIX)/bin installdocs: test -d $(DESTDIR)$(PREFIX)/share/doc/ivy-c || mkdirhier $(DESTDIR)$(PREFIX)/share/doc/ivy-c @@ -331,6 +336,7 @@ installdocs: install -m 766 ../examples/unBind.tcl $(DESTDIR)$(PREFIX)/share/doc/ivy-c/examples install: installlibs installbins installliblinks installdocs includes installpkgconf +install_omp: installlibs_omp installbins_omp rpm:: /usr/bin/rpmize diff --git a/src/ivy.c b/src/ivy.c index 0d146ee..df180b2 100644 --- a/src/ivy.c +++ b/src/ivy.c @@ -21,6 +21,8 @@ ° mesures de perfo ° compil rejeu en monothread et omp et tests ° compil sur mac et windows pour portabilité + ° faire un repertoire exemple avec tous les executables + ° faire un configure */ #ifdef OPENMP @@ -695,7 +697,8 @@ static void BroadcastReceive( Client client, void *data, char *line ) #endif /*DEBUG */ /* connect to the service and send the regexp */ - app = SocketConnectAddr(SocketGetRemoteAddr(client), serviceport, 0, Receive, ClientDelete ); + app = SocketConnectAddr(SocketGetRemoteAddr(client), serviceport, 0, Receive, + ClientDelete ); if (app) { IvyClientPtr clnt; clnt = SendService( app, appname ); diff --git a/src/ivysocket.c b/src/ivysocket.c index d0fd60e..1cc12e6 100644 --- a/src/ivysocket.c +++ b/src/ivysocket.c @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef WIN32 #define close closesocket @@ -186,6 +187,7 @@ static void HandleServer(Channel channel, HANDLE fd, void *data) HANDLE ns; socklen_t addrlen; struct sockaddr_in remote2; + long socketFlag; TRACE( "Accepting Connection...\n"); @@ -210,6 +212,13 @@ static void HandleServer(Channel channel, HANDLE fd, void *data) client->terminator = '\n'; client->from = remote2; client->fd = ns; + + socketFlag = fcntl (client->fd, F_GETFD); + if (fcntl (client->fd, F_SETFD, socketFlag|O_NONBLOCK)) { + fprintf(stderr,"Warning : Setting socket in nonblock mode FAILED\n"); + } + + client->channel = IvyChannelAdd (ns, client, DeleteSocket, HandleSocket ); client->interpretation = server->interpretation; client->ptr = client->buffer; @@ -490,7 +499,8 @@ void *SocketGetData (Client client ) void SocketBroadcast ( char *fmt, ... ) { Client client; - static IvyBuffer buffer = {NULL, 0, 0 }; /* Use satic mem to eliminate multiple call to malloc /free */ + static IvyBuffer buffer = {NULL, 0, 0 }; /* Use satic mem to eliminate + multiple call to malloc /free */ #ifdef OPENMP #pragma omp threadprivate (buffer) #endif @@ -521,7 +531,8 @@ Client SocketConnect (char * host, unsigned short port, fprintf(stderr, "Erreur %s Calculateur inconnu !\n",host); return NULL; } - return SocketConnectAddr ((struct in_addr*)(rhost->h_addr), port, data, interpretation, handle_delete); + return SocketConnectAddr ((struct in_addr*)(rhost->h_addr), port, data, + interpretation, handle_delete); } Client SocketConnectAddr (struct in_addr * addr, unsigned short port, @@ -533,6 +544,7 @@ Client SocketConnectAddr (struct in_addr * addr, unsigned short port, HANDLE handle; Client client; struct sockaddr_in remote; + long socketFlag; remote.sin_family = AF_INET; remote.sin_addr = *addr; @@ -547,6 +559,10 @@ Client SocketConnectAddr (struct in_addr * addr, unsigned short port, perror ("*** client connect ***"); return NULL; }; + socketFlag = fcntl (handle, F_GETFD); + if (fcntl (handle, F_SETFD, socketFlag|O_NONBLOCK)) { + fprintf(stderr,"Warning : Setting socket in nonblock mode FAILED\n"); + } IVY_LIST_ADD_START(clients_list, client ); diff --git a/src/ivythroughput.cpp b/src/ivythroughput.cpp index 3d56a60..21d04a9 100644 --- a/src/ivythroughput.cpp +++ b/src/ivythroughput.cpp @@ -500,7 +500,7 @@ void startOfSeqCB (IvyClientPtr app, void *user_data, int argc, char *argv[]) void endOfSeqCB (IvyClientPtr app, void *user_data, int argc, char *argv[]) { - nbMess--; + //nbMess--; printf ("recepteur %d a recu %d messages\n", globalInst, nbMess); } -- cgit v1.1