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
ad025518
"vscode:/vscode.git/clone" did not exist on "fc383361b771828b7871bc6fbeca8970a4d891fe"
Unverified
Commit
ad025518
authored
Oct 08, 2023
by
James Lamb
Committed by
GitHub
Oct 08, 2023
Browse files
remove unnecessary allocations in HistogramSumReducer (#6132)
parent
f901f471
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
4 deletions
+2
-4
include/LightGBM/bin.h
include/LightGBM/bin.h
+2
-4
No files found.
include/LightGBM/bin.h
View file @
ad025518
...
...
@@ -63,8 +63,7 @@ inline static void Int32HistogramSumReducer(const char* src, char* dst, int type
const
int64_t
*
src_ptr
=
reinterpret_cast
<
const
int64_t
*>
(
src
);
int64_t
*
dst_ptr
=
reinterpret_cast
<
int64_t
*>
(
dst
);
const
comm_size_t
steps
=
(
len
+
(
type_size
*
2
)
-
1
)
/
(
type_size
*
2
);
const
int
num_threads
=
OMP_NUM_THREADS
();
#pragma omp parallel for schedule(static) num_threads(num_threads)
#pragma omp parallel for schedule(static) num_threads(OMP_NUM_THREADS())
for
(
comm_size_t
i
=
0
;
i
<
steps
;
++
i
)
{
dst_ptr
[
i
]
+=
src_ptr
[
i
];
}
...
...
@@ -74,8 +73,7 @@ inline static void Int16HistogramSumReducer(const char* src, char* dst, int type
const
int32_t
*
src_ptr
=
reinterpret_cast
<
const
int32_t
*>
(
src
);
int32_t
*
dst_ptr
=
reinterpret_cast
<
int32_t
*>
(
dst
);
const
comm_size_t
steps
=
(
len
+
(
type_size
*
2
)
-
1
)
/
(
type_size
*
2
);
const
int
num_threads
=
OMP_NUM_THREADS
();
#pragma omp parallel for schedule(static) num_threads(num_threads)
#pragma omp parallel for schedule(static) num_threads(OMP_NUM_THREADS())
for
(
comm_size_t
i
=
0
;
i
<
steps
;
++
i
)
{
dst_ptr
[
i
]
+=
src_ptr
[
i
];
}
...
...
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