Looks good to me, Roy.
While we are at it, I have one more observation:
Consider the global comm with ranks {0, 1, 2, 3}.
Then, after the following intended split: {0}, which requires rank {0} to
request split with a color and ranks {1, 2, 3} with MPI_UNDEFINED, the
mpi_communicator on the latter set will have a value MPI_COMM_NULL.
The method Communicator::assign(), compares the value of the new comm against
MPI_COMM_NULL. If a valid comm is found, then the rank and size are set
consistently, otherwise they are set to 0 and 1. So, in the above simple case,
a call to comm.rank() and comm.size() on all cpus for the new subcomm will
always return 0 and 1.
Of course, the use can explicitly check comm.get() == MPI_COMM_NULL to see if a
communicator is valid or not. But, I am not sure if this is intended. In any
case, I wanted to point this out.
Thanks,
Manav
> On Mar 11, 2016, at 8:24 AM, Roy Stogner <[email protected]> wrote:
>
>
> On Fri, 11 Mar 2016, Manav Bhatia wrote:
>
>> From the current status of the code in parallel.h, it looks like
>> mpi_comm_free is called only when _I_duped_it is true, which is
>> true only when Communicator::duplicate() is called.
>>
>> I think the communicator created using split() also needs to be
>> destroyed using comm_free. But since _I_duped_it is not set to true
>> with split(), it does not seem like comm_free would be called when
>> the communicator goes out of scope.
>>
>> I would appreciate if someone could confirm this.
>
> This appears to be correct. In my defense, some of the MPI
> documentation examples don't free the results of an MPI_Comm_split
> either. In the offense, others of the MPI examples do free the
> MPI_Comm_split output, and I probably should have read through more
> than one example before writing the code.
>
> I'll put in a PR to fix it now.
>
> Thanks,
> ---
> Roy
------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140
_______________________________________________
Libmesh-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libmesh-users