Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Francesco Brarda
stan-math-petsc
Commits
d291281c
Unverified
Commit
d291281c
authored
6 years ago
by
Steve Bronder
Browse files
Options
Download
Plain Diff
Merge branch 'gpu_matrix_multiply' of
https://github.com/bstatcomp/math
into gpu_matrix_multiply
parents
f0f5b8fa
d413f207
stan-petsc
bugfix/1063-std-lgamma
bugfix/1152-algebra_solver-lambdas
bugfix/issue-1250-lgamma
bugfix/issue-1270-add-check-for-meta-includes
bugfix/issue-2708-map-rect-fail
build/config-device-id
code-cleanup/chain-final
code-cleanup/issue-937-flatten
develop
feature/1258-ad-test-core
feature/adjoint-ode
feature/automatic-autodiff-testing
feature/concept-chainable-allocator
feature/daniel-windows
feature/eigen-aligned-malloc
feature/faster-ad-tls
feature/faster-ad-tls-v2
feature/faster-ad-tls-v3
feature/faster-ad-tls-v4
feature/faster-ad-tls-v4-windows
feature/faster-ad-tls-v6
feature/intel-tbb-lib
feature/issue-1012-binorm-copula-cdf
feature/issue-1115-newton_solver
feature/issue-123-complex
feature/issue-1257-diff_algebra_solver
feature/issue-38-multi_normal_sufficient
feature/issue-755-laplace
feature/issue-838-linseq
feature/issue-937-flatten-meta-again
feature/issue-937-flatten-meta-the-third
feature/issue-937-flatten-meta-third
feature/issue-962-bivar-norm
feature/issue-989-rev-mat-eig
feature/lambertw
feature/map_rect-cpp17
feature/map_rect-fail-windows
feature/matrix_sqrt
feature/openMP
feature/parallel_for_each
feature/python-test-math-dependencies
feature/refactor-nested
feature/sparse-cholesky
gpu_matrix_multiply
gpu_performance_tests
internal/no-assert
issue-static-init-order
master
mpi_errors
parallel-ad-tape-3
release/v2.19.0
release/v2.19.1
release/v2.20.0
seantest/faster-ad-tls-v3
stancon/syclik
syclik/forward-mode
v2.20.0
v2.19.1
v2.19.0
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
make/libraries
+1
-1
make/libraries
stan/math/gpu/kernel_cl.hpp
+2
-2
stan/math/gpu/kernel_cl.hpp
stan/math/prim/arr/fun/sum.hpp
+2
-6
stan/math/prim/arr/fun/sum.hpp
stan/math/prim/mat/fun/sum.hpp
+1
-1
stan/math/prim/mat/fun/sum.hpp
test/unit/math/prim/mat/fun/sum_test.cpp
+13
-0
test/unit/math/prim/mat/fun/sum_test.cpp
with
19 additions
and
10 deletions
+19
-10
make/libraries
View file @
d291281c
...
...
@@ -77,7 +77,7 @@ $(BOOST)/user-config.jam:
$(BOOST_LIB)/mpi.so: $(BOOST)/user-config.jam
@mkdir -p $(dir $@)
cd $(BOOST); ./bootstrap.sh
cd $(BOOST); ./b2 --user-config=user-config.jam --layout=system --with-mpi --with-serialization -j$(BOOST_PARALLEL_BUILD) variant=release link=shared threading=multi runtime-link=shared
cd $(BOOST); ./b2 --user-config=user-config.jam --layout=system --with-mpi --with-serialization -j$(BOOST_PARALLEL_BUILD) variant=release link=shared threading=multi runtime-link=shared
hardcode-dll-paths=true dll-path="$(BOOST_LIB_ABS)"
$(BOOST_LIB)/libboost_serialization.so: $(BOOST_LIB)/mpi.so
...
...
This diff is collapsed.
Click to expand it.
stan/math/gpu/kernel_cl.hpp
View file @
d291281c
...
...
@@ -81,7 +81,7 @@ class kernel_functor {
* functor to access the kernel compiler.
* @param name The name for the kernel.
* @param source A string literal containing the code for the kernel.
* @param options The values of macros to be passed at compile time.
* @param options The values of macros to be passed at compile time.
*/
kernel_functor
(
const
char
*
name
,
const
char
*
source
,
std
::
map
<
const
char
*
,
int
>
options
)
...
...
@@ -135,7 +135,7 @@ struct local_range_kernel {
* Creates kernels that only need access to defining the global work size.
* @param name The name for the kernel
* @param source A string literal containing the code for the kernel.
* @param options The values of macros to be passed at compile time.
* @param options The values of macros to be passed at compile time.
*/
local_range_kernel
(
const
char
*
name
,
const
char
*
source
,
std
::
map
<
const
char
*
,
int
>
options
=
{{
"NO_OPT"
,
0
}})
...
...
This diff is collapsed.
Click to expand it.
stan/math/prim/arr/fun/sum.hpp
View file @
d291281c
...
...
@@ -3,6 +3,7 @@
#include <cstddef>
#include <vector>
#include <numeric>
namespace
stan
{
namespace
math
{
...
...
@@ -16,12 +17,7 @@ namespace math {
*/
template
<
typename
T
>
inline
T
sum
(
const
std
::
vector
<
T
>&
xs
)
{
if
(
xs
.
size
()
==
0
)
return
0
;
T
sum
(
xs
[
0
]);
for
(
size_t
i
=
1
;
i
<
xs
.
size
();
++
i
)
sum
+=
xs
[
i
];
return
sum
;
return
std
::
accumulate
(
xs
.
begin
(),
xs
.
end
(),
T
{
0
});
}
}
// namespace math
...
...
This diff is collapsed.
Click to expand it.
stan/math/prim/mat/fun/sum.hpp
View file @
d291281c
...
...
@@ -19,7 +19,7 @@ namespace math {
* @return Sum of coefficients of vector.
*/
template
<
typename
T
,
int
R
,
int
C
>
inline
double
sum
(
const
Eigen
::
Matrix
<
T
,
R
,
C
>&
v
)
{
inline
T
sum
(
const
Eigen
::
Matrix
<
T
,
R
,
C
>&
v
)
{
return
v
.
sum
();
}
...
...
This diff is collapsed.
Click to expand it.
test/unit/math/prim/mat/fun/sum_test.cpp
View file @
d291281c
#include <stan/math/prim/mat.hpp>
#include <gtest/gtest.h>
#include <test/unit/util.hpp>
#include <type_traits>
#include <vector>
TEST
(
MathMatrix
,
sumVector
)
{
using
Eigen
::
Dynamic
;
...
...
@@ -54,3 +57,13 @@ TEST(MathMatrix, sumMatrix) {
m
<<
1
,
2
,
3
,
4
,
5
,
6
;
EXPECT_FLOAT_EQ
(
21.0
,
sum
(
m
));
}
template
<
typename
T
>
using
sum_return_t
=
decltype
(
stan
::
math
::
sum
(
std
::
declval
<
T
>
()));
TEST
(
MathMatrix
,
sumIsTemplated
)
{
using
Eigen
::
Matrix
;
test
::
expect_same_type
<
int
,
sum_return_t
<
Matrix
<
int
,
2
,
3
>>>
();
test
::
expect_same_type
<
double
,
sum_return_t
<
Matrix
<
double
,
4
,
2
>>>
();
test
::
expect_same_type
<
float
,
sum_return_t
<
std
::
vector
<
float
>>>
();
}
This diff is collapsed.
Click to expand it.
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
Menu
Projects
Groups
Snippets
Help