diff --git a/windows/README.md b/windows/README.md index 6fca36d1cf59..cb1cc9dd9eb4 100644 --- a/windows/README.md +++ b/windows/README.md @@ -4,6 +4,7 @@ How to Build Windows Version ===== * Open the solution file with Visual Studio * Select x64 and Release in build + - For 32bit windows or python, try win32 and Release (not fully tested) * Rebuild all This should give you xgboost.exe for CLI version and xgboost_wrapper.dll for python diff --git a/windows/xgboost/xgboost.vcxproj b/windows/xgboost/xgboost.vcxproj index fd3640211f9c..c14d84645f73 100644 --- a/windows/xgboost/xgboost.vcxproj +++ b/windows/xgboost/xgboost.vcxproj @@ -93,11 +93,14 @@ MaxSpeed true true + true + MultiThreaded true true true + $(OutDir)\rabit.lib;%(AdditionalDependencies) diff --git a/windows/xgboost_wrapper/xgboost_wrapper.vcxproj b/windows/xgboost_wrapper/xgboost_wrapper.vcxproj index 3559a52e5d1b..62f7d0fd3315 100644 --- a/windows/xgboost_wrapper/xgboost_wrapper.vcxproj +++ b/windows/xgboost_wrapper/xgboost_wrapper.vcxproj @@ -95,11 +95,13 @@ true true true + MultiThreaded true true true + $(OutDir)\rabit.lib;%(AdditionalDependencies) diff --git a/wrapper/setup.py b/wrapper/setup.py index 6c38cf69040d..bcf3e7ea807b 100644 --- a/wrapper/setup.py +++ b/wrapper/setup.py @@ -1,5 +1,5 @@ import os - +import platform from setuptools import setup @@ -11,7 +11,10 @@ class XGBoostLibraryNotFound(Exception): dll_path = [curr_dir] if os.name == 'nt': - dll_path.append(os.path.join(curr_dir, '../windows/x64/Release/')) + if platform.architecture()[0] == '64bit': + dll_path.append(os.path.join(curr_dir, '../windows/Release/')) + else: + dll_path.append(os.path.join(curr_dir, '../windows/x64/Release/')) if os.name == 'nt': dll_path = [os.path.join(p, 'xgboost_wrapper.dll') for p in dll_path] diff --git a/wrapper/xgboost.py b/wrapper/xgboost.py index 58beb43c9ca4..8cee737e93db 100644 --- a/wrapper/xgboost.py +++ b/wrapper/xgboost.py @@ -13,6 +13,7 @@ import sys import re import ctypes +import platform import collections import numpy as np @@ -40,7 +41,11 @@ class XGBoostLibraryNotFound(Exception): def load_xglib(): curr_path = os.path.dirname(os.path.abspath(os.path.expanduser(__file__))) dll_path = [curr_path] - dll_path.append(os.path.join(curr_path, '../windows/x64/Release/')) + if os.name == 'nt': + if platform.architecture()[0] == '64bit': + dll_path.append(os.path.join(curr_dir, '../windows/Release/')) + else: + dll_path.append(os.path.join(curr_dir, '../windows/x64/Release/')) if os.name == 'nt': dll_path = [os.path.join(p, 'xgboost_wrapper.dll') for p in dll_path] diff --git a/wrapper/xgboost_wrapper.cpp b/wrapper/xgboost_wrapper.cpp index 2b28469c7b6b..d2aa5169f1d1 100644 --- a/wrapper/xgboost_wrapper.cpp +++ b/wrapper/xgboost_wrapper.cpp @@ -266,7 +266,7 @@ extern "C"{ pmat->info.group_ptr.resize(len + 1); pmat->info.group_ptr[0] = 0; for (uint64_t i = 0; i < len; ++i) { - pmat->info.group_ptr[i+1] = pmat->info.group_ptr[i]+group[i]; + pmat->info.group_ptr[i+1] = pmat->info.group_ptr[i] + group[i]; } } const float* XGDMatrixGetFloatInfo(const void *handle, const char *field, bst_ulong* len) {