Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
548cec82
Commit
548cec82
authored
Oct 21, 2025
by
Jeff Daily
Browse files
Merge branch 'master' into rocm3
parents
2f7bd8ef
5dbfcdc4
Changes
195
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
1019 additions
and
972 deletions
+1019
-972
src/boosting/goss.hpp
src/boosting/goss.hpp
+3
-3
src/boosting/prediction_early_stop.cpp
src/boosting/prediction_early_stop.cpp
+3
-1
src/boosting/rf.hpp
src/boosting/rf.hpp
+3
-3
src/boosting/sample_strategy.cpp
src/boosting/sample_strategy.cpp
+3
-0
src/boosting/score_updater.hpp
src/boosting/score_updater.hpp
+3
-3
src/c_api.cpp
src/c_api.cpp
+5
-2
src/cuda/cuda_algorithms.cu
src/cuda/cuda_algorithms.cu
+2
-0
src/io/bin.cpp
src/io/bin.cpp
+951
-949
src/io/config.cpp
src/io/config.cpp
+5
-0
src/io/config_auto.cpp
src/io/config_auto.cpp
+7
-1
src/io/cuda/cuda_column_data.cpp
src/io/cuda/cuda_column_data.cpp
+1
-0
src/io/cuda/cuda_metadata.cpp
src/io/cuda/cuda_metadata.cpp
+2
-0
src/io/cuda/cuda_row_data.cpp
src/io/cuda/cuda_row_data.cpp
+2
-0
src/io/dataset.cpp
src/io/dataset.cpp
+8
-4
src/io/dataset_loader.cpp
src/io/dataset_loader.cpp
+7
-0
src/io/dense_bin.hpp
src/io/dense_bin.hpp
+3
-3
src/io/file_io.cpp
src/io/file_io.cpp
+3
-0
src/io/json11.cpp
src/io/json11.cpp
+4
-0
src/io/metadata.cpp
src/io/metadata.cpp
+1
-0
src/io/multi_val_dense_bin.hpp
src/io/multi_val_dense_bin.hpp
+3
-3
No files found.
src/boosting/goss.hpp
View file @
548cec82
...
...
@@ -3,8 +3,8 @@
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*/
#ifndef LIGHTGBM_BOOSTING_GOSS_HPP_
#define LIGHTGBM_BOOSTING_GOSS_HPP_
#ifndef LIGHTGBM_
SRC_
BOOSTING_GOSS_HPP_
#define LIGHTGBM_
SRC_
BOOSTING_GOSS_HPP_
#include <LightGBM/utils/array_args.h>
#include <LightGBM/sample_strategy.h>
...
...
@@ -169,4 +169,4 @@ class GOSSStrategy : public SampleStrategy {
}
// namespace LightGBM
#endif // LIGHTGBM_BOOSTING_GOSS_HPP_
#endif // LIGHTGBM_
SRC_
BOOSTING_GOSS_HPP_
src/boosting/prediction_early_stop.cpp
View file @
548cec82
...
...
@@ -6,9 +6,11 @@
#include <LightGBM/utils/log.h>
#include <limits>
#include <algorithm>
#include <cmath>
#include <functional>
#include <limits>
#include <string>
#include <vector>
namespace
LightGBM
{
...
...
src/boosting/rf.hpp
View file @
548cec82
...
...
@@ -2,8 +2,8 @@
* Copyright (c) 2017 Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*/
#ifndef LIGHTGBM_BOOSTING_RF_H_
#define LIGHTGBM_BOOSTING_RF_H_
#ifndef LIGHTGBM_
SRC_
BOOSTING_RF_H
PP
_
#define LIGHTGBM_
SRC_
BOOSTING_RF_H
PP
_
#include <LightGBM/boosting.h>
#include <LightGBM/metric.h>
...
...
@@ -233,4 +233,4 @@ class RF : public GBDT {
};
}
// namespace LightGBM
#endif // LIGHTGBM_BOOSTING_RF_H_
#endif // LIGHTGBM_
SRC_
BOOSTING_RF_H
PP
_
src/boosting/sample_strategy.cpp
View file @
548cec82
...
...
@@ -4,6 +4,9 @@
*/
#include <LightGBM/sample_strategy.h>
#include <string>
#include "goss.hpp"
#include "bagging.hpp"
...
...
src/boosting/score_updater.hpp
View file @
548cec82
...
...
@@ -2,8 +2,8 @@
* Copyright (c) 2016 Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*/
#ifndef LIGHTGBM_BOOSTING_SCORE_UPDATER_HPP_
#define LIGHTGBM_BOOSTING_SCORE_UPDATER_HPP_
#ifndef LIGHTGBM_
SRC_
BOOSTING_SCORE_UPDATER_HPP_
#define LIGHTGBM_
SRC_
BOOSTING_SCORE_UPDATER_HPP_
#include <LightGBM/dataset.h>
#include <LightGBM/meta.h>
...
...
@@ -125,4 +125,4 @@ class ScoreUpdater {
};
}
// namespace LightGBM
#endif
// L
ightGBM
_BOOSTING_SCORE_UPDATER_HPP_
#endif // L
IGHTGBM_SRC
_BOOSTING_SCORE_UPDATER_HPP_
src/c_api.cpp
View file @
548cec82
...
...
@@ -20,13 +20,16 @@
#include <LightGBM/utils/random.h>
#include <LightGBM/utils/threading.h>
#include <string>
#include <cstdio>
#include <algorithm>
#include <cstdint>
#include <cstdio>
#include <functional>
#include <memory>
#include <mutex>
#include <stdexcept>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "application/predictor.hpp"
...
...
src/cuda/cuda_algorithms.cu
View file @
548cec82
...
...
@@ -9,6 +9,8 @@
#include <LightGBM/cuda/cuda_algorithms.hpp>
#include <LightGBM/cuda/cuda_rocm_interop.h>
#include <algorithm>
namespace
LightGBM
{
template
<
typename
T
>
...
...
src/io/bin.cpp
View file @
548cec82
...
...
@@ -12,6 +12,8 @@
#include <cmath>
#include <cstdint>
#include <cstring>
#include <limits>
#include <vector>
#include "dense_bin.hpp"
#include "multi_val_dense_bin.hpp"
...
...
@@ -20,13 +22,13 @@
namespace
LightGBM
{
BinMapper
::
BinMapper
()
:
num_bin_
(
1
),
is_trivial_
(
true
),
bin_type_
(
BinType
::
NumericalBin
)
{
BinMapper
::
BinMapper
()
:
num_bin_
(
1
),
is_trivial_
(
true
),
bin_type_
(
BinType
::
NumericalBin
)
{
bin_upper_bound_
.
clear
();
bin_upper_bound_
.
push_back
(
std
::
numeric_limits
<
double
>::
infinity
());
}
}
// deep copy function for BinMapper
BinMapper
::
BinMapper
(
const
BinMapper
&
other
)
{
// deep copy function for BinMapper
BinMapper
::
BinMapper
(
const
BinMapper
&
other
)
{
num_bin_
=
other
.
num_bin_
;
missing_type_
=
other
.
missing_type_
;
is_trivial_
=
other
.
is_trivial_
;
...
...
@@ -42,16 +44,16 @@ namespace LightGBM {
max_val_
=
other
.
max_val_
;
default_bin_
=
other
.
default_bin_
;
most_freq_bin_
=
other
.
most_freq_bin_
;
}
}
BinMapper
::
BinMapper
(
const
void
*
memory
)
{
BinMapper
::
BinMapper
(
const
void
*
memory
)
{
CopyFrom
(
reinterpret_cast
<
const
char
*>
(
memory
));
}
}
BinMapper
::~
BinMapper
()
{
}
BinMapper
::~
BinMapper
()
{
}
bool
NeedFilter
(
const
std
::
vector
<
int
>&
cnt_in_bin
,
int
total_cnt
,
int
filter_cnt
,
BinType
bin_type
)
{
bool
NeedFilter
(
const
std
::
vector
<
int
>&
cnt_in_bin
,
int
total_cnt
,
int
filter_cnt
,
BinType
bin_type
)
{
if
(
bin_type
==
BinType
::
NumericalBin
)
{
int
sum_left
=
0
;
for
(
size_t
i
=
0
;
i
<
cnt_in_bin
.
size
()
-
1
;
++
i
)
{
...
...
@@ -73,9 +75,9 @@ namespace LightGBM {
}
}
return
true
;
}
}
std
::
vector
<
double
>
GreedyFindBin
(
const
double
*
distinct_values
,
const
int
*
counts
,
std
::
vector
<
double
>
GreedyFindBin
(
const
double
*
distinct_values
,
const
int
*
counts
,
int
num_distinct_values
,
int
max_bin
,
size_t
total_cnt
,
int
min_data_in_bin
)
{
std
::
vector
<
double
>
bin_upper_bound
;
...
...
@@ -154,9 +156,9 @@ namespace LightGBM {
bin_upper_bound
.
push_back
(
std
::
numeric_limits
<
double
>::
infinity
());
}
return
bin_upper_bound
;
}
}
std
::
vector
<
double
>
FindBinWithPredefinedBin
(
const
double
*
distinct_values
,
const
int
*
counts
,
std
::
vector
<
double
>
FindBinWithPredefinedBin
(
const
double
*
distinct_values
,
const
int
*
counts
,
int
num_distinct_values
,
int
max_bin
,
size_t
total_sample_cnt
,
int
min_data_in_bin
,
const
std
::
vector
<
double
>&
forced_upper_bounds
)
{
...
...
@@ -239,9 +241,9 @@ namespace LightGBM {
std
::
stable_sort
(
bin_upper_bound
.
begin
(),
bin_upper_bound
.
end
());
CHECK_LE
(
bin_upper_bound
.
size
(),
static_cast
<
size_t
>
(
max_bin
));
return
bin_upper_bound
;
}
}
std
::
vector
<
double
>
FindBinWithZeroAsOneBin
(
const
double
*
distinct_values
,
const
int
*
counts
,
int
num_distinct_values
,
std
::
vector
<
double
>
FindBinWithZeroAsOneBin
(
const
double
*
distinct_values
,
const
int
*
counts
,
int
num_distinct_values
,
int
max_bin
,
size_t
total_sample_cnt
,
int
min_data_in_bin
)
{
std
::
vector
<
double
>
bin_upper_bound
;
int
left_cnt_data
=
0
;
...
...
@@ -297,9 +299,9 @@ namespace LightGBM {
}
CHECK_LE
(
bin_upper_bound
.
size
(),
static_cast
<
size_t
>
(
max_bin
));
return
bin_upper_bound
;
}
}
std
::
vector
<
double
>
FindBinWithZeroAsOneBin
(
const
double
*
distinct_values
,
const
int
*
counts
,
int
num_distinct_values
,
std
::
vector
<
double
>
FindBinWithZeroAsOneBin
(
const
double
*
distinct_values
,
const
int
*
counts
,
int
num_distinct_values
,
int
max_bin
,
size_t
total_sample_cnt
,
int
min_data_in_bin
,
const
std
::
vector
<
double
>&
forced_upper_bounds
)
{
if
(
forced_upper_bounds
.
empty
())
{
...
...
@@ -308,9 +310,9 @@ namespace LightGBM {
return
FindBinWithPredefinedBin
(
distinct_values
,
counts
,
num_distinct_values
,
max_bin
,
total_sample_cnt
,
min_data_in_bin
,
forced_upper_bounds
);
}
}
}
void
BinMapper
::
FindBin
(
double
*
values
,
int
num_sample_values
,
size_t
total_sample_cnt
,
void
BinMapper
::
FindBin
(
double
*
values
,
int
num_sample_values
,
size_t
total_sample_cnt
,
int
max_bin
,
int
min_data_in_bin
,
int
min_split_data
,
bool
pre_filter
,
BinType
bin_type
,
bool
use_missing
,
bool
zero_as_missing
,
const
std
::
vector
<
double
>&
forced_upper_bounds
)
{
...
...
@@ -505,9 +507,9 @@ namespace LightGBM {
}
else
{
sparse_rate_
=
1.0
f
;
}
}
}
void
BinMapper
::
CopyTo
(
char
*
buffer
)
const
{
void
BinMapper
::
CopyTo
(
char
*
buffer
)
const
{
std
::
memcpy
(
buffer
,
&
num_bin_
,
sizeof
(
num_bin_
));
buffer
+=
VirtualFileWriter
::
AlignedSize
(
sizeof
(
num_bin_
));
std
::
memcpy
(
buffer
,
&
missing_type_
,
sizeof
(
missing_type_
));
...
...
@@ -531,9 +533,9 @@ namespace LightGBM {
}
else
{
std
::
memcpy
(
buffer
,
bin_2_categorical_
.
data
(),
num_bin_
*
sizeof
(
int
));
}
}
}
void
BinMapper
::
CopyFrom
(
const
char
*
buffer
)
{
void
BinMapper
::
CopyFrom
(
const
char
*
buffer
)
{
std
::
memcpy
(
&
num_bin_
,
buffer
,
sizeof
(
num_bin_
));
buffer
+=
VirtualFileWriter
::
AlignedSize
(
sizeof
(
num_bin_
));
std
::
memcpy
(
&
missing_type_
,
buffer
,
sizeof
(
missing_type_
));
...
...
@@ -563,9 +565,9 @@ namespace LightGBM {
categorical_2_bin_
[
bin_2_categorical_
[
i
]]
=
static_cast
<
unsigned
int
>
(
i
);
}
}
}
}
void
BinMapper
::
SaveBinaryToFile
(
BinaryWriter
*
writer
)
const
{
void
BinMapper
::
SaveBinaryToFile
(
BinaryWriter
*
writer
)
const
{
writer
->
AlignedWrite
(
&
num_bin_
,
sizeof
(
num_bin_
));
writer
->
AlignedWrite
(
&
missing_type_
,
sizeof
(
missing_type_
));
writer
->
AlignedWrite
(
&
is_trivial_
,
sizeof
(
is_trivial_
));
...
...
@@ -580,9 +582,9 @@ namespace LightGBM {
}
else
{
writer
->
Write
(
bin_2_categorical_
.
data
(),
sizeof
(
int
)
*
num_bin_
);
}
}
}
size_t
BinMapper
::
SizesInByte
()
const
{
size_t
BinMapper
::
SizesInByte
()
const
{
size_t
ret
=
VirtualFileWriter
::
AlignedSize
(
sizeof
(
num_bin_
))
+
VirtualFileWriter
::
AlignedSize
(
sizeof
(
missing_type_
))
+
VirtualFileWriter
::
AlignedSize
(
sizeof
(
is_trivial_
))
+
...
...
@@ -597,22 +599,22 @@ namespace LightGBM {
ret
+=
sizeof
(
int
)
*
num_bin_
;
}
return
ret
;
}
}
template
class
DenseBin
<
uint8_t
,
true
>;
template
class
DenseBin
<
uint8_t
,
false
>;
template
class
DenseBin
<
uint16_t
,
false
>;
template
class
DenseBin
<
uint32_t
,
false
>;
template
class
DenseBin
<
uint8_t
,
true
>;
template
class
DenseBin
<
uint8_t
,
false
>;
template
class
DenseBin
<
uint16_t
,
false
>;
template
class
DenseBin
<
uint32_t
,
false
>;
template
class
SparseBin
<
uint8_t
>;
template
class
SparseBin
<
uint16_t
>;
template
class
SparseBin
<
uint32_t
>;
template
class
SparseBin
<
uint8_t
>;
template
class
SparseBin
<
uint16_t
>;
template
class
SparseBin
<
uint32_t
>;
template
class
MultiValDenseBin
<
uint8_t
>;
template
class
MultiValDenseBin
<
uint16_t
>;
template
class
MultiValDenseBin
<
uint32_t
>;
template
class
MultiValDenseBin
<
uint8_t
>;
template
class
MultiValDenseBin
<
uint16_t
>;
template
class
MultiValDenseBin
<
uint32_t
>;
Bin
*
Bin
::
CreateDenseBin
(
data_size_t
num_data
,
int
num_bin
)
{
Bin
*
Bin
::
CreateDenseBin
(
data_size_t
num_data
,
int
num_bin
)
{
if
(
num_bin
<=
16
)
{
return
new
DenseBin
<
uint8_t
,
true
>
(
num_data
);
}
else
if
(
num_bin
<=
256
)
{
...
...
@@ -622,9 +624,9 @@ namespace LightGBM {
}
else
{
return
new
DenseBin
<
uint32_t
,
false
>
(
num_data
);
}
}
}
Bin
*
Bin
::
CreateSparseBin
(
data_size_t
num_data
,
int
num_bin
)
{
Bin
*
Bin
::
CreateSparseBin
(
data_size_t
num_data
,
int
num_bin
)
{
if
(
num_bin
<=
256
)
{
return
new
SparseBin
<
uint8_t
>
(
num_data
);
}
else
if
(
num_bin
<=
65536
)
{
...
...
@@ -632,9 +634,9 @@ namespace LightGBM {
}
else
{
return
new
SparseBin
<
uint32_t
>
(
num_data
);
}
}
}
MultiValBin
*
MultiValBin
::
CreateMultiValBin
(
data_size_t
num_data
,
int
num_bin
,
int
num_feature
,
MultiValBin
*
MultiValBin
::
CreateMultiValBin
(
data_size_t
num_data
,
int
num_bin
,
int
num_feature
,
double
sparse_rate
,
const
std
::
vector
<
uint32_t
>&
offsets
)
{
if
(
sparse_rate
>=
multi_val_bin_sparse_threshold
)
{
const
double
average_element_per_row
=
(
1.0
-
sparse_rate
)
*
num_feature
;
...
...
@@ -643,9 +645,9 @@ namespace LightGBM {
}
else
{
return
CreateMultiValDenseBin
(
num_data
,
num_bin
,
num_feature
,
offsets
);
}
}
}
MultiValBin
*
MultiValBin
::
CreateMultiValDenseBin
(
data_size_t
num_data
,
MultiValBin
*
MultiValBin
::
CreateMultiValDenseBin
(
data_size_t
num_data
,
int
num_bin
,
int
num_feature
,
const
std
::
vector
<
uint32_t
>&
offsets
)
{
...
...
@@ -664,9 +666,9 @@ namespace LightGBM {
}
else
{
return
new
MultiValDenseBin
<
uint32_t
>
(
num_data
,
num_bin
,
num_feature
,
offsets
);
}
}
}
MultiValBin
*
MultiValBin
::
CreateMultiValSparseBin
(
data_size_t
num_data
,
MultiValBin
*
MultiValBin
::
CreateMultiValSparseBin
(
data_size_t
num_data
,
int
num_bin
,
double
estimate_element_per_row
)
{
size_t
estimate_total_entries
=
...
...
@@ -705,10 +707,10 @@ namespace LightGBM {
num_data
,
num_bin
,
estimate_element_per_row
);
}
}
}
}
template
<
>
const
void
*
DenseBin
<
uint8_t
,
false
>::
GetColWiseData
(
template
<
>
const
void
*
DenseBin
<
uint8_t
,
false
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
std
::
vector
<
BinIterator
*>*
bin_iterator
,
...
...
@@ -717,10 +719,10 @@ namespace LightGBM {
*
bit_type
=
8
;
bin_iterator
->
clear
();
return
reinterpret_cast
<
const
void
*>
(
data_
.
data
());
}
}
template
<
>
const
void
*
DenseBin
<
uint16_t
,
false
>::
GetColWiseData
(
template
<
>
const
void
*
DenseBin
<
uint16_t
,
false
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
std
::
vector
<
BinIterator
*>*
bin_iterator
,
...
...
@@ -729,10 +731,10 @@ namespace LightGBM {
*
bit_type
=
16
;
bin_iterator
->
clear
();
return
reinterpret_cast
<
const
void
*>
(
data_
.
data
());
}
}
template
<
>
const
void
*
DenseBin
<
uint32_t
,
false
>::
GetColWiseData
(
template
<
>
const
void
*
DenseBin
<
uint32_t
,
false
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
std
::
vector
<
BinIterator
*>*
bin_iterator
,
...
...
@@ -741,10 +743,10 @@ namespace LightGBM {
*
bit_type
=
32
;
bin_iterator
->
clear
();
return
reinterpret_cast
<
const
void
*>
(
data_
.
data
());
}
}
template
<
>
const
void
*
DenseBin
<
uint8_t
,
true
>::
GetColWiseData
(
template
<
>
const
void
*
DenseBin
<
uint8_t
,
true
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
std
::
vector
<
BinIterator
*>*
bin_iterator
,
...
...
@@ -753,10 +755,10 @@ namespace LightGBM {
*
bit_type
=
4
;
bin_iterator
->
clear
();
return
reinterpret_cast
<
const
void
*>
(
data_
.
data
());
}
}
template
<
>
const
void
*
DenseBin
<
uint8_t
,
false
>::
GetColWiseData
(
template
<
>
const
void
*
DenseBin
<
uint8_t
,
false
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
BinIterator
**
bin_iterator
)
const
{
...
...
@@ -764,10 +766,10 @@ namespace LightGBM {
*
bit_type
=
8
;
*
bin_iterator
=
nullptr
;
return
reinterpret_cast
<
const
void
*>
(
data_
.
data
());
}
}
template
<
>
const
void
*
DenseBin
<
uint16_t
,
false
>::
GetColWiseData
(
template
<
>
const
void
*
DenseBin
<
uint16_t
,
false
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
BinIterator
**
bin_iterator
)
const
{
...
...
@@ -775,10 +777,10 @@ namespace LightGBM {
*
bit_type
=
16
;
*
bin_iterator
=
nullptr
;
return
reinterpret_cast
<
const
void
*>
(
data_
.
data
());
}
}
template
<
>
const
void
*
DenseBin
<
uint32_t
,
false
>::
GetColWiseData
(
template
<
>
const
void
*
DenseBin
<
uint32_t
,
false
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
BinIterator
**
bin_iterator
)
const
{
...
...
@@ -786,10 +788,10 @@ namespace LightGBM {
*
bit_type
=
32
;
*
bin_iterator
=
nullptr
;
return
reinterpret_cast
<
const
void
*>
(
data_
.
data
());
}
}
template
<
>
const
void
*
DenseBin
<
uint8_t
,
true
>::
GetColWiseData
(
template
<
>
const
void
*
DenseBin
<
uint8_t
,
true
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
BinIterator
**
bin_iterator
)
const
{
...
...
@@ -797,10 +799,10 @@ namespace LightGBM {
*
bit_type
=
4
;
*
bin_iterator
=
nullptr
;
return
reinterpret_cast
<
const
void
*>
(
data_
.
data
());
}
}
template
<
>
const
void
*
SparseBin
<
uint8_t
>::
GetColWiseData
(
template
<
>
const
void
*
SparseBin
<
uint8_t
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
std
::
vector
<
BinIterator
*>*
bin_iterator
,
...
...
@@ -811,10 +813,10 @@ namespace LightGBM {
bin_iterator
->
emplace_back
(
new
SparseBinIterator
<
uint8_t
>
(
this
,
0
));
}
return
nullptr
;
}
}
template
<
>
const
void
*
SparseBin
<
uint16_t
>::
GetColWiseData
(
template
<
>
const
void
*
SparseBin
<
uint16_t
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
std
::
vector
<
BinIterator
*>*
bin_iterator
,
...
...
@@ -825,10 +827,10 @@ namespace LightGBM {
bin_iterator
->
emplace_back
(
new
SparseBinIterator
<
uint16_t
>
(
this
,
0
));
}
return
nullptr
;
}
}
template
<
>
const
void
*
SparseBin
<
uint32_t
>::
GetColWiseData
(
template
<
>
const
void
*
SparseBin
<
uint32_t
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
std
::
vector
<
BinIterator
*>*
bin_iterator
,
...
...
@@ -839,10 +841,10 @@ namespace LightGBM {
bin_iterator
->
emplace_back
(
new
SparseBinIterator
<
uint32_t
>
(
this
,
0
));
}
return
nullptr
;
}
}
template
<
>
const
void
*
SparseBin
<
uint8_t
>::
GetColWiseData
(
template
<
>
const
void
*
SparseBin
<
uint8_t
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
BinIterator
**
bin_iterator
)
const
{
...
...
@@ -850,10 +852,10 @@ namespace LightGBM {
*
bit_type
=
8
;
*
bin_iterator
=
new
SparseBinIterator
<
uint8_t
>
(
this
,
0
);
return
nullptr
;
}
}
template
<
>
const
void
*
SparseBin
<
uint16_t
>::
GetColWiseData
(
template
<
>
const
void
*
SparseBin
<
uint16_t
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
BinIterator
**
bin_iterator
)
const
{
...
...
@@ -861,10 +863,10 @@ namespace LightGBM {
*
bit_type
=
16
;
*
bin_iterator
=
new
SparseBinIterator
<
uint16_t
>
(
this
,
0
);
return
nullptr
;
}
}
template
<
>
const
void
*
SparseBin
<
uint32_t
>::
GetColWiseData
(
template
<
>
const
void
*
SparseBin
<
uint32_t
>::
GetColWiseData
(
uint8_t
*
bit_type
,
bool
*
is_sparse
,
BinIterator
**
bin_iterator
)
const
{
...
...
@@ -872,11 +874,11 @@ namespace LightGBM {
*
bit_type
=
32
;
*
bin_iterator
=
new
SparseBinIterator
<
uint32_t
>
(
this
,
0
);
return
nullptr
;
}
}
#ifdef USE_CUDA
template
<
>
const
void
*
MultiValDenseBin
<
uint8_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
#ifdef USE_CUDA
template
<
>
const
void
*
MultiValDenseBin
<
uint8_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
size_t
*
total_size
,
bool
*
is_sparse
,
const
void
**
out_data_ptr
,
...
...
@@ -889,10 +891,10 @@ namespace LightGBM {
*
out_data_ptr
=
nullptr
;
*
data_ptr_bit_type
=
0
;
return
to_return
;
}
}
template
<
>
const
void
*
MultiValDenseBin
<
uint16_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
template
<
>
const
void
*
MultiValDenseBin
<
uint16_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
size_t
*
total_size
,
bool
*
is_sparse
,
const
void
**
out_data_ptr
,
...
...
@@ -906,10 +908,10 @@ namespace LightGBM {
*
out_data_ptr
=
nullptr
;
*
data_ptr_bit_type
=
0
;
return
to_return
;
}
}
template
<
>
const
void
*
MultiValDenseBin
<
uint32_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
template
<
>
const
void
*
MultiValDenseBin
<
uint32_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
size_t
*
total_size
,
bool
*
is_sparse
,
const
void
**
out_data_ptr
,
...
...
@@ -923,10 +925,10 @@ namespace LightGBM {
*
out_data_ptr
=
nullptr
;
*
data_ptr_bit_type
=
0
;
return
to_return
;
}
}
template
<
>
const
void
*
MultiValSparseBin
<
uint16_t
,
uint8_t
>::
GetRowWiseData
(
template
<
>
const
void
*
MultiValSparseBin
<
uint16_t
,
uint8_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
size_t
*
total_size
,
bool
*
is_sparse
,
...
...
@@ -939,10 +941,10 @@ namespace LightGBM {
*
out_data_ptr
=
reinterpret_cast
<
const
uint8_t
*>
(
row_ptr_
.
data
());
*
data_ptr_bit_type
=
16
;
return
to_return
;
}
}
template
<
>
const
void
*
MultiValSparseBin
<
uint16_t
,
uint16_t
>::
GetRowWiseData
(
template
<
>
const
void
*
MultiValSparseBin
<
uint16_t
,
uint16_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
size_t
*
total_size
,
bool
*
is_sparse
,
...
...
@@ -955,10 +957,10 @@ namespace LightGBM {
*
out_data_ptr
=
reinterpret_cast
<
const
uint8_t
*>
(
row_ptr_
.
data
());
*
data_ptr_bit_type
=
16
;
return
to_return
;
}
}
template
<
>
const
void
*
MultiValSparseBin
<
uint16_t
,
uint32_t
>::
GetRowWiseData
(
template
<
>
const
void
*
MultiValSparseBin
<
uint16_t
,
uint32_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
size_t
*
total_size
,
bool
*
is_sparse
,
...
...
@@ -971,10 +973,10 @@ namespace LightGBM {
*
out_data_ptr
=
reinterpret_cast
<
const
uint8_t
*>
(
row_ptr_
.
data
());
*
data_ptr_bit_type
=
16
;
return
to_return
;
}
}
template
<
>
const
void
*
MultiValSparseBin
<
uint32_t
,
uint8_t
>::
GetRowWiseData
(
template
<
>
const
void
*
MultiValSparseBin
<
uint32_t
,
uint8_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
size_t
*
total_size
,
bool
*
is_sparse
,
...
...
@@ -987,10 +989,10 @@ namespace LightGBM {
*
out_data_ptr
=
reinterpret_cast
<
const
uint8_t
*>
(
row_ptr_
.
data
());
*
data_ptr_bit_type
=
32
;
return
to_return
;
}
}
template
<
>
const
void
*
MultiValSparseBin
<
uint32_t
,
uint16_t
>::
GetRowWiseData
(
template
<
>
const
void
*
MultiValSparseBin
<
uint32_t
,
uint16_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
size_t
*
total_size
,
bool
*
is_sparse
,
...
...
@@ -1003,10 +1005,10 @@ namespace LightGBM {
*
out_data_ptr
=
reinterpret_cast
<
const
uint8_t
*>
(
row_ptr_
.
data
());
*
data_ptr_bit_type
=
32
;
return
to_return
;
}
}
template
<
>
const
void
*
MultiValSparseBin
<
uint32_t
,
uint32_t
>::
GetRowWiseData
(
template
<
>
const
void
*
MultiValSparseBin
<
uint32_t
,
uint32_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
size_t
*
total_size
,
bool
*
is_sparse
,
...
...
@@ -1019,10 +1021,10 @@ namespace LightGBM {
*
out_data_ptr
=
reinterpret_cast
<
const
uint8_t
*>
(
row_ptr_
.
data
());
*
data_ptr_bit_type
=
32
;
return
to_return
;
}
}
template
<
>
const
void
*
MultiValSparseBin
<
uint64_t
,
uint8_t
>::
GetRowWiseData
(
template
<
>
const
void
*
MultiValSparseBin
<
uint64_t
,
uint8_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
size_t
*
total_size
,
bool
*
is_sparse
,
...
...
@@ -1035,10 +1037,10 @@ namespace LightGBM {
*
out_data_ptr
=
reinterpret_cast
<
const
uint8_t
*>
(
row_ptr_
.
data
());
*
data_ptr_bit_type
=
64
;
return
to_return
;
}
}
template
<
>
const
void
*
MultiValSparseBin
<
uint64_t
,
uint16_t
>::
GetRowWiseData
(
template
<
>
const
void
*
MultiValSparseBin
<
uint64_t
,
uint16_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
size_t
*
total_size
,
bool
*
is_sparse
,
...
...
@@ -1051,10 +1053,10 @@ namespace LightGBM {
*
out_data_ptr
=
reinterpret_cast
<
const
uint8_t
*>
(
row_ptr_
.
data
());
*
data_ptr_bit_type
=
64
;
return
to_return
;
}
}
template
<
>
const
void
*
MultiValSparseBin
<
uint64_t
,
uint32_t
>::
GetRowWiseData
(
template
<
>
const
void
*
MultiValSparseBin
<
uint64_t
,
uint32_t
>::
GetRowWiseData
(
uint8_t
*
bit_type
,
size_t
*
total_size
,
bool
*
is_sparse
,
...
...
@@ -1067,8 +1069,8 @@ namespace LightGBM {
*
out_data_ptr
=
reinterpret_cast
<
const
uint8_t
*>
(
row_ptr_
.
data
());
*
data_ptr_bit_type
=
64
;
return
to_return
;
}
}
#endif // USE_CUDA
#endif // USE_CUDA
}
// namespace LightGBM
src/io/config.cpp
View file @
548cec82
...
...
@@ -9,7 +9,12 @@
#include <LightGBM/utils/log.h>
#include <LightGBM/utils/random.h>
#include <algorithm>
#include <limits>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
namespace
LightGBM
{
...
...
src/io/config_auto.cpp
View file @
548cec82
...
...
@@ -5,7 +5,13 @@
* \note
* This file is auto generated by LightGBM\.ci\parameter-generator.py from LightGBM\include\LightGBM\config.h file.
*/
#include<LightGBM/config.h>
#include <LightGBM/config.h>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <vector>
namespace
LightGBM
{
const
std
::
unordered_map
<
std
::
string
,
std
::
string
>&
Config
::
alias_table
()
{
static
std
::
unordered_map
<
std
::
string
,
std
::
string
>
aliases
({
...
...
src/io/cuda/cuda_column_data.cpp
View file @
548cec82
...
...
@@ -8,6 +8,7 @@
#include <LightGBM/cuda/cuda_column_data.hpp>
#include <cstdint>
#include <vector>
namespace
LightGBM
{
...
...
src/io/cuda/cuda_metadata.cpp
View file @
548cec82
...
...
@@ -7,6 +7,8 @@
#include <LightGBM/cuda/cuda_metadata.hpp>
#include <vector>
namespace
LightGBM
{
CUDAMetadata
::
CUDAMetadata
(
const
int
gpu_device_id
)
{
...
...
src/io/cuda/cuda_row_data.cpp
View file @
548cec82
...
...
@@ -7,6 +7,8 @@
#include <LightGBM/cuda/cuda_row_data.hpp>
#include <vector>
namespace
LightGBM
{
CUDARowData
::
CUDARowData
(
const
Dataset
*
train_data
,
...
...
src/io/dataset.cpp
View file @
548cec82
...
...
@@ -11,21 +11,25 @@
#include <LightGBM/utils/openmp_wrapper.h>
#include <LightGBM/utils/threading.h>
#include <algorithm>
#include <chrono>
#include <cstdio>
#include <limits>
#include <memory>
#include <sstream>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
namespace
LightGBM
{
const
int
Dataset
::
kSerializedReferenceVersionLength
=
2
;
const
char
*
Dataset
::
serialized_reference_version
=
"v1"
;
const
char
*
Dataset
::
binary_file_token
=
"______LightGBM_Binary_File_Token______
\n
"
;
const
char
*
Dataset
::
binary_serialized_reference_token
=
"______LightGBM_Binary_Serialized_Token______
\n
"
;
const
char
*
Dataset
::
binary_file_token
=
"______LightGBM_Binary_File_Token______
\n
"
;
const
char
*
Dataset
::
binary_serialized_reference_token
=
"______LightGBM_Binary_Serialized_Token______
\n
"
;
Dataset
::
Dataset
()
{
data_filename_
=
"noname"
;
...
...
src/io/dataset_loader.cpp
View file @
548cec82
...
...
@@ -10,8 +10,15 @@
#include <LightGBM/utils/log.h>
#include <LightGBM/utils/openmp_wrapper.h>
#include <algorithm>
#include <chrono>
#include <fstream>
#include <memory>
#include <string>
#include <unordered_map>
#include <unordered_set>
#include <utility>
#include <vector>
namespace
LightGBM
{
...
...
src/io/dense_bin.hpp
View file @
548cec82
...
...
@@ -3,8 +3,8 @@
* Licensed under the MIT License. See LICENSE file in the project root for
* license information.
*/
#ifndef LIGHTGBM_IO_DENSE_BIN_HPP_
#define LIGHTGBM_IO_DENSE_BIN_HPP_
#ifndef LIGHTGBM_
SRC_
IO_DENSE_BIN_HPP_
#define LIGHTGBM_
SRC_
IO_DENSE_BIN_HPP_
#include <LightGBM/bin.h>
#include <LightGBM/cuda/vector_cudahost.h>
...
...
@@ -646,4 +646,4 @@ BinIterator* DenseBin<VAL_T, IS_4BIT>::GetIterator(
}
}
// namespace LightGBM
#endif // L
ightGBM
_IO_DENSE_BIN_HPP_
#endif // L
IGHTGBM_SRC
_IO_DENSE_BIN_HPP_
src/io/file_io.cpp
View file @
548cec82
...
...
@@ -8,7 +8,10 @@
#include <LightGBM/utils/log.h>
#include <algorithm>
#include <cstdio>
#include <memory>
#include <sstream>
#include <string>
#include <unordered_map>
namespace
LightGBM
{
...
...
src/io/json11.cpp
View file @
548cec82
...
...
@@ -27,6 +27,10 @@
#include <cstdio>
#include <cstdlib>
#include <limits>
#include <memory>
#include <string>
#include <utility>
#include <vector>
namespace
json11_internal_lightgbm
{
...
...
src/io/metadata.cpp
View file @
548cec82
...
...
@@ -7,6 +7,7 @@
#include <set>
#include <string>
#include <unordered_map>
#include <vector>
namespace
LightGBM
{
...
...
src/io/multi_val_dense_bin.hpp
View file @
548cec82
...
...
@@ -2,8 +2,8 @@
* Copyright (c) 2020 Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE file in the project root for license information.
*/
#ifndef LIGHTGBM_IO_MULTI_VAL_DENSE_BIN_HPP_
#define LIGHTGBM_IO_MULTI_VAL_DENSE_BIN_HPP_
#ifndef LIGHTGBM_
SRC_
IO_MULTI_VAL_DENSE_BIN_HPP_
#define LIGHTGBM_
SRC_
IO_MULTI_VAL_DENSE_BIN_HPP_
#include <LightGBM/bin.h>
#include <LightGBM/utils/openmp_wrapper.h>
...
...
@@ -356,4 +356,4 @@ MultiValDenseBin<VAL_T>* MultiValDenseBin<VAL_T>::Clone() {
}
// namespace LightGBM
#endif // LIGHTGBM_IO_MULTI_VAL_DENSE_BIN_HPP_
#endif // LIGHTGBM_
SRC_
IO_MULTI_VAL_DENSE_BIN_HPP_
Prev
1
2
3
4
5
6
7
8
9
10
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment