Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/marian-nmt/nccl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Jeaugey <sjeaugey@nvidia.com>2018-11-10 01:00:41 +0300
committerGitHub <noreply@github.com>2018-11-10 01:00:41 +0300
commit3c6e25210bb1b544748937e5db74db0b9679b95e (patch)
treecf077d83e21b374dafae38355e2856e6b2fd7440
parent21d9a877be77fd024b25cde840bbde26c2dd179f (diff)
Generate nccl.h in build instead of src
Generating nccl.h in src makes source directories dirty after builds.
-rw-r--r--src/Makefile11
-rw-r--r--src/collectives/device/Makefile2
2 files changed, 7 insertions, 6 deletions
diff --git a/src/Makefile b/src/Makefile
index c0b674d..5d30444 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -41,15 +41,16 @@ lib : $(INCTARGETS) $(LIBDIR)/$(LIBTARGET)
staticlib : $(LIBDIR)/$(STATICLIBTARGET)
-devicelib: nccl.h
+devicelib: $(INCDIR)/nccl.h
$(MAKE) -C collectives/device
-include $(DEPFILES)
$(LIBDIR)/$(LIBTARGET) $(LIBDIR)/$(STATICLIBTARGET) : $(LIBOBJ)
-nccl.h : nccl.h.in
+$(INCDIR)/nccl.h : nccl.h.in
# NCCL_VERSION(X,Y,Z) ((X) * 1000 + (Y) * 100 + (Z))
@$(eval NCCL_VERSION := $(shell printf "%d%d%02d" $(NCCL_MAJOR) $(NCCL_MINOR) $(NCCL_PATCH)))
+ mkdir -p $(INCDIR)
printf "Generating %-35s > %s\n" $< $@
sed -e "s/\$${nccl:Major}/$(NCCL_MAJOR)/g" \
-e "s/\$${nccl:Minor}/$(NCCL_MINOR)/g" \
@@ -82,15 +83,15 @@ $(INCDIR)/%.h : %.h
$(OBJDIR)/%.o : %.cu
@printf "Compiling %-35s > %s\n" $< $@
mkdir -p `dirname $@`
- $(NVCC) -I. -Iinclude -c $(NVCUFLAGS) --compiler-options "$(CXXFLAGS)" $< -o $@
- @$(NVCC) -I. -Iinclude -M $(NVCUFLAGS) --compiler-options "$(CXXFLAGS)" $< > $(@:%.o=%.d.tmp)
+ $(NVCC) -I. -I$(INCDIR) -Iinclude -c $(NVCUFLAGS) --compiler-options "$(CXXFLAGS)" $< -o $@
+ @$(NVCC) -I. -I$(INCDIR) -Iinclude -M $(NVCUFLAGS) --compiler-options "$(CXXFLAGS)" $< > $(@:%.o=%.d.tmp)
@sed "0,/^.*:/s//$(subst /,\/,$@):/" $(@:%.o=%.d.tmp) > $(@:%.o=%.d)
@sed -e 's/.*://' -e 's/\\$$//' < $(@:%.o=%.d.tmp) | fmt -1 | \
sed -e 's/^ *//' -e 's/$$/:/' >> $(@:%.o=%.d)
@rm -f $(@:%.o=%.d.tmp)
clean :
- rm -rf ${INCDIR} ${LIBDIR} ${OBJDIR} nccl.h
+ rm -rf ${INCDIR} ${LIBDIR} ${OBJDIR}
$(MAKE) -C collectives/device clean
install : lib
diff --git a/src/collectives/device/Makefile b/src/collectives/device/Makefile
index ccea8f5..e2bcd49 100644
--- a/src/collectives/device/Makefile
+++ b/src/collectives/device/Makefile
@@ -25,7 +25,7 @@ DEPENDFILES := $(DEPFILES:%.d=%.dep)
STATICLIB := $(OBJDIR)/colldevice.a
DEVOBJ := $(OBJDIR)/devlink.o
-NVCUFLAGS += -I. -I.. -I../.. -I../../include --compiler-options "-fPIC -fvisibility=hidden"
+NVCUFLAGS += -I. -I.. -I$(BUILDDIR)/include -I../../include --compiler-options "-fPIC -fvisibility=hidden"
all: $(STATICLIB)