Skip to content

Feature/1854 OpenCL /prim signatures part 2 - #1869

Merged
rok-cesnovar merged 70 commits into
developfrom
feature/1854-opencl-prim-pt2
May 12, 2020
Merged

rok-cesnovar merged 70 commits into
developfrom
feature/1854-opencl-prim-pt2

Conversation

@rok-cesnovar

@rok-cesnovar rok-cesnovar commented May 6, 2020 •

Copy link
Copy Markdown
Member

Summary

This PR builds on #1859 and does the following changes to the /prim support in OpenCL:

  • renames elewise_multiplication/elewise_division to elt_multiply/elt_divide
  • adds crossprod, tcrossprod, fabs, log1m_inv_logit, logit, divide, trunc

Tests

All new functions have tests.

Side Effects

/

Release notes

Renamed elewise_multiplication/elewise_division to elt_multiply/elt_divide in the kernel generator and added OpenCL support to /prim functions crossprod, tcrossprod, fabs, log1m_inv_logit, logit, divide

Checklist

  • Math issue Implement matrix_cl overloads for prim & rev functions #1854

  • Copyright holder: Rok Češnovar

    The copyright holder is typically you or your assignee, such as a university or company. By submitting this pull request, the copyright holder is agreeing to the license the submitted work under the following licenses:
    - Code: BSD 3-clause (https://opensource.org/licenses/BSD-3-Clause)
    - Documentation: CC-BY 4.0 (https://creativecommons.org/licenses/by/4.0/)

  • the basic tests are passing

    • unit tests pass (to run, use: ./runTests.py test/unit)
    • header checks pass, (make test-headers)
    • dependencies checks pass, (make test-math-dependencies)
    • docs build, (make doxygen)
    • code passes the built in C++ standards checks (make cpplint)
  • the code is written in idiomatic C++ and changes are documented in the doxygen

  • the new changes are tested

@rok-cesnovar
rok-cesnovar changed the base branch from develop to feature/1854-opencl-prim-pt1 May 6, 2020 17:46
@rok-cesnovar
rok-cesnovar changed the base branch from feature/1854-opencl-prim-pt1 to develop May 6, 2020 17:47
@stan-buildbot

Copy link
Copy Markdown
Contributor

Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 5.1 5.07 1.01 0.55% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.96 -4.05% slower
eight_schools/eight_schools.stan 0.09 0.09 1.02 1.56% faster
gp_regr/gp_regr.stan 0.23 0.23 1.0 -0.44% slower
irt_2pl/irt_2pl.stan 6.42 6.43 1.0 -0.07% slower
performance.compilation 85.72 84.28 1.02 1.68% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 7.56 7.54 1.0 0.26% faster
pkpd/one_comp_mm_elim_abs.stan 20.23 20.23 1.0 0.01% faster
sir/sir.stan 94.46 91.33 1.03 3.31% faster
gp_regr/gen_gp_data.stan 0.05 0.06 0.75 -32.81% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.98 2.98 1.0 0.13% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.33 0.33 1.0 -0.18% slower
arK/arK.stan 1.76 1.76 1.0 -0.24% slower
arma/arma.stan 0.77 0.76 1.0 0.36% faster
garch/garch.stan 0.57 0.57 1.0 0.48% faster
Mean result: 0.985982781842

Jenkins Console Log
Blue Ocean
Commit hash: f07d07a


Machine information ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010

CPU:
Intel(R) Xeon(R) CPU E5-1680 v2 @ 3.00GHz

G++:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

Clang:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

# Conflicts:
#	stan/math/opencl/kernel_generator/binary_operation.hpp
#	stan/math/opencl/kernel_generator/unary_function_cl.hpp
#	stan/math/opencl/opencl.hpp
#	stan/math/opencl/prim/inv.hpp
@stan-buildbot

Copy link
Copy Markdown
Contributor

Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 5.23 5.02 1.04 4.01% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 1.0 -0.38% slower
eight_schools/eight_schools.stan 0.09 0.09 1.01 0.99% faster
gp_regr/gp_regr.stan 0.23 0.23 1.0 0.46% faster
irt_2pl/irt_2pl.stan 6.44 6.44 1.0 0.04% faster
performance.compilation 85.38 84.3 1.01 1.27% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 7.56 7.54 1.0 0.21% faster
pkpd/one_comp_mm_elim_abs.stan 20.46 20.36 1.0 0.48% faster
sir/sir.stan 92.95 91.15 1.02 1.93% faster
gp_regr/gen_gp_data.stan 0.05 0.05 0.98 -1.69% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.98 2.99 1.0 -0.41% slower
pkpd/sim_one_comp_mm_elim_abs.stan 0.32 0.31 1.01 1.47% faster
arK/arK.stan 1.75 1.74 1.01 0.63% faster
arma/arma.stan 0.76 0.77 0.99 -1.28% slower
garch/garch.stan 0.57 0.57 1.0 0.41% faster
Mean result: 1.00563198549

Jenkins Console Log
Blue Ocean
Commit hash: 25aaf89


Machine information ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010

CPU:
Intel(R) Xeon(R) CPU E5-1680 v2 @ 3.00GHz

G++:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

Clang:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

@stan-buildbot

Copy link
Copy Markdown
Contributor

Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 5.34 5.07 1.05 5.04% faster
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 1.0 0.01% faster
eight_schools/eight_schools.stan 0.09 0.09 1.0 0.07% faster
gp_regr/gp_regr.stan 0.22 0.23 0.98 -1.75% slower
irt_2pl/irt_2pl.stan 6.44 6.43 1.0 0.14% faster
performance.compilation 85.58 84.35 1.01 1.45% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 7.55 7.56 1.0 -0.06% slower
pkpd/one_comp_mm_elim_abs.stan 21.01 19.89 1.06 5.32% faster
sir/sir.stan 93.91 93.16 1.01 0.8% faster
gp_regr/gen_gp_data.stan 0.05 0.05 0.98 -1.79% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 2.98 2.98 1.0 -0.04% slower
pkpd/sim_one_comp_mm_elim_abs.stan 0.32 0.33 0.95 -4.91% slower
arK/arK.stan 1.76 1.75 1.0 0.31% faster
arma/arma.stan 0.76 0.77 1.0 -0.45% slower
garch/garch.stan 0.57 0.57 1.0 -0.36% slower
Mean result: 1.00310876635

Jenkins Console Log
Blue Ocean
Commit hash: 25aaf89


Machine information ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010

CPU:
Intel(R) Xeon(R) CPU E5-1680 v2 @ 3.00GHz

G++:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

Clang:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

@rok-cesnovar

Copy link
Copy Markdown
Member Author

This is ready for review.

@t4c1 t4c1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is missing an issue.

Comment thread stan/math/opencl/prim/crossprod.hpp Resolved
Comment thread stan/math/opencl/prim/crossprod.hpp Resolved
Comment thread stan/math/opencl/prim/divide.hpp Resolved
Comment thread stan/math/opencl/prim/divide.hpp Resolved
Comment thread stan/math/opencl/prim/tcrossprod.hpp Resolved
@rok-cesnovar
rok-cesnovar requested a review from t4c1 May 12, 2020 08:19
t4c1
t4c1 previously approved these changes May 12, 2020

@t4c1 t4c1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Optionally we can replace auto return type with explicitly specified types on functions that return matrices.

Comment thread stan/math/opencl/prim/crossprod.hpp Resolved
Comment thread stan/math/opencl/prim/tcrossprod.hpp Resolved
Co-authored-by: Tadej Ciglarič <tadej.c@gmail.com>
@rok-cesnovar
rok-cesnovar merged commit 17a67ad into develop May 12, 2020
@rok-cesnovar
rok-cesnovar deleted the feature/1854-opencl-prim-pt2 branch May 12, 2020 17:44
@stan-buildbot

Copy link
Copy Markdown
Contributor

Name Old Result New Result Ratio Performance change( 1 - new / old )
gp_pois_regr/gp_pois_regr.stan 5.06 5.1 0.99 -0.76% slower
low_dim_corr_gauss/low_dim_corr_gauss.stan 0.02 0.02 0.98 -2.33% slower
eight_schools/eight_schools.stan 0.09 0.09 0.97 -2.9% slower
gp_regr/gp_regr.stan 0.23 0.22 1.02 1.48% faster
irt_2pl/irt_2pl.stan 6.6 6.56 1.01 0.62% faster
performance.compilation 85.58 84.44 1.01 1.33% faster
low_dim_gauss_mix_collapse/low_dim_gauss_mix_collapse.stan 7.69 7.72 1.0 -0.4% slower
pkpd/one_comp_mm_elim_abs.stan 20.39 20.0 1.02 1.9% faster
sir/sir.stan 95.98 94.82 1.01 1.21% faster
gp_regr/gen_gp_data.stan 0.05 0.05 0.97 -3.21% slower
low_dim_gauss_mix/low_dim_gauss_mix.stan 3.01 3.0 1.0 0.04% faster
pkpd/sim_one_comp_mm_elim_abs.stan 0.32 0.32 1.01 1.29% faster
arK/arK.stan 1.83 1.85 0.99 -0.64% slower
arma/arma.stan 0.82 0.82 1.0 -0.47% slower
garch/garch.stan 0.56 0.56 1.0 -0.35% slower
Mean result: 0.998113669461

Jenkins Console Log
Blue Ocean
Commit hash: fbfdb73


Machine information ProductName: Mac OS X ProductVersion: 10.11.6 BuildVersion: 15G22010

CPU:
Intel(R) Xeon(R) CPU E5-1680 v2 @ 3.00GHz

G++:
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

Clang:
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.6.0
Thread model: posix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants