From 324f2d4e4aa2084e769afd78c935e43ae302cea8 Mon Sep 17 00:00:00 2001 From: Philip Hyunsu Cho Date: Thu, 30 May 2024 05:14:39 -0700 Subject: [PATCH] Handle float128 generically (#10322) --- python-package/xgboost/collective.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python-package/xgboost/collective.py b/python-package/xgboost/collective.py index 468d38942..0f3feeeb4 100644 --- a/python-package/xgboost/collective.py +++ b/python-package/xgboost/collective.py @@ -4,7 +4,6 @@ import ctypes import logging import os import pickle -import platform from enum import IntEnum, unique from typing import Any, Dict, List, Optional @@ -184,8 +183,10 @@ def _map_dtype(dtype: np.dtype) -> int: np.dtype("uint32"): 10, np.dtype("uint64"): 11, } - if platform.system() != "Windows": + try: dtype_map.update({np.dtype("float128"): 3}) + except TypeError: # float128 doesn't exist on the system + pass if dtype not in dtype_map: raise TypeError(f"data type {dtype} is not supported on the current platform.")