Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

De-duplicate macro _CRT_SECURE_NO_WARNINGS / _CRT_SECURE_NO_DEPRECATE #136

Merged
merged 4 commits into from
Jun 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions include/rabit/base.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*!
* Copyright (c) 2020 by Contributors
* \file base.h
* \brief Macros common to all headers
*
* \author Hyunsu Cho
*/

#ifndef RABIT_BASE_H_
#define RABIT_BASE_H_

#ifndef _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#endif // _CRT_SECURE_NO_WARNINGS
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif // _CRT_SECURE_NO_DEPRECATE

#endif // RABIT_BASE_H_
3 changes: 2 additions & 1 deletion include/rabit/internal/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
*/
#ifndef RABIT_INTERNAL_UTILS_H_
#define RABIT_INTERNAL_UTILS_H_
#define _CRT_SECURE_NO_WARNINGS

#include <rabit/base.h>
#include <string.h>
#include <cstdio>
#include <string>
Expand Down
6 changes: 0 additions & 6 deletions scripts/travis_osx_install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,3 @@ set -x
if [ ${TRAVIS_OS_NAME} != "osx" ]; then
exit 0
fi

# Prevent clash between Python 2 and 3
brew unlink python@2
brew link --overwrite python

python3 -m pip install --upgrade pip
4 changes: 4 additions & 0 deletions scripts/travis_runtest.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
#!/bin/bash

conda activate python3
conda --version
python --version

make -f test.mk RABIT_BUILD_DMLC=1 model_recover_10_10k || exit -1
make -f test.mk RABIT_BUILD_DMLC=1 model_recover_10_10k_die_same || exit -1
make -f test.mk RABIT_BUILD_DMLC=1 model_recover_10_10k_die_hard || exit -1
Expand Down
23 changes: 19 additions & 4 deletions scripts/travis_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,24 @@

echo "Testing on: ${TRAVIS_OS_NAME}, Home directory: ${HOME}"

pip3 install cpplint pylint urllib3 numpy cpplint
pip3 install websocket-client kubernetes

# Install Miniconda
if [ ${TRAVIS_OS_NAME} == "osx" ]; then
wget -O conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
else
wget -O conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
fi
bash conda.sh -b -p $HOME/miniconda
source $HOME/miniconda/bin/activate
conda config --set always_yes yes --set changeps1 no
conda update -q conda
conda info -a
conda create -n python3 python=3.7
conda activate python3
conda --version
python --version
# Install Python packages
conda install -c conda-forge numpy scipy urllib3 websocket-client
python -m pip install cpplint pylint kubernetes

# Install googletest under home directory
GTEST_VERSION=1.8.1
Expand All @@ -27,7 +42,7 @@ make install
popd

if [ ${TRAVIS_OS_NAME} == "linux" ]; then
sudo apt-get install python3-pip tree
sudo apt-get install tree
fi

if [ ${TRAVIS_OS_NAME} == "osx" ]; then
Expand Down
3 changes: 1 addition & 2 deletions src/allreduce_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
*
* \author Tianqi Chen, Ignacio Cano, Tianyi Zhou
*/
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#define NOMINMAX
#include <rabit/base.h>
#include <netinet/tcp.h>
#include <cstring>
#include <map>
Expand Down
3 changes: 1 addition & 2 deletions src/allreduce_robust.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
*
* \author Tianqi Chen, Ignacio Cano, Tianyi Zhou
*/
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#define NOMINMAX
#include <rabit/base.h>
#include <chrono>
#include <thread>
#include <limits>
Expand Down
4 changes: 1 addition & 3 deletions src/c_api.cc
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// Copyright by Contributors
// implementations in ctypes
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE

#include <rabit/base.h>
#include <cstring>
#include <string>
#include "rabit/rabit.h"
Expand Down
5 changes: 1 addition & 4 deletions src/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
*
* \author Tianqi Chen, Ignacio Cano, Tianyi Zhou
*/
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#define NOMINMAX

#include <rabit/base.h>
#include <memory>
#include "rabit/internal/engine.h"
#include "allreduce_base.h"
Expand Down
3 changes: 1 addition & 2 deletions src/engine_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
* \author Tianqi Chen
*/
// define use MOCK, os we will use mock Manager
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#define NOMINMAX
#include <rabit/base.h>
// switch engine to AllreduceMock
#define RABIT_USE_BASE
#include "engine.cc"
Expand Down
3 changes: 1 addition & 2 deletions src/engine_empty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
* This is usually NOT needed, use engine_mpi or engine for real distributed version
* \author Tianqi Chen
*/
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#define NOMINMAX

#include <rabit/base.h>
#include "rabit/internal/engine.h"

namespace rabit {
Expand Down
3 changes: 1 addition & 2 deletions src/engine_mock.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
* \author Tianqi Chen
*/
// define use MOCK, os we will use mock Manager
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#define NOMINMAX
// switch engine to AllreduceMock
#define RABIT_USE_MOCK
#include <rabit/base.h>
#include "allreduce_mock.h"
#include "engine.cc"

5 changes: 2 additions & 3 deletions src/engine_mpi.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,10 @@
*
* \author Tianqi Chen
*/
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_DEPRECATE
#define NOMINMAX
#include <cstdio>
#include <rabit/base.h>
#include <mpi.h>
#include <cstdio>
#include "rabit/internal/engine.h"
#include "rabit/internal/utils.h"

Expand Down
16 changes: 8 additions & 8 deletions test/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,25 @@ all: model_recover_10_10k model_recover_10_10k_die_same model_recover_10_10k_di

# this experiment test recovery with actually process exit, use keepalive to keep program alive
model_recover_10_10k:
$(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 model_recover 10000 mock=0,0,1,0 mock=1,1,1,0 rabit_bootstrap_cache=true rabit_debug=true rabit_reduce_ring_mincount=1 rabit_timeout=true rabit_timeout_sec=5
python $(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 model_recover 10000 mock=0,0,1,0 mock=1,1,1,0 rabit_bootstrap_cache=true rabit_debug=true rabit_reduce_ring_mincount=1 rabit_timeout=true rabit_timeout_sec=5

model_recover_10_10k_die_same:
$(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 model_recover 10000 mock=0,0,1,0 mock=1,1,1,0 mock=0,1,1,0 mock=4,1,1,0 mock=9,1,1,0 rabit_bootstrap_cache=1
python $(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 model_recover 10000 mock=0,0,1,0 mock=1,1,1,0 mock=0,1,1,0 mock=4,1,1,0 mock=9,1,1,0 rabit_bootstrap_cache=1

model_recover_10_10k_die_hard:
$(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 model_recover 10000 mock=0,0,1,0 mock=1,1,1,0 mock=1,1,1,1 mock=0,1,1,0 mock=4,1,1,0 mock=9,1,1,0 mock=8,1,2,0 mock=4,1,3,0 rabit_bootstrap_cache=1
python $(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 model_recover 10000 mock=0,0,1,0 mock=1,1,1,0 mock=1,1,1,1 mock=0,1,1,0 mock=4,1,1,0 mock=9,1,1,0 mock=8,1,2,0 mock=4,1,3,0 rabit_bootstrap_cache=1

local_recover_10_10k:
$(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 local_recover 10000 mock=0,0,1,0 mock=1,1,1,0 mock=0,1,1,0 mock=4,1,1,0 mock=9,1,1,0 mock=1,1,1,1
python $(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 local_recover 10000 mock=0,0,1,0 mock=1,1,1,0 mock=0,1,1,0 mock=4,1,1,0 mock=9,1,1,0 mock=1,1,1,1

pylocal_recover_10_10k:
$(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 local_recover.py 10000 mock=0,0,1,0 mock=1,1,1,0 mock=0,1,1,0 mock=4,1,1,0 mock=9,1,1,0 mock=1,1,1,1
python $(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 local_recover.py 10000 mock=0,0,1,0 mock=1,1,1,0 mock=0,1,1,0 mock=4,1,1,0 mock=9,1,1,0 mock=1,1,1,1

lazy_recover_10_10k_die_hard:
$(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 lazy_recover 10000 mock=0,0,1,0 mock=1,1,1,0 mock=1,1,1,1 mock=0,1,1,0 mock=4,1,1,0 mock=9,1,1,0 mock=8,1,2,0 mock=4,1,3,0
python $(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 lazy_recover 10000 mock=0,0,1,0 mock=1,1,1,0 mock=1,1,1,1 mock=0,1,1,0 mock=4,1,1,0 mock=9,1,1,0 mock=8,1,2,0 mock=4,1,3,0

lazy_recover_10_10k_die_same:
$(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 lazy_recover 10000 mock=0,0,1,0 mock=1,1,1,0 mock=0,1,1,0 mock=4,1,1,0 mock=9,1,1,0
python $(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 --local-num-attempt=20 lazy_recover 10000 mock=0,0,1,0 mock=1,1,1,0 mock=0,1,1,0 mock=4,1,1,0 mock=9,1,1,0

ringallreduce_10_10k:
$(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 model_recover 10000 rabit_reduce_ring_mincount=10
python $(DMLC)/tracker/dmlc-submit --cluster local --num-workers=10 model_recover 10000 rabit_reduce_ring_mincount=10