Skip to content

Instantly share code, notes, and snippets.

@RAMitchell
Created May 19, 2020 02:57
Show Gist options
  • Save RAMitchell/29f706e22ac98f3629ec82c1bb37e3fe to your computer and use it in GitHub Desktop.
Save RAMitchell/29f706e22ac98f3629ec82c1bb37e3fe to your computer and use it in GitHub Desktop.
import numpy as np
import GPUtil
import xgboost as xgb
print("Xgboost version: {}".format(xgb.__version__))
n = 10000
m = 100
X = np.random.randn(n, m)
y = np.random.randn(n)
exp_models = []
for i in range(3):
clf = xgb.XGBRegressor(
tree_method='gpu_hist', eta=0.1, max_depth=6, verbosity=0)
trained_model = clf.fit(X, y, verbose=False)
exp_models.append(trained_model)
print("Iteration {} device memory utilisation: {}mb".format(i, GPUtil.getGPUs()[0].memoryUsed))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment