-
Notifications
You must be signed in to change notification settings - Fork 21
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
Develop #25
base: develop
Are you sure you want to change the base?
Develop #25
Conversation
Olá Juan, thanks for this PR. I see a lot of files in your request. Could you reconfigure the PR and push only your contribution? Cheers |
Hi Augusto,
OK, I'll do the modifications and do the PR again.
Att, Juan Leite
…________________________________
From: Antonio Augusto Alves Junior <[email protected]>
Sent: Saturday, March 10, 2018 9:55 AM
To: MultithreadCorner/Hydra
Cc: JuanBSLeite; Author
Subject: Re: [MultithreadCorner/Hydra] Develop (#25)
Olá Juan, thanks for this PR.
I see a lot of files in your request. Could you reconfigure the PR and push only your contribution?
The file implementing the Flatté. Ideally, please, implement the line-shape in a header file ".h" (as you already did) and add some documentation citing also a reference from where you got the formulae. Then provide one or two examples placed in the folder "examples/phys" and add the target(s) to "examples/phys/CMakeList.txt". Creating the examples/NIPS_HYDRA is not necessary. There are some .xml files, and a .idea subdirectory, I suppose from your IDE (CLION ?). Please exclude then. Change fDaughter3Mass and the corresponding getter/setter members to fBachelorMass. I discovered recently that it keep as fDaughter3Mass can be painfully misleading...
Cheers
A.A.
.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FMultithreadCorner%2FHydra%2Fpull%2F25%23issuecomment-372017942&data=02%7C01%7C%7C86e7b326eb59473c2bcc08d5866d1c38%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636562725538406478&sdata=V0KmABLKemOmLQlDDpQysW%2BMGi0aXn9H9l5I%2Bf216dA%3D&reserved=0>, or mute the thread<https://eur02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAiFoIb5NLuZBC4v1uQXCJaE4Cz8PpNpCks5tc6MlgaJpZM4SkkVn&data=02%7C01%7C%7C86e7b326eb59473c2bcc08d5866d1c38%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636562725538406478&sdata=x0jYy8MIeIhjk1Hk0igKEF7yBAK8sswnPtdHK7qNgFU%3D&reserved=0>.
|
Hi Augusto, I did the changes you said and updated my fork. I'll do the new PR now. |
The PR gets updated automatically based on your branch (including master); on Monday I can show you how to squash and clean your commit history if you'd like. |
Hi Juan, thanks. |
CMakeLists.txt
Outdated
|
||
if(Minuit2_FOUND) | ||
add_subdirectory(examples/phys) |
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.
All examples in the directory '''phys''' depends on Minuit2.
You need to put it inside the guards ''' if(Minuit2_FOUND) ... endif(Minuit2_FOUND)'''
examples/phys/FlatteLineShape.inl
Outdated
@@ -350,7 +350,7 @@ int main(int argv, char** argc) | |||
|
|||
double f0_MASS = 0.965; | |||
double f0_MAG = 12.341; | |||
double f0_Phase = -62.852*(M_PI / 180) ; |
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.
Document the numerical values, please.
examples/phys/FlatteLineShape.inl
Outdated
@@ -350,7 +350,7 @@ int main(int argv, char** argc) | |||
|
|||
double f0_MASS = 0.965; | |||
double f0_MAG = 12.341; | |||
double f0_Phase = -62.852*(M_PI / 180) ; | |||
double f0_Phase = -62.852*(M_PI / 180) +M_PI; |
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.
The primary documentation of code, is the code itself. So, please enforce double precision syntax where you are using it. For example '''180''' -> '''180.0'''
examples/phys/FlatteLineShape.inl
Outdated
|
||
auto coef_ref0 = hydra::Parameter::Create().Name("f0_RC").Value(f0_RC).Error(0.0001); | ||
auto coef_imf0 = hydra::Parameter::Create().Name("f0_IM").Value(f0_IMC).Error(0.0001); | ||
auto coef_ref0 = hydra::Parameter::Create().Name("f0_RC").Value(f0_RC).Error(0.0001).Limits(-100,100); |
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.
Define the limits in the parameters in terms of the nominal values in the parameters.
hydra/functions/FlatteLineShape.h
Outdated
@@ -218,9 +218,9 @@ namespace hydra { | |||
|
|||
|
|||
if(s >= twopimasssq) | |||
rhopipi_real = (2. / 3) * TMath::Sqrt(1 - twopimasssq / s ); // Above pi+pi- threshold | |||
rhopipi_real = (2. / 3) * ::sqrt(1 - twopimasssq / s ); // Above pi+pi- threshold |
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.
This whole piece of code could generate branching and does unnecessary variable redefinition, which makes execution slow down on gpus. I consider a defect of C++ that variables are not default const
, like in Rust, but this is another discussion. The code is also confusing. So deploy Boolean arithmetic here. Example:
instead to write
if(condition) x = a+b;
else x=a-b;
write (1 line !)
x = a + (condition==true) *(b) - (condition!=true) *(b)
and so on...
Please, reflect about this.
hydra/functions/FlatteLineShape.h
Outdated
else | ||
rhopipi_imag = (2. / 3) * TMath::Sqrt(-1 + twopimasssq / s); | ||
rhopipi_imag = (2. / 3) * ::sqrt(-1 + twopimasssq / s); |
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.
idem...
Hi Juan, thanks. |
hydra/functions/FlatteLineShape.h
Outdated
@@ -223,19 +223,19 @@ namespace hydra { | |||
rhopipi_imag = (2. / 3) * ::sqrt(-1 + twopimasssq / s); |
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.
Please, try to eliminate the if/else
instructions using boolean arithmetic. Avoid value.
, enforce value.0
.
One more point, I forgot to comment previously. The |
hydra/functions/FlatteLineShape.h
Outdated
@@ -78,11 +79,13 @@ namespace hydra { | |||
* @param daugther3_mass daughter particle 2 mass | |||
* @param radi decay vertex radio. | |||
*/ | |||
FlatteLineShape(hydra::Parameter const& mean, hydra::Parameter const& rho1 , hydra::Parameter const& rho2, |
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.
What is the length of the vector std::vector<std::vector<double>> params
and what does it holds?
I think can be a good idea to document the meaning of this parameter.
Also, are these parameters supposed to be optimized in a fit? Case yes, consider to use the correct interface to store and make them "trackable" by Minuit2 and copy constructors on device and host sides.
If the number of such parameters is not fixed, but still constant at compile time, please, add a template parameter to the class to implement then, and set the default value to the most common case (my guess is most of the time it is 2...) . After set them using this->SetParameter(param_index, param_value)
in the body of the constructor.
hydra/functions/FlatteLineShape.h
Outdated
double mother_mass, | ||
double daugther1_mass, double daugther2_mass, double daugther3_mass, | ||
double radi) : | ||
BaseFunctor<FlatteLineShape<CHANNEL, ArgIndex>, hydra::complex<double>, 3>{mean, rho1, rho2}, | ||
BaseFunctor<FlatteLineShape<CHANNEL, ArgIndex>, hydra::complex<double>,1>{mean}, | ||
fParams(params), |
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.
Unfortunately, this implementation does not fit the Hydra's requirements, since this class is not copyable on device side for CUDA backends. This happens because you are using a std::vector
as a member. This will works on host and device CPU-based backends, but not in CUDA, because std::vector
are not implemented there...
hydra/functions/FlatteLineShape.h
Outdated
} | ||
|
||
__hydra_host__ __hydra_device__ inline | ||
void SetDaughter1Mass(std::vector<std::vector<double>> _params) { |
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.
it seems to me this member is setting the wrong class member... Should be fDaughterMass1
instead of fParams
, right?
hydra/functions/FlatteLineShape.h
Outdated
@@ -256,6 +238,7 @@ namespace hydra { | |||
double fBachelorMass; | |||
double fMotherMass; | |||
double fRadi; | |||
std::vector<std::vector<double>> fParams; |
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.
this member is not copyable on CUDA...
Hi Juan, thanks for this contribution. It looks much better now! Indeed, the EvtGen's implementation is much more reliable... |
Hi Juan, let me confess I am a bit intrigued... How does this functor can be running in CUDA, if the member As I told you personally a pair of times, if the thresholds are always fixed parameters, it is not necessary to pass them to the Look forward for your feedback... |
Hi Augusto, std::array is a container to simple C array, it allow use iterators and other things, that's why I think it is running .
|
hydra/functions/FlatteLineShape.h
Outdated
@@ -238,7 +240,7 @@ for(size_t i = 0; i < fParams.size() ; i++) { | |||
double fBachelorMass; | |||
double fMotherMass; | |||
double fRadi; | |||
std::vector<std::vector<double>> fParams; | |||
std::array<std::array<double,3>,2> fParams; |
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.
This member, std::array<std::array<double,3>,2> fParams;
is not copyable in CUDA. AFAIK, there is no implementation of std::array in CUDA. Please, use double fParams[6]
@@ -121,12 +121,12 @@ namespace hydra { | |||
} |
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.
L.110 : BaseFunctor<FlatteLineShape<CHANNEL, ArgIndex>, hydra::complex, 7>::operator=(other);**
This should be 1 -------------------------------------------------------------------------------------------^^^
This assignment operator can't compile either.
Please, look my last comments. The CUDA9 Programing Guide, section F.3.8, states:
AFAIK, the only Standard Library class supported is I am still wondering how your code can run on CUDA... |
Can you try to run it in your machine? |
I think Edit: From looking at the descriptions of PS: |
The Standard is clear enough about |
BTW, about relying on
|
ping... |
No description provided.