Rename build info function to be consistent with rest of the API. (#7553)

This commit is contained in:
Jiaming Yuan 2022-01-14 00:39:28 +08:00 committed by GitHub
parent e94b766310
commit 52277cc3da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 4 additions and 4 deletions

View File

@ -49,7 +49,7 @@ XGB_DLL void XGBoostVersion(int* major, int* minor, int* patch);
* *
* \return 0 for success, -1 for failure * \return 0 for success, -1 for failure
*/ */
XGB_DLL int XGBBuildInfo(char const **out); XGB_DLL int XGBuildInfo(char const **out);
/*! /*!
* \brief get string message of the last error * \brief get string message of the last error

View File

@ -202,7 +202,7 @@ def build_info() -> dict:
""" """
j_info = ctypes.c_char_p() j_info = ctypes.c_char_p()
_check_call(_LIB.XGBBuildInfo(ctypes.byref(j_info))) _check_call(_LIB.XGBuildInfo(ctypes.byref(j_info)))
assert j_info.value is not None assert j_info.value is not None
res = json.loads(j_info.value.decode()) # pylint: disable=no-member res = json.loads(j_info.value.decode()) # pylint: disable=no-member
return res return res

View File

@ -55,7 +55,7 @@ void XGBBuildInfoDevice(Json *p_info) {
} // namespace xgboost } // namespace xgboost
#endif #endif
XGB_DLL int XGBBuildInfo(char const **out) { XGB_DLL int XGBuildInfo(char const **out) {
API_BEGIN(); API_BEGIN();
CHECK(out) << "Invalid input pointer"; CHECK(out) << "Invalid input pointer";
Json info{Object{}}; Json info{Object{}};

View File

@ -283,7 +283,7 @@ TEST(CAPI, XGBGlobalConfig) {
TEST(CAPI, BuildInfo) { TEST(CAPI, BuildInfo) {
char const* out; char const* out;
XGBBuildInfo(&out); XGBuildInfo(&out);
auto loaded = Json::Load(StringView{out}); auto loaded = Json::Load(StringView{out});
ASSERT_TRUE(get<Object const>(loaded).find("USE_OPENMP") != get<Object const>(loaded).cend()); ASSERT_TRUE(get<Object const>(loaded).find("USE_OPENMP") != get<Object const>(loaded).cend());
ASSERT_TRUE(get<Object const>(loaded).find("USE_CUDA") != get<Object const>(loaded).cend()); ASSERT_TRUE(get<Object const>(loaded).find("USE_CUDA") != get<Object const>(loaded).cend());