fix platform dependent thing

This commit is contained in:
Tianqi Chen 2015-04-25 20:40:43 -07:00
parent 84515cd2a8
commit afdebe8d8f
4 changed files with 8 additions and 7 deletions

View File

@ -372,7 +372,7 @@ class GBTree : public IGradBooster {
#pragma omp parallel for schedule(static)
for (bst_omp_uint i = 0; i < nsize; ++i) {
const int tid = omp_get_thread_num();
int64_t ridx = static_cast<int64_t>(batch.base_rowid + i);
size_t ridx = static_cast<size_t>(batch.base_rowid + i);
tree::RegTree::FVec &feats = thread_temp[tid];
feats.Fill(batch[i]);
for (unsigned j = 0; j < ntree_limit; ++j) {

View File

@ -166,12 +166,12 @@ class BoostLearner : public rabit::Serializable {
{
// backward compatibility code for compatible with old model type
// for new model, Read(&name_obj_) is suffice
size_t len;
uint64_t len;
utils::Check(fi.Read(&len, sizeof(len)) != 0, "BoostLearner: wrong model format");
if (len >= std::numeric_limits<unsigned>::max()) {
int gap;
utils::Check(fi.Read(&gap, sizeof(gap)) != 0, "BoostLearner: wrong model format");
len = len >> 32UL;
len = len >> static_cast<uint64_t>(32UL);
}
if (len != 0) {
name_obj_.resize(len);

View File

@ -15,6 +15,7 @@
inline int omp_get_thread_num() { return 0; }
inline int omp_get_num_threads() { return 1; }
inline void omp_set_num_threads(int nthread) {}
inline int omp_get_num_procs() { return 1; }
#endif
// loop variable used in openmp

View File

@ -42,10 +42,10 @@ extern "C" {
#ifdef _MSC_VER
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
typedef unsigned int uint32_t;
typedef unsigned long uint64_t;
typedef long int64_t;
typedef unsigned __int16 uint16_t;
typedef unsigned __int32 uint32_t;
typedef unsigned __int64 uint64_t;
typedef __int64 int64_t;
#else
#include <inttypes.h>
#endif