code: def _test_cudf_metainfo(DMatrixT):
      import pandas as pd
      from cudf import DataFrame as df
  
      n = 100
      X = np.random.random((n, 2))
      dmat_cudf = DMatrixT(df.from_pandas(pd.DataFrame(X)))
      dmat = xgb.DMatrix(X)
      floats = np.random.random(n)
      uints = np.array([4, 2, 8]).astype("uint32")
      cudf_floats = df.from_pandas(pd.DataFrame(floats))
      cudf_uints = df.from_pandas(pd.DataFrame(uints))
      dmat.set_float_info("weight", floats)
      dmat.set_float_info("label", floats)
      dmat.set_float_info("base_margin", floats)
      dmat.set_uint_info("group", uints)
      dmat_cudf.set_info(weight=cudf_floats)
      dmat_cudf.set_info(label=cudf_floats)
      dmat_cudf.set_info(base_margin=cudf_floats)
      dmat_cudf.set_info(group=cudf_uints)
  
      # Test setting info with cudf DataFrame
      assert np.array_equal(
          dmat.get_float_info("weight"),
          dmat_cudf.get_float_info("weight"),
      )
      assert np.array_equal(
          dmat.get_float_info("label"),
          dmat_cudf.get_float_info("label"),
      )
      assert np.array_equal(
          dmat.get_float_info("base_margin"),
          dmat_cudf.get_float_info("base_margin"),
      )
      assert np.array_equal(
          dmat.get_uint_info("group_ptr"),
          dmat_cudf.get_uint_info("group_ptr"),
      )
  
      # Test setting info with cudf Series
      dmat_cudf.set_info(weight=cudf_floats[cudf_floats.columns[0]])
      dmat_cudf.set_info(label=cudf_floats[cudf_floats.columns[0]])
      dmat_cudf.set_info(
          base_margin=cudf_floats[cudf_floats.columns[0]]
      )
      dmat_cudf.set_info(group=cudf_uints[cudf_uints.columns[0]])
      assert np.array_equal(
          dmat.get_float_info("weight"),
          dmat_cudf.get_float_info("weight"),
      )
      assert np.array_equal(
          dmat.get_float_info("label"),
          dmat_cudf.get_float_info("label"),
      )
      assert np.array_equal(
          dmat.get_float_info("base_margin"),
          dmat_cudf.get_float_info("base_margin"),
      )
      assert np.array_equal(
          dmat.get_uint_info("group_ptr"),
          dmat_cudf.get_uint_info("group_ptr"),
      )
  
      run_base_margin_info(df, DMatrixT, "cuda")
  
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 4 for calling a global function with example usage: _test_cudf_metainfo(DMatrixT) without return types