Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
[OSX] add travis build.
Browse files Browse the repository at this point in the history
Update

Update test_symbol.py
  • Loading branch information
tqchen committed Sep 24, 2015
1 parent f326831 commit 5c85e3f
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 23 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ Debug
.dir-locals.el
__pycache__
*.pkl

*.params
*.json
*.d
build
dmlc-core
Expand Down
7 changes: 4 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# disable sudo to use container based build
sudo: false
# Enabling test on Linux and OS X
os:
- linux

# Use Build Matrix to do lint and build seperately
env:
Expand Down Expand Up @@ -48,14 +51,12 @@ before_install:

install:
- pip install cpplint pylint --user `whoami`
- make -f dmlc-core/scripts/packages.mk gtest
- if [ "$CXX" = "g++" ]; then export CXX="g++-4.8" CC="gcc-4.8"; fi


script:
- scripts/travis_script.sh



before_cache:
- ${TRAVIS}/travis_before_cache.sh

Expand Down
32 changes: 32 additions & 0 deletions scripts/travis_osx_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/bin/bash

brew update
brew tap homebrew/science
brew info opencv
brew install graphviz
brew install opencv

if [ ${TASK} == "python-package3" ]; then
wget -O conda.sh https://repo.continuum.io/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
else
wget -O conda.sh https://repo.continuum.io/miniconda/Miniconda-latest-MacOSX-x86_64.sh
fi


bash conda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
hash -r
conda config --set always_yes yes --set changeps1 no
conda update -q conda
# Useful for debugging any issues with conda
conda info -a

if [ ${TASK} == "python-package3" ]; then
conda create -n myenv python=3.4
alias python3=python
else
conda create -n myenv python=2.7
fi
source activate myenv
conda install numpy scipy matplotlib nose
python -m pip install graphviz
45 changes: 31 additions & 14 deletions scripts/travis_script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,45 @@

# main script of travis
if [ ${TASK} == "lint" ]; then
make lint || exit -1
if [ ${TRAVIS_OS_NAME} != "osx" ]; then
make lint || exit -1
fi
exit 0
fi

if [ ${TASK} == "doc" ]; then
make doc 2>log.txt
(cat log.txt|grep warning) && exit -1
if [ ${TRAVIS_OS_NAME} != "osx" ]; then
make doc 2>log.txt
(cat log.txt|grep warning) && exit -1
fi
exit 0
fi

# prereqs for things that need make
cp make/config.mk config.mk
echo "USE_BLAS=blas" >> config.mk
echo "USE_CUDNN=0" >> config.mk
echo "CXX=g++-4.8" >> config.mk
export CXX="g++-4.8"

if [ ${TRAVIS_OS_NAME} == "osx" ]; then
source scripts/travis_osx_install.sh
echo "USE_BLAS=apple" >> config.mk
echo "USE_OPENMP=0" >> config.mk
alias nosetests='python -m noise'
alias nosetests3='python -m noise'
else
echo "USE_BLAS=blas" >> config.mk
echo "USE_CUDNN=0" >> config.mk
echo "CXX=g++-4.8" >> config.mk
export CXX="g++-4.8"
fi

echo "USE_S3=0" >> config.mk

if [ ${TASK} == "build" ]; then
echo "USE_CUDA=1" >> config.mk
echo "USE_THREADED_ENGINE=1" >> config.mk
./dmlc-core/scripts/setup_nvcc.sh $NVCC_PREFIX
make all || exit -1
if [ ${TRAVIS_OS_NAME} != "osx" ]; then
echo "USE_CUDA=1" >> config.mk
echo "USE_THREADED_ENGINE=1" >> config.mk
./dmlc-core/scripts/setup_nvcc.sh $NVCC_PREFIX
make all || exit -1
fi
fi

if [ ${TASK} == "python" ]; then
Expand All @@ -39,8 +55,8 @@ if [ ${TASK} == "python3" ]; then
echo "USE_CUDA=0" >> config.mk
make all || exit -1
export MXNET_ENGINE_TYPE=ThreadedEngine
nosetests tests/python/unittest || exit -1
nosetests tests/python/train || exit -1
nosetests3 tests/python/unittest || exit -1
nosetests3 tests/python/train || exit -1
fi

if [ ${TASK} == "python_naive" ]; then
Expand All @@ -60,12 +76,13 @@ if [ ${TASK} == "python_perdev" ]; then
fi

if [ ${TASK} == "cpp_unittest" ]; then
make -f dmlc-core/scripts/packages.mk gtest
echo "USE_CUDA=0" >> config.mk
echo "GTEST_PATH="${CACHE_PREFIX} >> config.mk
make test || exit -1
export MXNET_ENGINE_TYPE=ThreadedEngine
for test in tests/cpp/*_test; do
./$test || exit -1
done
fi

# TODO(yutian): add unittest back
2 changes: 1 addition & 1 deletion src/io/iter_image_recordio.cc
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ class ImageRecordIter : public IIterator<DataInst> {
elapsed = (uint64_t)(time(NULL) - start);
if (imcnt % 1000 == 0 && param_.silent == 0) {
printf("\r \r");
printf("[%8lu] images processed, %ld sec elapsed", imcnt, elapsed);
printf("[%8lu] images processed, %ld sec elapsed", imcnt, (long)elapsed); // NOLINT(*)
fflush(stdout);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/operator/elementwise_binary_op-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class ElementWiseBinaryOpProp : public OperatorProperty {
<< TypeString() << " do not take any additional keyword arguments besides lhs and rhs";
}
std::map<std::string, std::string> GetParams() const override {
return {};
return std::map<std::string, std::string>();
}

bool InferShape(std::vector<TShape> *in_shape,
Expand Down
3 changes: 2 additions & 1 deletion src/operator/reshape-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ class FlattenProp : public ReshapeProp {
void Init(const std::vector<std::pair<std::string, std::string> >& kwargs) override {}

std::map<std::string, std::string> GetParams() const override {
return {};
// need to use this on osx
return std::map<std::string, std::string>();
}

std::string TypeString() const override {
Expand Down
2 changes: 0 additions & 2 deletions tests/python/unittest/test_symbol.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ def test_symbol_internal():
'fc1_weight', 'fc1_bias',
'fc2_weight', 'fc2_bias']
internal = net1.get_internals()
print internal.list_outputs()
fc1 = internal['fc1_output']
assert fc1.list_arguments() == oldfc.list_arguments()

Expand All @@ -56,7 +55,6 @@ def test_symbol_saveload():
sym = models.mlp2()
fname = 'tmp_sym.json'
sym.save(fname)
print sym.tojson()
data2 = mx.symbol.load(fname)
# save because of order
assert sym.tojson() == data2.tojson()
Expand Down

0 comments on commit 5c85e3f

Please sign in to comment.