Skip to content
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

Modify to get # of Lanczos iterations and set tolerance #6

Open
wants to merge 2 commits into
base: v2.x
Choose a base branch
from

Conversation

omaxian
Copy link

@omaxian omaxian commented Apr 8, 2023

I don't know why there are also changes for the shear here. I think I am not comparing to the correct version on your end. You can see the Lanczos changes are quite simple.

@@ -17,6 +17,7 @@ namespace uammd{
real viscosity;
real hydrodynamicRadius = -1; //If not provided it will be taken from pd->getRadius if possible
real tolerance = 1e-3;
real LanczosTol;
Copy link
Owner

Choose a reason for hiding this comment

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

Call this lanczosTolerance to be consistent with the naming

Copy link
Owner

Choose a reason for hiding this comment

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

Also, give it a default value that signals "not set":

real lanczosTolerance = -1;

Comment on lines +138 to +141
int getNumLanczosIterations(){
return nearField-> getNumLanczosIterations();
}

Copy link
Owner

Choose a reason for hiding this comment

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

This are the only lines that should be added to this file in your PR

Copy link
Owner

Choose a reason for hiding this comment

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

This file should present no changes. You mixed the sheared functionality and the lanczos iterations thing.

Comment on lines +55 to +57
int getNumLanczosIterations(){
return lanczos->getLastRunRequiredSteps();
}
Copy link
Owner

Choose a reason for hiding this comment

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

These lines are the only ones that should be changed in this file

if(not lanczos){
//It appears that this tolerance is unnecesary for lanczos, but I am not sure so better leave it like this.
this->lanczosTolerance = this->tolerance; //std::min(0.05f, sqrt(par.tolerance));
//this->lanczosTolerance = this->tolerance; //std::min(0.05f, sqrt(par.tolerance));
Copy link
Owner

Choose a reason for hiding this comment

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

This line should be removed.

Comment on lines 34 to 35
tolerance(par.tolerance)
{
Copy link
Owner

Choose a reason for hiding this comment

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

You are not setting lanczosTolerance here, meaning that the parameter that you added in BDHI is completely ignored here. Furthermore, you did not give this parameter a default value, which means any code using PSE currently would be broken.
Please add a default value for the parameter here, as:

  tolerance(par.tolerance),
  lanczosTolerance(par.lanczosTolerance){
  if(this->lanczosTolerance<0) this->lanczosTolerance = std::min(0.05f, sqrt(par.tolerance));

This way the old behavior is mantained if a user does not know about your new parameter.

@@ -216,7 +264,7 @@ namespace uammd{
thrust::transform(thrust::cuda::par.on(st), id_tr, id_tr + numberParticles, noise.begin(),
pse_ns::SaruTransform(noise_prefactor, seed, seed2));
lanczos->run(Mvdot_near, (real*) BdW, (real*)noise.data().get(),
tolerance, 3*numberParticles, st);
Copy link
Owner

Choose a reason for hiding this comment

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

This line should stay

Copy link
Owner

Choose a reason for hiding this comment

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

Your PR should not modify this file

Copy link
Owner

@RaulPPelaez RaulPPelaez left a comment

Choose a reason for hiding this comment

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

Hi @omaxian, thank you so much for the effort!
You included a lot of changes here, as you say you probably copied files from the incorrect place.
You introduced the sheared functionality in this PR, which is already in another branch. The one you added here is not covered in the tests and in fact contains several bugs at first glance (the temperature is ignored in some places, and the lanczosTolerance is also ignored). Thus I cannot merge this as it is.
Would you please consider reviewing my comments?

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.

None yet

2 participants