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

Vpp visualization #11274

Merged
merged 3 commits into from May 3, 2018
Merged

Vpp visualization #11274

merged 3 commits into from May 3, 2018

Conversation

friedmud
Copy link
Contributor

Fills an Aux field with the values of a num_procs length vector.

closes #11272


## Description

This object is intended to let you view VectorPostprocessor vectors that are of lenght `num_procs` (meaning there is one value per MPI process). This object will take those values and fill up an Auxiliary field with them so the values can be visualized.
Copy link
Member

Choose a reason for hiding this comment

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

I guess as a utility this is fine, but there are better ways to accomplish this. If you take a step back and look at these new utilities you've added in the past week, you are essentially taking local only information, replicating it on all processors, then using the local only information. We could have just never sent it in the first place if you are only using the AuxKernel, but I suppose you may want both the VPP information and the visualization field.

Copy link
Contributor Author

@friedmud friedmud Apr 14, 2018

Choose a reason for hiding this comment

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

Ok - can you enumerate the "better ways"? And I'd like to see some citations on these new utilities you've added in the past week, you are essentially taking local only information, replicating it on all processors, then using the local only information

Where?

First of all - I didn't replicate information to all at all with any of my previous utilities. WorkBalance, HistogramVectorPostprocessor and StatisticsVectorPostprocessor only compute final values on processor zero (by default).

Besides that - HistorgramVectorPostprocessor and StatisticsVectorPostprocessor work on any VPP... not just VPPs that compute one value per processor. For instance: you can use it to compute the mean, max, sum, average or get the Histogram of values found by a LineValueSampler... including the statistics/historgram for all of the variables you sampled by that LineValueSampler. Please let me know how else you would do this.

I will agree that in this case for visualization- for WorkBalance - it needs to broadcast to get a copy of the information on each processor - but there might be other reasons for doing that besides just visualizing it. AND this utility is not only intended for WorkBalance alone... I'm going to use it to do many other things with... where I already have the vectors on each processor (like my ray tracing data).

What I'm making here are basic tools. I have many other plans for them going forward with my dissertation. If you don't find them useful then I'll just put them in my app. I know that many of these will get used a TON by many people over the years.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also: please tell me how to get the partition surface area on each processor and paint it into a field only using an AuxKernel?

Copy link
Member

Choose a reason for hiding this comment

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

👍 resolved

[wb]
type = WorkBalance
sync_to_all_procs = 'true'
execute_on = 'INITIAL'
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be 'TIMESTEP_END' too if you are visualizing every timestep (see above)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope - the issue is a dependency resolution issue.

Copy link
Member

Choose a reason for hiding this comment

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

Oh! Then this is a bug! VectorPostprocessors should be using the same PRE/POST logic as PostProcessors (and UserObjects). I'll checkout your branch and see if I can fix this.

Copy link
Member

Choose a reason for hiding this comment

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

OK - So there isn't a bug here. Turns out that the check in VectorPostprocessorVisualizationAux::timestepSetup() is overzealous in that it runs in only one spot (e.g. at the beginning of the timestep). The only way to get around that is to run the VPP that you are trying to visualize before that, which only leaves INITIAL. However, that defeats the purpose of the check since VPPs are allowed to change the size of their vectors with each invocation.

_communicator.allgather(static_cast<Real>(_local_num_nodes), _num_nodes);
_communicator.allgather(static_cast<Real>(_local_num_dofs), _num_dofs);
_communicator.allgather(static_cast<Real>(_local_num_partition_sides), _num_partition_sides);
_communicator.allgather(_local_partition_surface_area, _partition_surface_area);
Copy link
Member

Choose a reason for hiding this comment

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

This really isn't the right idea here. You should be usingscatter instead of allgather:
https://github.com/libMesh/libmesh/blob/master/include/parallel/parallel.h#L1240-L1247

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope. allgather() is the right one.

All processors are contributing one value that gets inserted in their rank position on every processor. That's exactly what allgather() does.

Read up: http://mpitutorial.com/tutorials/mpi-scatter-gather-and-allgather/

Copy link
Member

@permcody permcody Apr 16, 2018

Choose a reason for hiding this comment

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

Just to record our conversation that we had offline here: What I was after here was gather followed by scatter, not scatter instead of allgather. However, the scatter step should really be part of the AuxKernel, not the VPP. We decided that this isn't necessary for now as it won't impede scalability until we reach at least 100K - 1M procs.

Copy link
Member

Choose a reason for hiding this comment

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

BTW - I thought of something else that could help out here. We have the UserObject::spatialValue() and associated AuxKernel that pulls those out. If we had a similar interface for VPPs, you could actually scatter within your VPP and just store the scalar that you want to dump out. This would put the logic back into the VPP instead of the AuxKernel.

I think we should consider fleshing this interface out more.

Copy link
Member

Choose a reason for hiding this comment

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

👍 resolved

sync_to_all_procs = 'true'
execute_on = 'INITIAL'
[]
[]
Copy link
Member

Choose a reason for hiding this comment

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

Oh, You'll want to make sure to add a newline here. This isn't pedantic. It'll actually be removed if somebody runs the "remove_trailing_whitespace" script which sometimes causes confusion since it wouldn't have been edited by that developer otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also though: this didn't need a comment because Precheck caught it...

friedmud added a commit to friedmud/moose that referenced this pull request Apr 14, 2018
friedmud added a commit to friedmud/moose that referenced this pull request Apr 15, 2018
@moosebuild
Copy link
Contributor

moosebuild commented Apr 15, 2018

Job Documentation on 60a0b9e wanted to post the following:

View the site here

This comment will be updated on new commits.

friedmud added a commit to friedmud/moose that referenced this pull request Apr 15, 2018
VectorPostprocessorVisualizationAux::VectorPostprocessorVisualizationAux(
const InputParameters & parameters)
: AuxKernel(parameters),
_vpp_vector(getVectorPostprocessorValue("vpp", getParam<std::string>("vector_name"))),
Copy link
Member

Choose a reason for hiding this comment

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

Interesting that this works here. It actually isn't correct. We have all of those "ByName" variants, which take the parameter name (instead of the actual name). This might mean we have another bug in the retrieval of VPPs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's right the way it is - it is using the non "by name" version on purpose. vpp is the parameter name.

There is no such thing for the vector_name though (which is why I have to do getParam() for it). It could be argued that we should make that part of the interface too...

Copy link
Member

Choose a reason for hiding this comment

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

👍

@friedmud
Copy link
Contributor Author

friedmud commented May 2, 2018

@permcody can we merge this? It will make it easier for me to develop and test the broadcast/scatter code...

@moosebuild
Copy link
Contributor

Job App tests on 60a0b9e : invalidated by @friedmud

@permcody
Copy link
Member

permcody commented May 3, 2018

@friedmud - It's approved. You can either merge it yourself or build onto it. I'm not sure anyone is jumping to use it so I'll leave that up to you.

@friedmud friedmud merged commit 88584ee into idaholab:devel May 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants