parent
86715e4cd4
commit
7968c0d051
@ -17,6 +17,9 @@ jobs:
|
|||||||
arch: amd64
|
arch: amd64
|
||||||
osx_image: xcode10.2
|
osx_image: xcode10.2
|
||||||
env: TASK=java_test
|
env: TASK=java_test
|
||||||
|
- os: linux
|
||||||
|
arch: s390x
|
||||||
|
env: TASK=s390x_test
|
||||||
|
|
||||||
# dependent brew packages
|
# dependent brew packages
|
||||||
# the dependencies from homebrew is installed manually from setup script due to outdated image from travis.
|
# the dependencies from homebrew is installed manually from setup script due to outdated image from travis.
|
||||||
|
|||||||
@ -29,10 +29,6 @@ struct ArrayInterfaceErrors {
|
|||||||
static char const* TypestrFormat() {
|
static char const* TypestrFormat() {
|
||||||
return "`typestr' should be of format <endian><type><size of type in bytes>.";
|
return "`typestr' should be of format <endian><type><size of type in bytes>.";
|
||||||
}
|
}
|
||||||
// Not supported in Apache Arrow.
|
|
||||||
static char const* BigEndian() {
|
|
||||||
return "Big endian is not supported.";
|
|
||||||
}
|
|
||||||
static char const* Dimension(int32_t d) {
|
static char const* Dimension(int32_t d) {
|
||||||
static std::string str;
|
static std::string str;
|
||||||
str.clear();
|
str.clear();
|
||||||
@ -139,7 +135,6 @@ class ArrayInterfaceHandler {
|
|||||||
|
|
||||||
auto typestr = get<String const>(array.at("typestr"));
|
auto typestr = get<String const>(array.at("typestr"));
|
||||||
CHECK(typestr.size() == 3 || typestr.size() == 4) << ArrayInterfaceErrors::TypestrFormat();
|
CHECK(typestr.size() == 3 || typestr.size() == 4) << ArrayInterfaceErrors::TypestrFormat();
|
||||||
CHECK_NE(typestr.front(), '>') << ArrayInterfaceErrors::BigEndian();
|
|
||||||
|
|
||||||
if (array.find("shape") == array.cend()) {
|
if (array.find("shape") == array.cend()) {
|
||||||
LOG(FATAL) << "Missing `shape' field for array interface";
|
LOG(FATAL) << "Missing `shape' field for array interface";
|
||||||
@ -239,7 +234,6 @@ class ArrayInterfaceHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void* ExtractData(std::map<std::string, Json> const &column,
|
static void* ExtractData(std::map<std::string, Json> const &column,
|
||||||
StringView typestr,
|
|
||||||
std::pair<size_t, size_t> shape) {
|
std::pair<size_t, size_t> shape) {
|
||||||
Validate(column);
|
Validate(column);
|
||||||
void* p_data = ArrayInterfaceHandler::GetPtrFromArrayData<void*>(column);
|
void* p_data = ArrayInterfaceHandler::GetPtrFromArrayData<void*>(column);
|
||||||
@ -268,7 +262,7 @@ class ArrayInterface {
|
|||||||
|
|
||||||
std::tie(num_rows, num_cols) = ArrayInterfaceHandler::ExtractShape(array);
|
std::tie(num_rows, num_cols) = ArrayInterfaceHandler::ExtractShape(array);
|
||||||
data = ArrayInterfaceHandler::ExtractData(
|
data = ArrayInterfaceHandler::ExtractData(
|
||||||
array, StringView{typestr}, std::make_pair(num_rows, num_cols));
|
array, std::make_pair(num_rows, num_cols));
|
||||||
|
|
||||||
if (allow_mask) {
|
if (allow_mask) {
|
||||||
common::Span<RBitField8::value_type> s_mask;
|
common::Span<RBitField8::value_type> s_mask;
|
||||||
|
|||||||
@ -124,7 +124,6 @@ class CudfAdapter : public detail::SingleBatchDataIter<CudfAdapterBatch> {
|
|||||||
|
|
||||||
auto const& typestr = get<String const>(json_columns[0]["typestr"]);
|
auto const& typestr = get<String const>(json_columns[0]["typestr"]);
|
||||||
CHECK_EQ(typestr.size(), 3) << ArrayInterfaceErrors::TypestrFormat();
|
CHECK_EQ(typestr.size(), 3) << ArrayInterfaceErrors::TypestrFormat();
|
||||||
CHECK_NE(typestr.front(), '>') << ArrayInterfaceErrors::BigEndian();
|
|
||||||
std::vector<ArrayInterface> columns;
|
std::vector<ArrayInterface> columns;
|
||||||
auto first_column = ArrayInterface(get<Object const>(json_columns[0]));
|
auto first_column = ArrayInterface(get<Object const>(json_columns[0]));
|
||||||
num_rows_ = first_column.num_rows;
|
num_rows_ = first_column.num_rows;
|
||||||
|
|||||||
@ -42,23 +42,19 @@ TEST(ArrayInterface, Error) {
|
|||||||
std::string typestr{"<f4"};
|
std::string typestr{"<f4"};
|
||||||
|
|
||||||
// missing version
|
// missing version
|
||||||
EXPECT_THROW(ArrayInterfaceHandler::ExtractData(column_obj,
|
EXPECT_THROW(ArrayInterfaceHandler::ExtractData(column_obj, shape),
|
||||||
StringView{typestr}, shape),
|
|
||||||
dmlc::Error);
|
dmlc::Error);
|
||||||
column["version"] = Integer(static_cast<Integer::Int>(1));
|
column["version"] = Integer(static_cast<Integer::Int>(1));
|
||||||
// missing data
|
// missing data
|
||||||
EXPECT_THROW(ArrayInterfaceHandler::ExtractData(column_obj,
|
EXPECT_THROW(ArrayInterfaceHandler::ExtractData(column_obj, shape),
|
||||||
StringView{typestr}, shape),
|
|
||||||
dmlc::Error);
|
dmlc::Error);
|
||||||
column["data"] = j_data;
|
column["data"] = j_data;
|
||||||
// missing typestr
|
// missing typestr
|
||||||
EXPECT_THROW(ArrayInterfaceHandler::ExtractData(column_obj,
|
EXPECT_THROW(ArrayInterfaceHandler::ExtractData(column_obj, shape),
|
||||||
StringView{typestr}, shape),
|
|
||||||
dmlc::Error);
|
dmlc::Error);
|
||||||
column["typestr"] = String("<f4");
|
column["typestr"] = String("<f4");
|
||||||
// nullptr is not valid
|
// nullptr is not valid
|
||||||
EXPECT_THROW(ArrayInterfaceHandler::ExtractData(column_obj,
|
EXPECT_THROW(ArrayInterfaceHandler::ExtractData(column_obj, shape),
|
||||||
StringView{typestr}, shape),
|
|
||||||
dmlc::Error);
|
dmlc::Error);
|
||||||
|
|
||||||
HostDeviceVector<float> storage;
|
HostDeviceVector<float> storage;
|
||||||
@ -67,8 +63,7 @@ TEST(ArrayInterface, Error) {
|
|||||||
Json(Integer(reinterpret_cast<Integer::Int>(storage.ConstHostPointer()))),
|
Json(Integer(reinterpret_cast<Integer::Int>(storage.ConstHostPointer()))),
|
||||||
Json(Boolean(false))};
|
Json(Boolean(false))};
|
||||||
column["data"] = j_data;
|
column["data"] = j_data;
|
||||||
EXPECT_NO_THROW(ArrayInterfaceHandler::ExtractData(
|
EXPECT_NO_THROW(ArrayInterfaceHandler::ExtractData(column_obj, shape));
|
||||||
column_obj, StringView{typestr}, shape));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST(ArrayInterface, GetElement) {
|
TEST(ArrayInterface, GetElement) {
|
||||||
|
|||||||
@ -232,6 +232,7 @@ class TestBasic:
|
|||||||
assert isinstance(cv, dict)
|
assert isinstance(cv, dict)
|
||||||
assert len(cv) == (4)
|
assert len(cv) == (4)
|
||||||
|
|
||||||
|
@pytest.mark.skipif(**tm.skip_s390x())
|
||||||
def test_cv_explicit_fold_indices_labels(self):
|
def test_cv_explicit_fold_indices_labels(self):
|
||||||
params = {'max_depth': 2, 'eta': 1, 'verbosity': 0, 'objective':
|
params = {'max_depth': 2, 'eta': 1, 'verbosity': 0, 'objective':
|
||||||
'reg:squarederror'}
|
'reg:squarederror'}
|
||||||
|
|||||||
@ -11,6 +11,7 @@ import pytest
|
|||||||
import tempfile
|
import tempfile
|
||||||
import xgboost as xgb
|
import xgboost as xgb
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
import platform
|
||||||
|
|
||||||
hypothesis = pytest.importorskip('hypothesis')
|
hypothesis = pytest.importorskip('hypothesis')
|
||||||
sklearn = pytest.importorskip('sklearn')
|
sklearn = pytest.importorskip('sklearn')
|
||||||
@ -136,6 +137,12 @@ def no_multiple(*args):
|
|||||||
return {'condition': condition, 'reason': reason}
|
return {'condition': condition, 'reason': reason}
|
||||||
|
|
||||||
|
|
||||||
|
def skip_s390x():
|
||||||
|
condition = platform.machine() == "s390x"
|
||||||
|
reason = "Known to fail on s390x"
|
||||||
|
return {"condition": condition, "reason": reason}
|
||||||
|
|
||||||
|
|
||||||
# Contains a dataset in numpy format as well as the relevant objective and metric
|
# Contains a dataset in numpy format as well as the relevant objective and metric
|
||||||
class TestDataset:
|
class TestDataset:
|
||||||
def __init__(self, name, get_dataset, objective, metric
|
def __init__(self, name, get_dataset, objective, metric
|
||||||
|
|||||||
@ -103,5 +103,5 @@ if [ ${TASK} == "s390x_test" ]; then
|
|||||||
# Run model compatibility tests
|
# Run model compatibility tests
|
||||||
cd ..
|
cd ..
|
||||||
python3 -m pip install --user pytest hypothesis
|
python3 -m pip install --user pytest hypothesis
|
||||||
PYTHONPATH=./python-package python3 -m pytest --fulltrace -v -rxXs tests/python/ -k 'test_model'
|
PYTHONPATH=./python-package python3 -m pytest --fulltrace -v -rxXs tests/python/test_basic.py
|
||||||
fi
|
fi
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user