code: def _test_cudf_training(DMatrixT):
      import pandas as pd
      from cudf import DataFrame as df
  
      np.random.seed(1)
      X = pd.DataFrame(np.random.randn(50, 10))
      y = pd.DataFrame(np.random.randn(50))
      weights = np.random.random(50) + 1.0
      cudf_weights = df.from_pandas(pd.DataFrame(weights))
      base_margin = np.random.random(50)
      cudf_base_margin = df.from_pandas(pd.DataFrame(base_margin))
  
      evals_result_cudf = {}
      dtrain_cudf = DMatrixT(
          df.from_pandas(X),
          df.from_pandas(y),
          weight=cudf_weights,
          base_margin=cudf_base_margin,
      )
      params = {"device": "cuda", "tree_method": "hist"}
      xgb.train(
          params,
          dtrain_cudf,
          evals=[(dtrain_cudf, "train")],
          evals_result=evals_result_cudf,
      )
      evals_result_np = {}
      dtrain_np = xgb.DMatrix(
          X, y, weight=weights, base_margin=base_margin
      )
      xgb.train(
          params,
          dtrain_np,
          evals=[(dtrain_np, "train")],
          evals_result=evals_result_np,
      )
      assert np.array_equal(
          evals_result_cudf["train"]["rmse"],
          evals_result_np["train"]["rmse"],
      )
  
imports: import json
  import numpy
  import pytest
  import xgboost
  from xgboost import testing
  from xgboost.testing.data import run_base_margin_info
label_desc: Use image node_id 3 for calling a global function with example usage: _test_cudf_training(DMatrixT) without return types