diff --git a/src/gbm/gbm.cpp b/src/gbm/gbm.cpp index e280fdd4a..fe8d778e4 100644 --- a/src/gbm/gbm.cpp +++ b/src/gbm/gbm.cpp @@ -1,5 +1,6 @@ #define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_DEPRECATE +#define NOMINMAX #include #include "./gbm.h" #include "./gbtree-inl.hpp" diff --git a/src/sync/sync_empty.cpp b/src/sync/sync_empty.cpp index c0f956db3..959a4b87a 100644 --- a/src/sync/sync_empty.cpp +++ b/src/sync/sync_empty.cpp @@ -1,3 +1,5 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_DEPRECATE #include "./sync.h" #include "../utils/utils.h" // no synchronization module, single thread mode does not need it anyway @@ -26,11 +28,11 @@ std::string GetProcessorName(void) { } template<> -void AllReduce(uint32_t *sendrecvbuf, int count, ReduceOp op) { +void AllReduce(uint32_t *sendrecvbuf, size_t count, ReduceOp op) { } template<> -void AllReduce(float *sendrecvbuf, int count, ReduceOp op) { +void AllReduce(float *sendrecvbuf, size_t count, ReduceOp op) { } void Bcast(std::string *sendrecv_data, int root) { diff --git a/src/sync/sync_mpi.cpp b/src/sync/sync_mpi.cpp index f867fa5d0..d4521b6d5 100644 --- a/src/sync/sync_mpi.cpp +++ b/src/sync/sync_mpi.cpp @@ -1,3 +1,6 @@ +#define _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_DEPRECATE +#define NOMINMAX #include "./sync.h" #include "../utils/utils.h" #include diff --git a/src/sync/sync_tcp.cpp b/src/sync/sync_tcp.cpp index 6ed24f51d..e59c45e31 100644 --- a/src/sync/sync_tcp.cpp +++ b/src/sync/sync_tcp.cpp @@ -4,6 +4,9 @@ * with use non-block socket and tree-shape reduction * \author Tianqi Chen */ +#define _CRT_SECURE_NO_WARNINGS +#define _CRT_SECURE_NO_DEPRECATE +#define NOMINMAX #include #include #include @@ -34,13 +37,13 @@ class SyncManager { this->SetParam("reduce_buffer", "256MB"); } ~SyncManager(void) { - this->Shutdown(); } inline void Shutdown(void) { for (size_t i = 0; i < links.size(); ++i) { links[i].sock.Close(); } links.clear(); + TCPSocket::Finalize(); } /*! \brief set parameters to the sync manager */ inline void SetParam(const char *name, const char *val) { @@ -80,6 +83,7 @@ class SyncManager { } // initialize the manager inline void Init(void) { + TCPSocket::Startup(); // single node mode if (master_uri == "NULL") return; utils::Assert(links.size() == 0, "can only call Init once"); diff --git a/src/tree/updater.cpp b/src/tree/updater.cpp index a1349b806..1b3bc4694 100644 --- a/src/tree/updater.cpp +++ b/src/tree/updater.cpp @@ -1,5 +1,6 @@ #define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_DEPRECATE +#define NOMINMAX #include #include "./updater.h" #include "./updater_sync-inl.hpp" diff --git a/src/utils/quantile.h b/src/utils/quantile.h index 32495fb3b..f5e5f006c 100644 --- a/src/utils/quantile.h +++ b/src/utils/quantile.h @@ -598,12 +598,12 @@ class QuantileSketchTemplate { nlevel = 1; while (true) { limit_size = static_cast(ceil(nlevel / eps)) + 1; - size_t n = (1UL << nlevel); + size_t n = (1UL << nlevel); if (n * limit_size >= maxn) break; ++nlevel; } // check invariant - size_t n = (1UL << nlevel); + size_t n = (1UL << nlevel); utils::Assert(n * limit_size >= maxn, "invalid init parameter"); utils::Assert(nlevel <= limit_size * eps, "invalid init parameter"); // lazy reserve the space, if there is only one value, no need to allocate space diff --git a/src/xgboost_main.cpp b/src/xgboost_main.cpp index 4a459f2d7..a2ce7ed48 100644 --- a/src/xgboost_main.cpp +++ b/src/xgboost_main.cpp @@ -1,6 +1,6 @@ #define _CRT_SECURE_NO_WARNINGS #define _CRT_SECURE_NO_DEPRECATE - +#define NOMINMAX #include #include #include