Skip to content

Commit

Permalink
dev: fix issues in run_in_docker script (#254)
Browse files Browse the repository at this point in the history
* fix permission issues for run_in_docker script
* exclude flashinfer to speed up build
  • Loading branch information
guocuimi committed Jun 29, 2024
1 parent 437be3f commit 3c514fc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/kernels/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,5 @@ cc_library(
)

add_subdirectory(flash_attn)
add_subdirectory(flash_infer)
# add_subdirectory(flash_infer)

32 changes: 15 additions & 17 deletions tools/run_in_docker.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
#!/bin/bash
# adapted from https://github.com/tensorflow/serving
# Adapted from https://github.com/tensorflow/serving

# ==============================================================================
#
# Script to run commands (like builds and scripts) in a docker container.
#
#
# Note: This script binds your working directory (via pwd) and /tmp to the
# Docker container. Any scripts or programs you run will need to have its
# output files/dirs written to one of the above locations for persistence.
#
# Typical usage (to build from lastest upstream source):
# Typical usage (to build from latest upstream source):
# $ git clone --recursive https://github.com/vectorch-ai/ScaleLLM.git
# $ cd ScaleLLM
# $ ./tools/run_in_docker.sh cmake -G Ninja -S . -B build
Expand Down Expand Up @@ -51,29 +50,28 @@ RUN_OPTS+=("-v $(pwd):$(pwd)")
RUN_OPTS+=("-v /tmp:/tmp")
RUN_OPTS+=("-v ${HOME}:${HOME}")

# run as the current user
RUN_OPTS+=("-u $(id -u):$(id -g)")
# Carry over cache settings
VCPKG_DEFAULT_BINARY_CACHE=${VCPKG_DEFAULT_BINARY_CACHE:-${HOME}/.cache/vcpkg}
mkdir -p "${VCPKG_DEFAULT_BINARY_CACHE}"
RUN_OPTS+=("-v ${VCPKG_DEFAULT_BINARY_CACHE}:${VCPKG_DEFAULT_BINARY_CACHE}")
RUN_OPTS+=("-e VCPKG_DEFAULT_BINARY_CACHE=${VCPKG_DEFAULT_BINARY_CACHE}")

# carry over cache settings
if [[ -n "${VCPKG_DEFAULT_BINARY_CACHE}" ]]; then
mkdir -p ${VCPKG_DEFAULT_BINARY_CACHE}
RUN_OPTS+=("-v ${VCPKG_DEFAULT_BINARY_CACHE}:${VCPKG_DEFAULT_BINARY_CACHE}")
RUN_OPTS+=("-e VCPKG_DEFAULT_BINARY_CACHE=${VCPKG_DEFAULT_BINARY_CACHE}")
fi
CCACHE_DIR=${CCACHE_DIR:-${HOME}/.cache/ccache}
mkdir -p "${CCACHE_DIR}"
RUN_OPTS+=("-v ${CCACHE_DIR}:${CCACHE_DIR}")
RUN_OPTS+=("-e CCACHE_DIR=${CCACHE_DIR}")

if [[ -n "${CCACHE_DIR}" ]]; then
mkdir -p ${CCACHE_DIR}
RUN_OPTS+=("-v ${CCACHE_DIR}:${CCACHE_DIR}")
RUN_OPTS+=("-e CCACHE_DIR=${CCACHE_DIR}")
fi
# Run as the current user
RUN_OPTS+=("-u $(id -u):$(id -g)")

CMD="$@"
[[ "${CMD}" = "" ]] && usage
[[ "${CMD}" == "" ]] && usage

[[ ! -x $(command -v docker) ]] && echo "ERROR: 'docker' command missing from PATH." && usage
if ! docker pull ${IMAGE}; then
echo "WARNING: Failed to docker pull image ${IMAGE}"
fi

# Execute the command in the Docker container
# echo "docker run ${RUN_OPTS[@]} ${IMAGE} bash -c \"cd $(pwd); ${CMD}\""
docker run ${RUN_OPTS[@]} ${IMAGE} bash -c "cd $(pwd); ${CMD}"

0 comments on commit 3c514fc

Please sign in to comment.