Skip to content

Commit

Permalink
Improve CCache handling (apache#13456)
Browse files Browse the repository at this point in the history
* Remove gitignore entries

* Modify Makefile

* Modify user permissions

* Add new ccache wrapper function

* Change PATH rewrite to a different one to resolve CUDA issues

* Add ccache to gpu cmake

* Enable ccache for every build

* Set permissions for arm dockerfiles

* Disable ccache for ASAN

* Remove g++-8 ccache redirect

* Update Android Dockerfiles for user permissions

* Fix ASAN compiler typo

* Remove sanity for speed

* Move build dir creation in android armv8

* Revert "Remove sanity for speed"

This reverts commit e8386a7.

* Add ccache for NVCC in Makefile
  • Loading branch information
marcoabreu authored and Ubuntu committed Dec 18, 2018
1 parent 8f56933 commit d59dae6
Show file tree
Hide file tree
Showing 11 changed files with 124 additions and 37 deletions.
4 changes: 0 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,6 @@ python/.eggs
tests/Makefile
tests/mxnet_unit_tests

# generated wrappers for ccache
cc
cxx

# Code coverage related
.coverage
*.gcov
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ build/src/%.o: src/%.cc | mkldnn

build/src/%_gpu.o: src/%.cu | mkldnn
@mkdir -p $(@D)
$(NVCC) $(NVCCFLAGS) $(CUDA_ARCH) -Xcompiler "$(CFLAGS)" -M -MT build/src/$*_gpu.o $< >build/src/$*_gpu.d
$(NVCC) $(NVCCFLAGS) $(CUDA_ARCH) -Xcompiler "$(CFLAGS)" --generate-dependencies -MT build/src/$*_gpu.o $< >build/src/$*_gpu.d
$(NVCC) -c -o $@ $(NVCCFLAGS) $(CUDA_ARCH) -Xcompiler "$(CFLAGS)" $<

# A nvcc bug cause it to generate "generic/xxx.h" dependencies from torch headers.
Expand All @@ -483,7 +483,7 @@ build/plugin/%.o: plugin/%.cc

%_gpu.o: %.cu
@mkdir -p $(@D)
$(NVCC) $(NVCCFLAGS) $(CUDA_ARCH) -Xcompiler "$(CFLAGS) -Isrc/operator" -M -MT $*_gpu.o $< >$*_gpu.d
$(NVCC) $(NVCCFLAGS) $(CUDA_ARCH) -Xcompiler "$(CFLAGS) -Isrc/operator" --generate-dependencies -MT $*_gpu.o $< >$*_gpu.d
$(NVCC) -c -o $@ $(NVCCFLAGS) $(CUDA_ARCH) -Xcompiler "$(CFLAGS) -Isrc/operator" $<

%.o: %.cc $(CORE_INC)
Expand Down Expand Up @@ -690,7 +690,7 @@ rclean:

ifneq ($(EXTRA_OPERATORS),)
clean: rclean cyclean $(EXTRA_PACKAGES_CLEAN)
$(RM) -r build lib bin *~ */*~ */*/*~ */*/*/*~
$(RM) -r build lib bin deps *~ */*~ */*/*~ */*/*/*~
cd $(DMLC_CORE); $(MAKE) clean; cd -
cd $(PS_PATH); $(MAKE) clean; cd -
cd $(NNVM_PATH); $(MAKE) clean; cd -
Expand Down
5 changes: 5 additions & 0 deletions ci/docker/Dockerfile.build.android_armv7
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ ENV OpenBLAS_DIR=${CROSS_ROOT}

WORKDIR /work

ARG USER_ID=0
ARG GROUP_ID=0
COPY install/ubuntu_adduser.sh /work/
RUN /work/ubuntu_adduser.sh

COPY runtime_functions.sh /work/
WORKDIR /work/mxnet

8 changes: 7 additions & 1 deletion ci/docker/Dockerfile.build.android_armv8
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,12 @@ ENV CXX=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-clang++
COPY install/android_arm64_openblas.sh /work/
RUN /work/android_arm64_openblas.sh
ENV CPLUS_INCLUDE_PATH /work/deps/OpenBLAS
WORKDIR /work/build

ARG USER_ID=0
ARG GROUP_ID=0
COPY install/ubuntu_adduser.sh /work/
RUN /work/ubuntu_adduser.sh

COPY runtime_functions.sh /work/

WORKDIR /work/build
5 changes: 5 additions & 0 deletions ci/docker/Dockerfile.build.armv6
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,10 @@ ENV OpenBLAS_DIR=${CROSS_ROOT}
COPY install/deb_ubuntu_ccache.sh /work/
RUN /work/deb_ubuntu_ccache.sh

ARG USER_ID=0
ARG GROUP_ID=0
COPY install/ubuntu_adduser.sh /work/
RUN /work/ubuntu_adduser.sh

COPY runtime_functions.sh /work/
WORKDIR /work/mxnet
5 changes: 5 additions & 0 deletions ci/docker/Dockerfile.build.armv7
Original file line number Diff line number Diff line change
Expand Up @@ -38,5 +38,10 @@ ENV OpenBLAS_DIR=${CROSS_ROOT}
COPY install/deb_ubuntu_ccache.sh /work/
RUN /work/deb_ubuntu_ccache.sh

ARG USER_ID=0
ARG GROUP_ID=0
COPY install/ubuntu_adduser.sh /work/
RUN /work/ubuntu_adduser.sh

COPY runtime_functions.sh /work/
WORKDIR /work/mxnet
5 changes: 5 additions & 0 deletions ci/docker/Dockerfile.build.armv8
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,10 @@ ENV OpenBLAS_DIR=${CROSS_ROOT}
COPY install/deb_ubuntu_ccache.sh /work/
RUN /work/deb_ubuntu_ccache.sh

ARG USER_ID=0
ARG GROUP_ID=0
COPY install/ubuntu_adduser.sh /work/
RUN /work/ubuntu_adduser.sh

COPY runtime_functions.sh /work/
WORKDIR /work/build
5 changes: 5 additions & 0 deletions ci/docker/Dockerfile.build.jetson
Original file line number Diff line number Diff line change
Expand Up @@ -82,5 +82,10 @@ ENV NVCCFLAGS "-m64"
ENV CUDA_ARCH "-gencode arch=compute_53,code=sm_53 -gencode arch=compute_62,code=sm_62"
ENV NVCC /usr/local/cuda/bin/nvcc

ARG USER_ID=0
ARG GROUP_ID=0
COPY install/ubuntu_adduser.sh /work/
RUN /work/ubuntu_adduser.sh

COPY runtime_functions.sh /work/
WORKDIR /work/mxnet
5 changes: 5 additions & 0 deletions ci/docker/install/centos7_adduser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,9 @@ then
mkdir /work/mxnet
mkdir /work/build
chown -R jenkins_slave /work/

# Later on, we have to override the links because underlying build systems ignore our compiler settings. Thus,
# we have to give the process the proper permission to these files. This is hacky, but unfortunately
# there's no better way to do this without patching all our submodules.
chown -R jenkins_slave /usr/local/bin
fi
5 changes: 5 additions & 0 deletions ci/docker/install/ubuntu_adduser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,9 @@ then
mkdir /work/mxnet
mkdir /work/build
chown -R jenkins_slave /work/

# Later on, we have to override the links because underlying build systems ignore our compiler settings. Thus,
# we have to give the process the proper permission to these files. This is hacky, but unfortunately
# there's no better way to do this without patching all our submodules.
chown -R jenkins_slave /usr/local/bin
fi
Loading

0 comments on commit d59dae6

Please sign in to comment.