-
-
Notifications
You must be signed in to change notification settings - Fork 188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/issue 202 vectorize all #276
Conversation
…re/issue-202-vectorize-all
…re/issue-202-vectorize-all
…stan-dev/math into feature/issue-202-vectorize-all
…re/issue-202-vectorize-all
That submissions checklist is supposed to be the pre-submission checklist! |
And it needs the model tests. The tests aren't even complete yet. Maybe you want to remove this pull request until it's complete. |
The model tests will need to be in the Stan library. (Bob, this is related to how we deal with a new feature across repos.) On Fri, Apr 1, 2016 at 12:59 PM, Bob Carpenter [email protected]
|
Okay. I'm closing the pull request and reopen it when it has everything. |
I ran all unit tests and make cpplint. There's one build/include error from the make cpplint report, but when I looked through an old thread on the Stan-dev discussion group, it sounded like Jenkins could help me better understand the report. |
Jenkins won't help you with cpplint (unless it shows up in What is the error? If it's the standard libraries at the
|
Jenkins actually helped. I accidentally included |
It looks like the current problem is with a compiler error: You need to include cmath in order for that to be fixed. On Sun, Apr 3, 2016 at 11:39 PM, rayleigh [email protected] wrote:
|
…re/issue-202-vectorize-all
Is this ready to merge or if not, what's left to test? |
I made the changes that you suggested. I want to note that I moved the function |
|
||
/** | ||
* This is the structure for testing mock function acos (defined in the | ||
* testing framework). See README.txt for more instructions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rayleigh we need to remove README.txt, along with all the references to the README
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay. I got a chance to work on it today and made those changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does anyone still need me to code review this again?
I'm traveling and pretty booked this week.
- Bob
On Jun 27, 2016, at 8:24 AM, rayleigh [email protected] wrote:
In test/unit/math/mix/mat/fun/acos_test.cpp:
@@ -0,0 +1,97 @@
+#include <stan/math/mix/mat.hpp>
+#include <gtest/gtest.h>
+#include <test/unit/math/prim/mat/vectorize/prim_scalar_unary_test.hpp>
+#include <test/unit/math/rev/mat/vectorize/rev_scalar_unary_test.hpp>
+#include <test/unit/math/fwd/mat/vectorize/fwd_scalar_unary_test.hpp>
+#include <test/unit/math/mix/mat/vectorize/mix_scalar_unary_test.hpp>
+#include <stan/math/prim/mat/fun/acos.hpp>
+#include <test/unit/math/prim/mat/vectorize/vector_builder.hpp>
+
+/**
- * This is the structure for testing mock function acos (defined in the
- * testing framework). See README.txt for more instructions.
Okay. I got a chance to work on it today and made those changes.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
…re/issue-202-vectorize-all
I know that I haven't been pushing this, but is there anything else that I need to do? I know that there are a few future issues, but I've changed the text, updated the rev arr util.hpp, and marked tests where both expected and test values are NaN as success. |
One thing I haven't seen yet is how this performs for the univariate functions pre and post. Unless I've missed it. If so, can you repost? I'm actually concerned about that.
|
Daniel, what part of the univariate function performance are you concerned about? |
Wall time. I just want to make sure we're not going to take a significant performance hit for the existing univariate functions.
|
I see. I didn't measure that because I wasn't aware that I needed to, but looking at However, the vectorize code is essentially putting the univariate function within a for loop. There is no optimization within the vectorize code itself because I believe this project is to make the univariate functions easier to use when writing Stan code. |
Everything should get compiled away through the templates Do I need to review more code at this point?
|
If If we want to test performance, what scenarios should I test these functions in? For instance, if my function is foo, would I need to run the following tests before and after vectorization:
|
If you want to be thorough, look at log() applied to T in {var, double} for
We didn't have any higher-order vectorization than that and It doesn't need to be elaborate or checked in. Also, did all the non-C++ files get removed?
|
I believe that all the non-C++ files got removed. As for speed tests, I didn't suggest any vectorizations because for many of the univariate functions, there wasn't a vectorized version. So, what would I use to get the pre-vectorization results? |
I just want to make sure the univariate functions for double and var are I'd start simple:
If those show no increase in speed, I'm happy to believe that the compilers On Tue, Jul 5, 2016 at 9:10 PM, rayleigh [email protected] wrote:
|
Daniel just wants to make sure that things aren't So just run a Stan program in the develop branch and
P.S. I'm off to Ann Arbor next Thursday! Side trip from |
Yes, I was suggesting just doing the log() function. T for T in {double, var}
|
I think we're good. @rayleigh timed a couple functions and it looked like there were no surprises (which is great!). |
Jenkins, retest this please. |
Submisison Checklist
./runTests.py test/unit
make cpplint
Summary:
Vectorization of unary functions and tests of these vectorizations
Intended Effect:
This will add vectorized unary functions and their tests.
How to Verify:
Run unit tests
Side Effects:
Updated the existing testing vectorizing framework to skip tests if the expected value and test value are both NaN. The example function foo_fun now returns NaN for 0.
Added the appropriate
apply_scalar_unary
function tostan/math/prim/mat.hpp
,stan/math/rev/mat.hpp
, andstan/math/fwd/mat.hpp
. All tests instan/math/mix/scal/fun
andtest/unit/math/mix/scal/prob/normal_test.cpp
were updated to includestan/math/mix/mat.hpp
so that they wouldn't error out.Documentation:
I have documented the code of the vectorized functions, but I don't think it's fully user-facing yet.
Reviewer Suggestions:
Copyright and Licensing
Please list the copyright holder for the work you are submitting (this will be you or your assignee, such as a university or company):
Rayleigh
By submitting this pull request, the copyright holder is agreeing to license the submitted work under the following licenses: