From e39c05664a92a2b32ff55aa6856ca31723db47f1 Mon Sep 17 00:00:00 2001 From: Thomas Preud'homme Date: Tue, 23 Jun 2009 12:25:36 +0200 Subject: [PATCH] comm lib have their own directory as calc libs --- communication_techniques/Makefile | 25 +++++++++++++------ communication_techniques/lancement.sh | 4 +-- .../src/{ => communication}/asm_cache.c | 0 .../src/{ => communication}/c_cache.c | 0 .../src/{ => communication}/common.c | 0 .../src/{ => communication}/fake.c | 0 .../src/{ => communication}/jikes_barrier.c | 0 .../src/{ => communication}/pipe.c | 0 .../src/{ => communication}/shared_mem.c | 0 .../src/{ => communication}/shared_mem_opt.c | 0 10 files changed, 20 insertions(+), 9 deletions(-) rename communication_techniques/src/{ => communication}/asm_cache.c (100%) rename communication_techniques/src/{ => communication}/c_cache.c (100%) rename communication_techniques/src/{ => communication}/common.c (100%) rename communication_techniques/src/{ => communication}/fake.c (100%) rename communication_techniques/src/{ => communication}/jikes_barrier.c (100%) rename communication_techniques/src/{ => communication}/pipe.c (100%) rename communication_techniques/src/{ => communication}/shared_mem.c (100%) rename communication_techniques/src/{ => communication}/shared_mem_opt.c (100%) diff --git a/communication_techniques/Makefile b/communication_techniques/Makefile index bc2d5fd..0c724ba 100644 --- a/communication_techniques/Makefile +++ b/communication_techniques/Makefile @@ -9,6 +9,7 @@ LOCALDIR:=$(HOME)/local PAPIHIGHLEVELLIBDIR:=lib PAPIHIGHLEVELINCDIR:=include CALCDIR:=calculation +COMMDIR:=communication # Compilation flags # I know -finline-functions and -finline-functions-called-once are enabled by @@ -23,8 +24,8 @@ CC=gcc BINNAMES:=asm_cache_comm c_cache_comm pipe_comm shared_mem_comm shared_mem_opt_comm jikes_barrier_comm fake_comm CALCLIBSNAMES:=calc_mat BINS:=$(patsubst %,$(BINDIR)/%,$(BINNAMES)) -CALCLIBS:=$(patsubst %,$(LIBDIR)/lib%.so.1,$(CALCLIBSNAMES)) -MAIN_OBJS:=main.o common.o +CALCLIBS:=$(patsubst %,$(LIBDIR)/$(CALCDIR)/lib%.so.1,$(CALCLIBSNAMES)) +MAIN_OBJS:=main.o COMMON_LIB_OBJS:=common.o .PHONY: all tidy clean distclean @@ -34,23 +35,27 @@ COMMON_LIB_OBJS:=common.o default: $(BINS) $(CALCLIBS) # Compilation of binary -$(BINDIR)/%_comm: $(patsubst %,$(OBJDIR)/\%/%,$(MAIN_OBJS)) $(LIBDIR)/lib%.a +$(BINDIR)/%_comm: $(patsubst %,$(OBJDIR)/\%/%,$(MAIN_OBJS)) $(LIBDIR)/$(COMMDIR)/lib%.a if [ ! -d $(BINDIR) ] ; then mkdir $(BINDIR) ; fi $(CC) -o $@ $^ $(LDFLAGS) # Creation of comm library -$(LIBDIR)/lib%.a: $(OBJDIR)/%.o $(patsubst %,$(OBJDIR)/\%/%,$(COMMON_LIB_OBJS)) +$(LIBDIR)/$(COMMDIR)/lib%.a: $(OBJDIR)/$(COMMDIR)/%.o $(patsubst %,$(OBJDIR)/$(COMMDIR)/\%/%,$(COMMON_LIB_OBJS)) if [ ! -d $(LIBDIR) ] ; then mkdir $(LIBDIR) ; fi + if [ ! -d $(LIBDIR)/$(COMMDIR) ] ; then mkdir $(LIBDIR)/$(COMMDIR) ; fi $(AR) -rcus $@ $^ # Creation of calc library -$(LIBDIR)/libcalc_%.so.1: $(OBJDIR)/$(CALCDIR)/calc_%.o +$(LIBDIR)/$(CALCDIR)/libcalc_%.so.1: $(OBJDIR)/$(CALCDIR)/calc_%.o if [ ! -d $(LIBDIR) ] ; then mkdir $(LIBDIR) ; fi + if [ ! -d $(LIBDIR)/$(CALCDIR) ] ; then mkdir $(LIBDIR)/$(CALCDIR) ; fi $(CC) $(LDFLAGS) -shared -Wl,-soname,libcalc_$*.so.1 -o $@ $< + cd $(@D) ; ln -sf libcalc_$*.so.1 libcalc_$*.so # Compile lib specific source files -$(OBJDIR)/%.o: $(SRCDIR)/%.c $(INCDIR)/%_comm.h $(INCDIR)/commtech.h +$(OBJDIR)/$(COMMDIR)/%.o: $(SRCDIR)/$(COMMDIR)/%.c $(INCDIR)/%_comm.h $(INCDIR)/commtech.h if [ ! -d $(OBJDIR) ] ; then mkdir $(OBJDIR) ; fi + if [ ! -d $(OBJDIR)/$(COMMDIR) ] ; then mkdir $(OBJDIR)/$(COMMDIR) ; fi cd $(INCDIR) ; ln -sfT $*_comm.h specific_comm.h $(CC) $(CFLAGS) -I$(INCDIR) -c $< -o $@ @@ -92,9 +97,15 @@ distclean: clean .SECONDEXPANSION: # Compile common source files using libcomm +$(OBJDIR)/$(COMMDIR)/%.o: $(SRCDIR)/$(COMMDIR)/$$(*F).c $(INCDIR)/$$(*D)_comm.h $(INCDIR)/commtech.h + if [ ! -d $(OBJDIR) ] ; then mkdir $(OBJDIR) ; fi + if [ ! -d $(OBJDIR)/$(COMMDIR) ] ; then mkdir $(OBJDIR)/$(COMMDIR) ; fi + if [ ! -d $(OBJDIR)/$(COMMDIR)/$(*D) ] ; then mkdir $(OBJDIR)/$(COMMDIR)/$(*D) ; fi + cd $(INCDIR) ; ln -sfT $(*D)_comm.h specific_comm.h + $(CC) $(CFLAGS) -I$(INCDIR) -I$(LOCALDIR)/$(PAPIHIGHLEVELINCDIR) -c $< -o $@ + $(OBJDIR)/%.o: $(SRCDIR)/$$(*F).c $(INCDIR)/$$(*D)_comm.h $(INCDIR)/commtech.h if [ ! -d $(OBJDIR) ] ; then mkdir $(OBJDIR) ; fi if [ ! -d $(OBJDIR)/$(*D) ] ; then mkdir $(OBJDIR)/$(*D) ; fi cd $(INCDIR) ; ln -sfT $(*D)_comm.h specific_comm.h $(CC) $(CFLAGS) -I$(INCDIR) -I$(LOCALDIR)/$(PAPIHIGHLEVELINCDIR) -c $< -o $@ - diff --git a/communication_techniques/lancement.sh b/communication_techniques/lancement.sh index 3dc7083..035ea95 100755 --- a/communication_techniques/lancement.sh +++ b/communication_techniques/lancement.sh @@ -4,7 +4,7 @@ set -u # Files and directories binDir="bin" -thisScript="$0" +calcDir="calculation" # Param binList="asm_cache_comm c_cache_comm pipe_comm shared_mem_comm shared_mem_opt_comm jikes_barrier_comm fake_comm" # Type de communication @@ -60,7 +60,7 @@ unset LD_LIBRARY_PATH_LEFT function_run () { case $typeProd in "none" ) optTypeProd="" ;; - "matrice" ) optTypeProd="-c $thisScript" ;; + "matrice" ) optTypeProd="-c lib/${calcDir}/libcalc_mat.so" ;; * ) exit 1 ;; esac case $typeCache in diff --git a/communication_techniques/src/asm_cache.c b/communication_techniques/src/communication/asm_cache.c similarity index 100% rename from communication_techniques/src/asm_cache.c rename to communication_techniques/src/communication/asm_cache.c diff --git a/communication_techniques/src/c_cache.c b/communication_techniques/src/communication/c_cache.c similarity index 100% rename from communication_techniques/src/c_cache.c rename to communication_techniques/src/communication/c_cache.c diff --git a/communication_techniques/src/common.c b/communication_techniques/src/communication/common.c similarity index 100% rename from communication_techniques/src/common.c rename to communication_techniques/src/communication/common.c diff --git a/communication_techniques/src/fake.c b/communication_techniques/src/communication/fake.c similarity index 100% rename from communication_techniques/src/fake.c rename to communication_techniques/src/communication/fake.c diff --git a/communication_techniques/src/jikes_barrier.c b/communication_techniques/src/communication/jikes_barrier.c similarity index 100% rename from communication_techniques/src/jikes_barrier.c rename to communication_techniques/src/communication/jikes_barrier.c diff --git a/communication_techniques/src/pipe.c b/communication_techniques/src/communication/pipe.c similarity index 100% rename from communication_techniques/src/pipe.c rename to communication_techniques/src/communication/pipe.c diff --git a/communication_techniques/src/shared_mem.c b/communication_techniques/src/communication/shared_mem.c similarity index 100% rename from communication_techniques/src/shared_mem.c rename to communication_techniques/src/communication/shared_mem.c diff --git a/communication_techniques/src/shared_mem_opt.c b/communication_techniques/src/communication/shared_mem_opt.c similarity index 100% rename from communication_techniques/src/shared_mem_opt.c rename to communication_techniques/src/communication/shared_mem_opt.c