Skip to content

Commit

Permalink
Revert "Test install.md for macOS (apache#6231)" (apache#6520)
Browse files Browse the repository at this point in the history
This reverts commit bc83786.
  • Loading branch information
lxn2 authored and piiswrong committed Jun 1, 2017
1 parent 2e24c28 commit a947338
Show file tree
Hide file tree
Showing 5 changed files with 91 additions and 184 deletions.
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ env:
- TASK=cpp_test
# run tests/python
- TASK=python_test
#- TASK=r_test
- TASK=installation_packaged_test
- TASK=installation_source_test
- TASK=r_test
# - TASK=julia JULIA_VER=0.4
# - TASK=scala_test

Expand Down Expand Up @@ -80,6 +78,7 @@ addons:
before_install:
- export NVCC_PREFIX=${HOME}
- source dmlc-core/scripts/travis/travis_setup_env.sh
- export PYTHONPATH=${PYTHONPATH}:${PWD}/python
- export MAVEN_SKIP_RC=true
- export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m -XX:-UseGCOverheadLimit -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC"

Expand Down
12 changes: 6 additions & 6 deletions docs/get_started/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -462,14 +462,14 @@ If not already installed, [download and install Xcode](https://developer.apple.c
<br/>

**Step 1** Install prerequisites - Homebrew, python development tools.
<!-- Pipe to /dev/null in case Homebrew or package was already installed to prevent failure -->

```bash
# Install Homebrew
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" </dev/null
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ export PATH=/usr/local/bin:/usr/local/sbin:$PATH

# Install python development tools - python2.7, pip, python-setuptools
$ brew list python &>/dev/null || brew install python
$ brew install python
```

**Step 2** Install virtualenv for macOS.
Expand Down Expand Up @@ -523,14 +523,14 @@ Install *MXNet* with OpenBLAS acceleration.
<br/>

**Step 1** Install prerequisites - Homebrew, python development tools.
<!-- Pipe to /dev/null in case Homebrew or package was already installed to prevent failure -->

```bash
# Install Homebrew
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" </dev/null
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ export PATH=/usr/local/bin:/usr/local/sbin:$PATH

# Install python development tools - python2.7, pip, python-setuptools
$ brew list python &>/dev/null || brew install python
$ brew install python
```

**Step 2** Install MXNet with OpenBLAS acceleration.
Expand Down
239 changes: 82 additions & 157 deletions tests/jenkins/run_test_installation_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function retrieve_closest_index() {
cur_num=${arr[${i}]}
if [[ ${cur_num} -eq ${number} || ${cur_num} -gt ${number} ]]
then
echo "${i}"
echo ${i}
return
fi
done
Expand Down Expand Up @@ -124,7 +124,7 @@ function retrieve_commands() {
fi
done
done
echo "${commands}"
echo ${commands}
}

# Sorts array of numbers.
Expand All @@ -139,32 +139,26 @@ function retrieve_commands() {
function sort() {
declare -a lineno_array=("${!1}")
size=${#lineno_array[@]}
for((i=1;i<size;i++))
for (( i=1; i<=$(( $size-1)); i++ ))
do
temp=${lineno_array[i]}
j=$((i-1))
while [ $temp -lt ${lineno_array[j]} ]
do
lineno_array[j+1]=${lineno_array[j]}
j=$(( $j-1 ))
if [ $j == -1 ]
then
break
fi
done
lineno_array[j+1]=$temp
j=$i
while (( ${j} > 0 && ${lineno_array[$j-1]} > ${lineno_array[$j]} )); do
x=${lineno_array[$j-1]}
lineno_array[$j-1]=${lineno_array[$j]}
lineno_array[$j]=$x
j=$j-1
done
done
printf "${lineno_array[*]}"
}

if (( $# < 2 )); then
if (( $# < 1 )); then
echo ""
echo "Usage: $(basename $0) FILE ENV"
echo "Usage: $(basename $0) FILE"
echo ""
exit 1
fi
FILE=${1}
TASK=${2}

# get all line numbers with "```" signifying start or end of source section and put them in an array
SOURCE_REGEX="\`\`\`"
Expand All @@ -176,10 +170,6 @@ PIP_LINENO_ALL=($(grep -n "<div class=\"pip\">" "${FILE}" | cut -d : -f 1))
DOCKER_LINENO_ALL=($(grep -n "<div class=\"docker\">" "${FILE}" | cut -d : -f 1))
BUILDFROMSOURCE_LINENO_ALL=($(grep -n "<div class=\"build-from-source\">" "${FILE}" | cut -d : -f 1))

# validation instructions
PYTHON_GPU_VALIDATION="import mxnet as mx; a = mx.nd.ones((2, 3), mx.gpu()); b = a * 2 + 1; b.asnumpy()"
PYTHON_CPU_VALIDATION="import mxnet as mx; a = mx.nd.ones((2, 3)); b = a * 2 + 1; b.asnumpy()"

# Given two line numbers, collects instruction sets for installing via Virtualenv, Pip, Docker, and source within the
# two lines assuming there is one of each.
#
Expand Down Expand Up @@ -242,139 +232,74 @@ function set_instruction_set() {
${sorted_indexes[$end_buildfromsource_command_index]})
}

if [[ "${TASK}" == "linux" ]]
then

########################LINUX-PYTHON-CPU############################
echo
echo
echo "### Testing LINUX-PYTHON-CPU ###"
echo
# range of all lines inside Linux-Python-CPU instructions
LINUX_PYTHON_CPU_START_LINENO=$(grep -n "START - Linux Python CPU Installation Instructions" "${FILE}" | cut -d : -f 1)
LINUX_PYTHON_CPU_END_LINENO=$(grep -n "END - Linux Python CPU Installation Instructions" "${FILE}" | cut -d : -f 1)

set_instruction_set ${LINUX_PYTHON_CPU_START_LINENO} ${LINUX_PYTHON_CPU_END_LINENO}

virtualenv_commands="${virtualenv_commands} python -c \"${PYTHON_CPU_VALIDATION}\""
echo
echo "### Testing Virtualenv ###"
echo "${virtualenv_commands}"
echo
docker run --rm ubuntu:14.04 bash -c "${virtualenv_commands}"

pip_commands="${pip_commands} python -c \"${PYTHON_CPU_VALIDATION}\""
echo
echo "### Testing Pip ###"
echo "${pip_commands}"
echo
docker run --rm ubuntu:14.04 bash -c "${pip_commands}"

docker_img=$(echo "$docker_commands" | sed 's/.*docker pull \(.*\)/\1/' | sed 's/;.*//')
docker_commands="${docker_commands} docker run ${docker_img} python -c \"${PYTHON_CPU_VALIDATION}\""
echo
echo "### Testing Docker ###"
echo "${docker_commands}"
echo
eval "${docker_commands}"

buildfromsource_commands="${buildfromsource_commands} python -c \"${PYTHON_CPU_VALIDATION}\""
echo
echo "### Testing Build From Source ###"
echo "${buildfromsource_commands}"
echo
docker run --rm ubuntu:14.04 bash -c "${buildfromsource_commands}"

#########################LINUX-PYTHON-GPU###########################

echo
echo
echo "### Testing LINUX-PYTHON-GPU ###"
echo
# range of all lines inside Linux-Python-GPU instructions
LINUX_PYTHON_GPU_START_LINENO=$(grep -n "START - Linux Python GPU Installation Instructions" "${FILE}" | cut -d : -f 1)
LINUX_PYTHON_GPU_END_LINENO=$(grep -n "END - Linux Python GPU Installation Instructions" "${FILE}" | cut -d : -f 1)

set_instruction_set ${LINUX_PYTHON_GPU_START_LINENO} ${LINUX_PYTHON_GPU_END_LINENO}

virtualenv_commands="${virtualenv_commands} python -c \"${PYTHON_GPU_VALIDATION}\""
echo
echo "### Testing Virtualenv ###"
echo "${virtualenv_commands}"
echo
nvidia-docker run --rm nvidia/cuda:8.0-cudnn5-devel-ubuntu14.04 bash -c "${virtualenv_commands}"

pip_commands="${pip_commands} python -c \"${PYTHON_GPU_VALIDATION}\""
echo
echo "### Testing Pip ###"
echo "${pip_commands}"
echo
nvidia-docker run --rm nvidia/cuda:8.0-cudnn5-devel-ubuntu14.04 bash -c "${pip_commands}"

docker_img=$(echo "$docker_commands" | sed 's/.*docker pull \(.*\)/\1/' | sed 's/;.*//')
docker_commands="${docker_commands} nvidia-docker run ${docker_img} python -c \"${PYTHON_GPU_VALIDATION}\""
echo
echo "### Testing Docker ###"
echo "${docker_commands}"
echo
eval "${docker_commands}"

buildfromsource_commands="${buildfromsource_commands} python -c \"${PYTHON_GPU_VALIDATION}\""
echo
echo "### Testing Build From Source ###"
echo "${buildfromsource_commands}"
echo
nvidia-docker run --rm nvidia/cuda:8.0-cudnn5-devel-ubuntu14.04 bash -c "${buildfromsource_commands}"

else

#########################MACOS-PYTHON-CPU###########################
# Currently this section is invoked in ../travis/run_test.sh so this test can run on MacOS.
echo
echo
echo "### Testing MACOS-PYTHON-CPU ###"
echo
# range of all lines inside MacOS-Python-CPU instructions
MAC_PYTHON_CPU_START_LINENO=$(grep -n "START - MacOS Python CPU Installation Instructions" "${FILE}" | cut -d : -f 1)
MAC_PYTHON_CPU_END_LINENO=$(grep -n "END - Mac OS Python CPU Installation Instructions" "${FILE}" | cut -d : -f 1)

set_instruction_set ${MAC_PYTHON_CPU_START_LINENO} ${MAC_PYTHON_CPU_END_LINENO}

if [[ "${TASK}" == "installation_packaged_test" ]]
then
virtualenv_commands="${virtualenv_commands} python -c \"import sys; print hasattr(sys, 'real_prefix'); ${PYTHON_CPU_VALIDATION}\"; deactivate;"
echo
echo "### Testing Virtualenv ###"
echo "${virtualenv_commands}"
echo
eval "${virtualenv_commands}"

pip_commands="${pip_commands} python -c \"${PYTHON_CPU_VALIDATION}\""
echo
echo "### Testing Pip ###"
echo "${pip_commands}"
echo
eval "${pip_commands}"

exit
fi

###COMMENTING THIS OUT FOR NOW AS TRAVIS DOES NOT SUPPORT DOCKER FOR MAC
# echo
# echo "### Testing Docker ###"
# echo "${docker_commands}"
# echo
# eval ${docker_commands}

if [[ "${TASK}" == "installation_source_test" ]]
then
buildfromsource_commands="${buildfromsource_commands} python -c \"${PYTHON_CPU_VALIDATION}\""
echo
echo "### Testing Build From Source ###"
echo "${buildfromsource_commands}"
echo
eval "${buildfromsource_commands}"

exit
fi
fi
########################LINUX-PYTHON-CPU############################
echo
echo
echo "### Testing LINUX-PYTHON-CPU ###"
echo
# range of all lines inside Linux-Python-CPU instructions
LINUX_PYTHON_CPU_START_LINENO=$(grep -n "START - Linux Python CPU Installation Instructions" "${FILE}" | cut -d : -f 1)
LINUX_PYTHON_CPU_END_LINENO=$(grep -n "END - Linux Python CPU Installation Instructions" "${FILE}" | cut -d : -f 1)

set_instruction_set ${LINUX_PYTHON_CPU_START_LINENO} ${LINUX_PYTHON_CPU_END_LINENO}

echo
echo "### Testing Virtualenv ###"
echo "${virtualenv_commands}"
echo
docker run --rm ubuntu:14.04 bash -c "${virtualenv_commands}"

echo
echo "### Testing Pip ###"
echo "${pip_commands}"
echo
docker run --rm ubuntu:14.04 bash -c "${pip_commands}"

echo
echo "### Testing Docker ###"
echo "${docker_commands}"
echo
eval ${docker_commands}

echo
echo "### Testing Build From Source ###"
echo "${buildfromsource_commands}"
echo
docker run --rm ubuntu:14.04 bash -c "${buildfromsource_commands}"

#########################LINUX-PYTHON-GPU###########################

echo
echo
echo "### Testing LINUX-PYTHON-GPU ###"
echo
# range of all lines inside Linux-Python-GPU instructions
LINUX_PYTHON_GPU_START_LINENO=$(grep -n "START - Linux Python GPU Installation Instructions" "${FILE}" | cut -d : -f 1)
LINUX_PYTHON_GPU_END_LINENO=$(grep -n "END - Linux Python GPU Installation Instructions" "${FILE}" | cut -d : -f 1)

set_instruction_set ${LINUX_PYTHON_GPU_START_LINENO} ${LINUX_PYTHON_GPU_END_LINENO}

echo
echo "### Testing Virtualenv ###"
echo "${virtualenv_commands}"
echo
nvidia-docker run --rm nvidia/cuda:7.5-cudnn5-devel bash -c "${virtualenv_commands}"

echo
echo "### Testing Pip ###"
echo "${pip_commands}"
echo
nvidia-docker run --rm nvidia/cuda:7.5-cudnn5-devel bash -c "${pip_commands}"

echo
echo "### Testing Docker ###"
echo "${docker_commands}"
echo
eval ${docker_commands}

echo
echo "### Testing Build From Source ###"
echo "${buildfromsource_commands}"
echo
nvidia-docker run --rm nvidia/cuda:7.5-cudnn5-devel bash -c "${buildfromsource_commands}"
17 changes: 0 additions & 17 deletions tests/travis/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,6 @@ then
exit 0
fi

if [[ ${TASK} == *"installation"* ]]; then
git remote add main https://github.com/dmlc/mxnet.git
git fetch main master
echo "File changes compared to origin/master:"
echo "**********************************"
git diff --name-only remotes/main/master
echo "**********************************"

if [[ ! $(git diff --name-only remotes/main/master | grep install.md) ]]; then
echo "No changes to install.md. Skipping installation tasks..."
exit 0
fi
./tests/jenkins/run_test_installation_docs.sh docs/get_started/install.md ${TASK}
exit $?
fi

if [ ${TASK} == "lint" ]; then
make lint || exit -1
echo "Check documentations of c++ code..."
Expand Down Expand Up @@ -109,7 +93,6 @@ if [ ${TASK} == "r_test" ]; then
fi

if [ ${TASK} == "python_test" ]; then
export PYTHONPATH=${PYTHONPATH}:${PWD}/python
make all || exit -1
# use cached dir for storing data
rm -rf ${PWD}/data
Expand Down
2 changes: 1 addition & 1 deletion tests/travis/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ then
exit 0
fi

if [[ ${TRAVIS_OS_NAME} == "osx" && ${TASK} != *"installation"* ]]; then
if [ ${TRAVIS_OS_NAME} == "osx" ]; then
brew update
brew tap homebrew/science
brew install opencv
Expand Down

0 comments on commit a947338

Please sign in to comment.