Skip to content

Add feedback optimization for PT temperatures #9

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

Merged
merged 7 commits into from
Jan 22, 2022
Merged

Conversation

mswwilson
Copy link
Contributor

No description provided.

@kbarros
Copy link
Member

kbarros commented Jan 11, 2022

Matt's PT changes look good to me. Also Cole updated some things in the docs regarding the unit system, etc. I think we can accept both, but I'm curious how these two different things ended up in the same PR?

Copy link
Member

@kbarros kbarros left a comment

Choose a reason for hiding this comment

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

Thanks all!

@ColeMiles
Copy link
Contributor

Matt's PT changes look good to me. Also Cole updated some things in the docs regarding the unit system, etc. I think we can accept both, but I'm curious how these two different things ended up in the same PR?

That's on me! I noticed that there were some issues in the docs from when I merged units, and wanted to fix them. Was worried that pushing another commit onto main might introduce merge conflicts and make this PR more complicated to finish, so I asked Matt if I could just append them onto this PR. In hindsight, though, I should not have added it into this PR since it's wholly unrelated. My mistake!

@kbarros
Copy link
Member

kbarros commented Jan 11, 2022

After some initial confusion, it wasn't a big deal, I could just look at each commit individually.

@kbarros
Copy link
Member

kbarros commented Jan 11, 2022

OK for me to squash and merge?

@ColeMiles
Copy link
Contributor

I wanted to take a quick look through if that's ok. I can't right now, but I can by the end of the day.

@kbarros
Copy link
Member

kbarros commented Jan 11, 2022

Of course -- handing off to you.

Copy link
Contributor

@ColeMiles ColeMiles left a comment

Choose a reason for hiding this comment

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

I left some suggestions on various changes, but it looks awesome!

In reviewing your code, I noticed some areas where I didn't fully make the LangevinSampler expose the same API as the Metropolis-based samplers which you depend on in some functions. After you make your pass, I'll fix this so that everything should work with both samplers and add a commit to the PR if that's fine with you!

f = ((N_labeled > 0) ? replica.N_down/N_labeled : 0.0)

# gather temperatures and replica flow 'f' from all replicas
gv = MPI.Gather([1.0/replica.sampler.β, f], 0, MPI.COMM_WORLD)
Copy link
Contributor

Choose a reason for hiding this comment

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

Tiny nitpick, but maybe a better variable name than gv?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm also realizing that replica.sampler.β will error with Langevin sampling too, and I've provided no way to get the temperature back out of a LangevinSampler! I can add another commit to this PR adding a new function like get_temp for all samplers that returns their temperature that we can call here instead -- I'll change this and other lines that grab the temperature in my commit.

So that we don't get conflicts, I'll wait until after you've made your pass?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sounds good

Copy link
Contributor

@ColeMiles ColeMiles left a comment

Choose a reason for hiding this comment

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

Awesome, thanks! Just one suggested change making the vector-accepting run_PT! a bit easier since you can pass variable number of keyword arguments through.

I can make those changes to LangevinSampler I alluded to, along with this other run_PT! change (if that seems fine with you), and push another commit onto here.

@mswwilson
Copy link
Contributor Author

Sounds good. Thanks so much for the suggestions!

Copy link
Contributor

@ColeMiles ColeMiles left a comment

Choose a reason for hiding this comment

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

Alright, I've added my commit which adds the get_temp function to all of the samplers and changed the PT code to use that function.

Please check that I haven't broken your PT examples in doing this! I don't currently have access to a cluster on which to test the PT code, and I'm having trouble running the scripts through MPI on my personal machine.

Other than testing I haven't broken anything, this seems good to go!

Fix comment typos
@mswwilson mswwilson merged commit bb54be6 into main Jan 22, 2022
@mswwilson mswwilson deleted the feedback-opt-PT branch January 22, 2022 02:40
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