aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreschnett <eschnett@83718e91-0e4f-0410-abf4-91180603181f>2011-09-17 20:11:34 +0000
committereschnett <eschnett@83718e91-0e4f-0410-abf4-91180603181f>2011-09-17 20:11:34 +0000
commita9d1c875d2d6a74d748eb15142632f3eb511150f (patch)
treef43fbbe4f5c1ce1c9de12985a70bc1190e1f16bd
parentd08ad86c184d8c128bbb9a4e5dfafa4c555ecce2 (diff)
Use subdirectories when generating Formaline tarballs
When there are many thorn, the directory used to generate the Formaline tarballs can contain many files, likely reducing I/O performance. This patch uses a subdirectory for each thorn, which improves the directory layout and should also improve performance. This patch also adds all thorns to the git repository at once, instead of using a single make rule for each thorn. Since git repositories cannot be accessed for writing in parallel, using multiple make rules leads to long wait times for the git repository lock, which is avoided if one explicitly serialises this. git-svn-id: http://svn.cactuscode.org/arrangements/CactusUtils/Formaline/trunk@209 83718e91-0e4f-0410-abf4-91180603181f
-rw-r--r--src/make.configuration.deps95
1 files changed, 53 insertions, 42 deletions
diff --git a/src/make.configuration.deps b/src/make.configuration.deps
index ba81ac3..671dc7c 100644
--- a/src/make.configuration.deps
+++ b/src/make.configuration.deps
@@ -37,8 +37,8 @@ FRM-LIB = $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)Formaline-cactus
$(EXEDIR)$(DIRSEP)$(EXE): $(FRM-LIB)
-FRM-OBJS = $(TARBALL_DIR)/cactus-meta.o $(TARBALL_DIR)/build-id.o $(TARBALL_DIR)/flesh-Cactus.o $(patsubst %,$(TARBALL_DIR)/thorn-%.o,$(notdir $(THORNS)))
-FRM-OBJS-other = $(TARBALL_DIR)/flesh-Cactus-????.o $(patsubst %,$(TARBALL_DIR)/thorn-%-????.o,$(notdir $(THORNS)))
+FRM-OBJS = $(TARBALL_DIR)/cactus-meta.o $(TARBALL_DIR)/build-id.o $(TARBALL_DIR)/Cactus/flesh.o $(patsubst %,$(TARBALL_DIR)/%/thorn.o,$(notdir $(THORNS)))
+FRM-OBJS-other = $(TARBALL_DIR)/Cactus/flesh-????.o $(patsubst %,$(TARBALL_DIR)/%/thorn-????.o,$(notdir $(THORNS)))
$(FRM-LIB): $(FRM-OBJS)
# $(AR) $(ARFLAGS) $@ $^
@@ -57,7 +57,7 @@ $(FRM-LIB): $(FRM-OBJS)
## Build the thorns' tarballs already while the thorns are compiled
## (does not work)
#
-#$(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)%$(LIBNAME_SUFFIX): $(TARBALL_DIR)/thorn-%.o
+#$(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)%$(LIBNAME_SUFFIX): $(TARBALL_DIR)/%/thorn.o
@@ -103,7 +103,7 @@ $(TARBALL_DIR)/build-id.c: $(TOP)/BUILD-ID
$(TARBALL_DIR)/cactus-meta.o: $(TARBALL_DIR)/cactus-meta.c
cd $(TARBALL_DIR) && $(CC) $(CFLAGS) -c -o $@ $^
-$(TARBALL_DIR)/cactus-meta.c: $(TARBALL_DIR)/flesh-Cactus.c $(patsubst %,$(TARBALL_DIR)/thorn-%.c,$(notdir $(THORNS)))
+$(TARBALL_DIR)/cactus-meta.c: $(TARBALL_DIR)/Cactus/flesh.c $(patsubst %,$(TARBALL_DIR)/%/thorn.c,$(notdir $(THORNS)))
$(FORMALINE_BIN_DIR)/makemetablob.pl Cactus $(notdir $(THORNS)) > $@
.PRECIOUS: $(TARBALL_DIR)/cactus-meta.c $(TARBALL_DIR)/cactus-meta.o
@@ -111,7 +111,7 @@ $(TARBALL_DIR)/cactus-meta.c: $(TARBALL_DIR)/flesh-Cactus.c $(patsubst %,$(TARBA
#cleandeps:
-# rm -rf $(TOP)/scratch/flesh-Cactus.files $(TOP)/scratch/flesh-Cactus.ccldeps $(TOP)/scratch/thorn-*.files $(TOP)/scratch/thorn-*.ccldeps
+# rm -rf $(TOP)/scratch/flesh.files $(TOP)/scratch/flesh.ccldeps $(TOP)/scratch/thorn-*.files $(TOP)/scratch/thorn-*.ccldeps
@@ -119,24 +119,25 @@ $(TARBALL_DIR)/cactus-meta.c: $(TARBALL_DIR)/flesh-Cactus.c $(patsubst %,$(TARBA
# Flesh
###############################################################################
-$(TARBALL_DIR)/flesh-Cactus.o: $(TARBALL_DIR)/flesh-Cactus.c
+# TODO: Don't serialise this build
+$(TARBALL_DIR)/Cactus/flesh.o: $(TARBALL_DIR)/Cactus/flesh.c
@echo "Creating Formaline tarball for the flesh"
- cd $(TARBALL_DIR) && $(CC) $(CFLAGS) -c $^ $(^:%.c=%-????.c)
+ cd $(TARBALL_DIR)/Cactus && $(CC) $(CFLAGS) -c $^ $(^:%.c=%-????.c)
-$(TARBALL_DIR)/flesh-Cactus.c: $(TARBALL_DIR)/flesh-Cactus.tar.gz $(CCTK_HOME)/arrangements/CactusUtils/Formaline/src/util/VERSION
+$(TARBALL_DIR)/Cactus/flesh.c: $(TARBALL_DIR)/Cactus/flesh.tar.gz $(CCTK_HOME)/arrangements/CactusUtils/Formaline/src/util/VERSION
$(RM) -f $(@:%.c=%-????.c)
$(FORMALINE_BIN_DIR)/makeblob.pl $(@:%.c=%) '' Cactus < $<
-$(TARBALL_DIR)/flesh-Cactus.tar.gz: $(TARBALL_DIR)/flesh-Cactus.files
+$(TARBALL_DIR)/Cactus/flesh.tar.gz: $(TARBALL_DIR)/Cactus/flesh.files
cd $(CCTK_HOME) && \
$(TAR) czf $@ -T $< || [ $$(( $$? / ($(IS_GNUTAR)+1) )) -eq 0 ]
# This dependency means that the tarball for a thorn is only updated
-# if the thorn is actually recompiled. This does not catch changes to
+# if the thorn is actually recompiled. This does not catch changes to
# files that do not influence the executable.
-$(TARBALL_DIR)/flesh-Cactus.files: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)$(FLESHLIB)$(LIBNAME_SUFFIX) $(TARBALL_DIR)/flesh-Cactus.ccldeps
+$(TARBALL_DIR)/Cactus/flesh.files: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)$(FLESHLIB)$(LIBNAME_SUFFIX) $(TARBALL_DIR)/Cactus/flesh.ccldeps
cd $(CCTK_HOME) && \
- find CONTRIBUTORS COPYRIGHT Makefile lib/ src/ \
+ find CONTRIBUTORS COPYRIGHT Makefile lib src \
`ls configs/$(notdir $(TOP))/OptionList 2> /dev/null` \
`ls configs/$(notdir $(TOP))/properties.ini 2> /dev/null` \
`ls configs/$(notdir $(TOP))/RunScript 2> /dev/null` \
@@ -157,11 +158,11 @@ $(TARBALL_DIR)/flesh-Cactus.files: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAM
! -type d \
-print > $@
--include $(TARBALL_DIR)/flesh-Cactus.ccldeps
-# Make aborts if these dependencies vanish. Therefore mention only files
-# here that cannot go away.
-$(TARBALL_DIR)/flesh-Cactus.ccldeps:
- mkdir -p $(TARBALL_DIR)
+-include $(TARBALL_DIR)/Cactus/flesh.ccldeps
+# Make aborts if these dependencies vanish. Therefore mention only
+# files here that cannot go away.
+$(TARBALL_DIR)/Cactus/flesh.ccldeps:
+ mkdir -p $(TARBALL_DIR)/Cactus
{ \
echo "$(@:%.ccldeps=%.files) \\"; \
echo "$@: \\"; \
@@ -170,7 +171,7 @@ $(TARBALL_DIR)/flesh-Cactus.ccldeps:
echo " $(CCTK_HOME)/src/schedule.ccl"; \
} > $@
-.PRECIOUS: $(TARBALL_DIR)/flesh-Cactus.ccldeps $(TARBALL_DIR)/flesh-Cactus.files $(TARBALL_DIR)/flesh-Cactus.tar.gz $(TARBALL_DIR)/flesh-Cactus.c $(TARBALL_DIR)/flesh-Cactus.o
+.PRECIOUS: $(TARBALL_DIR)/Cactus/flesh.ccldeps $(TARBALL_DIR)/Cactus/flesh.files $(TARBALL_DIR)/Cactus/flesh.tar.gz $(TARBALL_DIR)/Cactus/flesh.c $(TARBALL_DIR)/Cactus/flesh.o
@@ -178,22 +179,23 @@ $(TARBALL_DIR)/flesh-Cactus.ccldeps:
# Thorns
###############################################################################
-$(TARBALL_DIR)/thorn-%.o: $(TARBALL_DIR)/thorn-%.c
+# TODO: Don't serialise this build
+$(TARBALL_DIR)/%/thorn.o: $(TARBALL_DIR)/%/thorn.c
@echo "Creating Formaline tarball for thorn $*"
- cd $(TARBALL_DIR) && $(CC) $(CFLAGS) -c $(patsubst $(TARBALL_DIR)/%, %, $^ $(^:%.c=%-????.c))
+ cd $(TARBALL_DIR)/$* && $(CC) $(CFLAGS) -c $(patsubst $(TARBALL_DIR)/$*/%, %, $^ $(^:%.c=%-????.c))
-$(TARBALL_DIR)/thorn-%.c: $(TARBALL_DIR)/thorn-%.tar.gz $(CCTK_HOME)/arrangements/CactusUtils/Formaline/src/util/VERSION
- cd $(TARBALL_DIR) && $(RM) -f $(@:$(TARBALL_DIR)/%.c=%-????.c)
- $(FORMALINE_BIN_DIR)/makeblob.pl $(@:%.c=%) $(patsubst %/,%,$(dir $(filter %/$(@:$(TARBALL_DIR)/thorn-%.c=%),$(THORNS)))) $(@:$(TARBALL_DIR)/thorn-%.c=%) < $<
+$(TARBALL_DIR)/%/thorn.c: $(TARBALL_DIR)/%/thorn.tar.gz $(CCTK_HOME)/arrangements/CactusUtils/Formaline/src/util/VERSION
+ cd $(TARBALL_DIR)/$* && $(RM) -f $(@:$(TARBALL_DIR)/$*/%.c=%-????.c)
+ $(FORMALINE_BIN_DIR)/makeblob.pl $(@:%.c=%) $(patsubst %/,%,$(dir $(filter %/$(@:$(TARBALL_DIR)/%/thorn.c=%),$(THORNS)))) $(@:$(TARBALL_DIR)/%/thorn.c=%) < $<
-$(TARBALL_DIR)/thorn-%.tar.gz: $(TARBALL_DIR)/thorn-%.files
+$(TARBALL_DIR)/%/thorn.tar.gz: $(TARBALL_DIR)/%/thorn.files
cd $(CCTK_HOME) && \
$(TAR) czf $@ -T $< || [ $$(( $$? / ($(IS_GNUTAR)+1) )) -eq 0 ]
# This dependency means that the tarball for a thorn is only updated
# if the thorn is actually recompiled. This does not catch changes to
# files that do not influence the executable.
-$(TARBALL_DIR)/thorn-%.files: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)%$(LIBNAME_SUFFIX) $(TARBALL_DIR)/thorn-%.ccldeps
+$(TARBALL_DIR)/%/thorn.files: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)%$(LIBNAME_SUFFIX) $(TARBALL_DIR)/%/thorn.ccldeps
cd $(CCTK_HOME) && \
find arrangements/$(filter %/$*,$(THORNS))/. \
-name 'data' -prune -o \
@@ -208,11 +210,11 @@ $(TARBALL_DIR)/thorn-%.files: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PRE
! -type d \
-print | sed -e 's+/[.]/+/+g' > $@
--include $(patsubst %,$(TARBALL_DIR)/thorn-%.ccldeps,$(notdir $(THORNS)))
+-include $(patsubst %,$(TARBALL_DIR)/%/thorn.ccldeps,$(notdir $(THORNS)))
# Make aborts if these dependencies vanish. Therefore mention only files
# here that cannot go away.
-$(TARBALL_DIR)/thorn-%.ccldeps:
- mkdir -p $(TARBALL_DIR)
+$(TARBALL_DIR)/%/thorn.ccldeps:
+ mkdir -p $(TARBALL_DIR)/$*
{ \
echo "$(@:%.ccldeps=%.files) \\"; \
echo "$@: \\"; \
@@ -221,7 +223,7 @@ $(TARBALL_DIR)/thorn-%.ccldeps:
echo " $(CCTK_HOME)/arrangements/$(filter %/$*,$(THORNS))/schedule.ccl"; \
} > $@
-.PRECIOUS: $(TARBALL_DIR)/thorn-%.ccldeps $(TARBALL_DIR)/thorn-%.files $(TARBALL_DIR)/thorn-%.tar.gz $(TARBALL_DIR)/thorn-%.c $(TARBALL_DIR)/thorn-%.o
+.PRECIOUS: $(TARBALL_DIR)/%/thorn.ccldeps $(TARBALL_DIR)/%/thorn.files $(TARBALL_DIR)/%/thorn.tar.gz $(TARBALL_DIR)/%/thorn.c $(TARBALL_DIR)/%/thorn.o
@@ -326,7 +328,7 @@ git-push-everything: git-commit-everything $(BUILD-ID-FILE)
} || echo "Formaline: WARNING: Error while pushing to master repository"
.PHONY: git-commit-everything
-git-commit-everything: $(GIT-TAG-DIR)/flesh-Cactus.git-tag $(GIT-THORNS:%=$(GIT-TAG-DIR)/thorn-%.git-tag) $(BUILD-ID-FILE) git-rm-unused-thorns
+git-commit-everything: $(GIT-TAG-DIR)/Cactus/flesh.git-tag $(GIT-TAG-DIR)/all-thorn-git-tags $(BUILD-ID-FILE) git-rm-unused-thorns
{ \
'$(GIT-BIN)/git-commit-everything.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' "$$(cat $(BUILD-ID-FILE))" "$$(cat $(CONFIG-ID-FILE))"; \
} || echo "Formaline: WARNING: Error while committing to repository"
@@ -339,27 +341,36 @@ git-rm-unused-thorns: $(CCTK_LIBDIR)/$(LIBNAME_PREFIX)$(CCTK_LIBNAME_PREFIX)Form
'$(GIT-BIN)/git-rm-unused-thorns.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' $(THORNS); \
} || echo "Formaline: WARNING: Error while removing unused thorns"
-.PRECIOUS: $(GIT-TAG-DIR)/flesh-Cactus.git-tag
-$(GIT-TAG-DIR)/flesh-Cactus.git-tag: $(TARBALL_DIR)/flesh-Cactus.files
- mkdir -p $(GIT-TAG-DIR)
+.PRECIOUS: $(GIT-TAG-DIR)/Cactus/flesh.git-tag
+$(GIT-TAG-DIR)/Cactus/flesh.git-tag: $(TARBALL_DIR)/Cactus/flesh.files
+ mkdir -p $(GIT-TAG-DIR)/Cactus
{ \
'$(GIT-BIN)/git-init-repo.pl' '$(GIT)' '$(GIT-REPO)' && \
echo "Formaline: Adding flesh to git repository..." && \
'$(GIT-BIN)/git-rm-thorn.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' 'Cactus' CONTRIBUTORS COPYRIGHT Makefile lib src configs && \
- xargs '$(GIT-BIN)/git-add-thorn.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' 'Cactus' < $(TARBALL_DIR)/flesh-Cactus.files && \
+ xargs '$(GIT-BIN)/git-add-thorn.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' 'Cactus' < $(TARBALL_DIR)/Cactus/flesh.files && \
: > $@; \
} || echo "Formaline: WARNING: Error while adding flesh to git repository"
-.PRECIOUS: $(GIT-TAG-DIR)/thorn-%.git-tag
-$(GIT-TAG-DIR)/thorn-%.git-tag: $(TARBALL_DIR)/thorn-%.files
+# Issue all git commands in a single make target and sequentially,
+# because accessing the git repository is serialised anyway.
+# Serialising this explicitly means that make can continue issuing
+# non-git commands in parallel, instead of having several git commands
+# waiting for the git lock in parallel.
+.PHONY: $(GIT-TAG-DIR)/all-thorn-git-tags
+$(GIT-TAG-DIR)/all-thorn-git-tags: $(GIT-THORNS:%=$(TARBALL_DIR)/%/thorn.files)
mkdir -p $(GIT-TAG-DIR)
- { \
'$(GIT-BIN)/git-init-repo.pl' '$(GIT)' '$(GIT-REPO)' && \
- echo "Formaline: Adding thorn $* to git repository..." && \
- '$(GIT-BIN)/git-rm-thorn.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' '$*' "'"'arrangements/*/$*'"'" && \
- xargs '$(GIT-BIN)/git-add-thorn.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' '$*' < $(TARBALL_DIR)/thorn-$*.files && \
- : > $@; \
- } || echo "Formaline: WARNING: Error while adding thorn $* to git repository"
+ for thorn in $(GIT-THORNS); do \
+ if ! test "$(GIT-TAG-DIR)/$${thorn}/thorn.git-tag" -nt "$(TARBALL_DIR)/$${thorn}/thorn.files"; then \
+ { \
+ echo "Formaline: Adding thorn $${thorn} to git repository..." && \
+ '$(GIT-BIN)/git-rm-thorn.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' "$${thorn}" 'arrangements/*/'"$${thorn}" && \
+ xargs '$(GIT-BIN)/git-add-thorn.pl' '$(GIT)' '$(GIT-REPO)' '$(GIT-ROOT)' "$${thorn}" < "$(TARBALL_DIR)/$${thorn}/thorn.files" && \
+ : > "$(GIT-TAG-DIR)/$${thorn}/thorn.git-tag"; \
+ } || echo "Formaline: WARNING: Error while adding thorn $${thorn} to git repository"; \
+ fi; \
+ done
endif