Add RABIT_DLL tag to definitions of rabit APIs. (#140)
* Add RABIT_DLL tag to definitions of rabit APIs. * Fix Travis tests.
This commit is contained in:
parent
4fb34a008d
commit
a6008d5d93
@ -63,7 +63,7 @@ addons:
|
||||
|
||||
before_install:
|
||||
- git clone https://github.com/dmlc/dmlc-core
|
||||
- export TRAVIS=dmlc-core/scripts/travis/
|
||||
- export TRAVIS=./scripts/
|
||||
- source ${TRAVIS}/travis_setup_env.sh
|
||||
- ${TRAVIS}/travis_osx_install.sh
|
||||
- source ./scripts/travis_setup.sh
|
||||
|
||||
13
scripts/travis_osx_install.sh
Executable file
13
scripts/travis_osx_install.sh
Executable file
@ -0,0 +1,13 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
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
|
||||
40
scripts/travis_setup_env.sh
Executable file
40
scripts/travis_setup_env.sh
Executable file
@ -0,0 +1,40 @@
|
||||
# script to be sourced in travis yml
|
||||
# setup all enviroment variables
|
||||
|
||||
export CACHE_PREFIX=${HOME}/.cache/usr
|
||||
export PATH=${HOME}/.local/bin:${PATH}
|
||||
export PATH=${PATH}:${CACHE_PREFIX}/bin
|
||||
export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}:${CACHE_PREFIX}/include
|
||||
export C_INCLUDE_PATH=${C_INCLUDE_PATH}:${CACHE_PREFIX}/include
|
||||
export LIBRARY_PATH=${LIBRARY_PATH}:${CACHE_PREFIX}/lib
|
||||
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${CACHE_PREFIX}/lib
|
||||
export DYLD_LIBRARY_PATH=${DYLD_LIBRARY_PATH}:${CACHE_PREFIX}/lib
|
||||
|
||||
alias make="make -j4"
|
||||
|
||||
# setup the cache prefix folder
|
||||
if [ ! -d ${HOME}/.cache ]; then
|
||||
mkdir ${HOME}/.cache
|
||||
fi
|
||||
|
||||
if [ ! -d ${CACHE_PREFIX} ]; then
|
||||
mkdir ${CACHE_PREFIX}
|
||||
fi
|
||||
if [ ! -d ${CACHE_PREFIX}/include ]; then
|
||||
mkdir ${CACHE_PREFIX}/include
|
||||
fi
|
||||
if [ ! -d ${CACHE_PREFIX}/lib ]; then
|
||||
mkdir ${CACHE_PREFIX}/lib
|
||||
fi
|
||||
if [ ! -d ${CACHE_PREFIX}/bin ]; then
|
||||
mkdir ${CACHE_PREFIX}/bin
|
||||
fi
|
||||
|
||||
# setup CUDA path if NVCC_PREFIX exists
|
||||
if [ ! -z "$NVCC_PREFIX" ]; then
|
||||
export PATH=${PATH}:${NVCC_PREFIX}/usr/local/cuda-7.5/bin
|
||||
export CPLUS_INCLUDE_PATH=${CPLUS_INCLUDE_PATH}:${NVCC_PREFIX}/usr/local/cuda-7.5/include
|
||||
export C_INCLUDE_PATH=${C_INCLUDE_PATH}:${NVCC_PREFIX}/usr/local/cuda-7.5/include
|
||||
export LIBRARY_PATH=${LIBRARY_PATH}:${NVCC_PREFIX}/usr/local/cuda-7.5/lib64:${NVCC_PREFIX}/usr/lib/x86_64-linux-gnu
|
||||
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:${NVCC_PREFIX}/usr/local/cuda-7.5/lib64:${NVCC_PREFIX}/usr/lib/x86_64-linux-gnu
|
||||
fi
|
||||
61
src/c_api.cc
61
src/c_api.cc
@ -220,38 +220,38 @@ struct WriteWrapper : public Serializable {
|
||||
} // namespace c_api
|
||||
} // namespace rabit
|
||||
|
||||
bool RabitInit(int argc, char *argv[]) {
|
||||
RABIT_DLL bool RabitInit(int argc, char *argv[]) {
|
||||
return rabit::Init(argc, argv);
|
||||
}
|
||||
|
||||
bool RabitFinalize() {
|
||||
RABIT_DLL bool RabitFinalize() {
|
||||
return rabit::Finalize();
|
||||
}
|
||||
|
||||
int RabitGetRingPrevRank() {
|
||||
RABIT_DLL int RabitGetRingPrevRank() {
|
||||
return rabit::GetRingPrevRank();
|
||||
}
|
||||
|
||||
int RabitGetRank() {
|
||||
RABIT_DLL int RabitGetRank() {
|
||||
return rabit::GetRank();
|
||||
}
|
||||
|
||||
int RabitGetWorldSize() {
|
||||
RABIT_DLL int RabitGetWorldSize() {
|
||||
return rabit::GetWorldSize();
|
||||
}
|
||||
|
||||
int RabitIsDistributed() {
|
||||
RABIT_DLL int RabitIsDistributed() {
|
||||
return rabit::IsDistributed();
|
||||
}
|
||||
|
||||
void RabitTrackerPrint(const char *msg) {
|
||||
RABIT_DLL void RabitTrackerPrint(const char *msg) {
|
||||
std::string m(msg);
|
||||
rabit::TrackerPrint(m);
|
||||
}
|
||||
|
||||
void RabitGetProcessorName(char *out_name,
|
||||
rbt_ulong *out_len,
|
||||
rbt_ulong max_len) {
|
||||
RABIT_DLL void RabitGetProcessorName(char *out_name,
|
||||
rbt_ulong *out_len,
|
||||
rbt_ulong max_len) {
|
||||
std::string s = rabit::GetProcessorName();
|
||||
if (s.length() > max_len) {
|
||||
s.resize(max_len - 1);
|
||||
@ -260,17 +260,14 @@ void RabitGetProcessorName(char *out_name,
|
||||
*out_len = static_cast<rbt_ulong>(s.length());
|
||||
}
|
||||
|
||||
void RabitBroadcast(void *sendrecv_data,
|
||||
rbt_ulong size, int root) {
|
||||
RABIT_DLL void RabitBroadcast(void *sendrecv_data,
|
||||
rbt_ulong size, int root) {
|
||||
rabit::Broadcast(sendrecv_data, size, root);
|
||||
}
|
||||
|
||||
void RabitAllgather(void *sendrecvbuf_,
|
||||
size_t total_size,
|
||||
size_t beginIndex,
|
||||
size_t size_node_slice,
|
||||
size_t size_prev_slice,
|
||||
int enum_dtype) {
|
||||
RABIT_DLL void RabitAllgather(void *sendrecvbuf_, size_t total_size,
|
||||
size_t beginIndex, size_t size_node_slice,
|
||||
size_t size_prev_slice, int enum_dtype) {
|
||||
rabit::c_api::Allgather(sendrecvbuf_,
|
||||
total_size,
|
||||
beginIndex,
|
||||
@ -279,13 +276,9 @@ void RabitAllgather(void *sendrecvbuf_,
|
||||
static_cast<rabit::engine::mpi::DataType>(enum_dtype));
|
||||
}
|
||||
|
||||
|
||||
void RabitAllreduce(void *sendrecvbuf,
|
||||
size_t count,
|
||||
int enum_dtype,
|
||||
int enum_op,
|
||||
void (*prepare_fun)(void *arg),
|
||||
void *prepare_arg) {
|
||||
RABIT_DLL void RabitAllreduce(void *sendrecvbuf, size_t count, int enum_dtype,
|
||||
int enum_op, void (*prepare_fun)(void *arg),
|
||||
void *prepare_arg) {
|
||||
rabit::c_api::Allreduce
|
||||
(sendrecvbuf, count,
|
||||
static_cast<rabit::engine::mpi::DataType>(enum_dtype),
|
||||
@ -293,10 +286,10 @@ void RabitAllreduce(void *sendrecvbuf,
|
||||
prepare_fun, prepare_arg);
|
||||
}
|
||||
|
||||
int RabitLoadCheckPoint(char **out_global_model,
|
||||
rbt_ulong *out_global_len,
|
||||
char **out_local_model,
|
||||
rbt_ulong *out_local_len) {
|
||||
RABIT_DLL int RabitLoadCheckPoint(char **out_global_model,
|
||||
rbt_ulong *out_global_len,
|
||||
char **out_local_model,
|
||||
rbt_ulong *out_local_len) {
|
||||
// NOTE: this function is not thread-safe
|
||||
using rabit::BeginPtr;
|
||||
using namespace rabit::c_api; // NOLINT(*)
|
||||
@ -321,10 +314,8 @@ int RabitLoadCheckPoint(char **out_global_model,
|
||||
return version;
|
||||
}
|
||||
|
||||
void RabitCheckPoint(const char *global_model,
|
||||
rbt_ulong global_len,
|
||||
const char *local_model,
|
||||
rbt_ulong local_len) {
|
||||
RABIT_DLL void RabitCheckPoint(const char *global_model, rbt_ulong global_len,
|
||||
const char *local_model, rbt_ulong local_len) {
|
||||
using namespace rabit::c_api; // NOLINT(*)
|
||||
WriteWrapper sg(global_model, global_len);
|
||||
WriteWrapper sl(local_model, local_len);
|
||||
@ -335,10 +326,10 @@ void RabitCheckPoint(const char *global_model,
|
||||
}
|
||||
}
|
||||
|
||||
int RabitVersionNumber() {
|
||||
RABIT_DLL int RabitVersionNumber() {
|
||||
return rabit::VersionNumber();
|
||||
}
|
||||
|
||||
int RabitLinkTag() {
|
||||
RABIT_DLL int RabitLinkTag() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user