[MOAB-dev] Question about reduce_tags behavior
Tim Tautges
tautges at mcs.anl.gov
Wed May 9 08:40:57 CDT 2012
Hi Lorenzo,
The commit was a stopping point in a longer effort to address all of the problem you highlighted last week. I've
also entered a ticket for the case of putting the result into a different tag, which I agree is a bug in the current
code. One of the deeper issues I haven't reached any conclusion on yet is whether the small set of conventional tags
(those in src/MBTagConventions.hpp) need default values (IMO, probably), or how an application can change those
characteristics (IMO, probably not). Comments welcome on this last point.
- tim
On 05/09/2012 08:28 AM, Lorenzo Alessio Botti wrote:
> Dear all, dear Tim,
> I've seen that you updated the ParallelComm implementation and I've done a few more tests...
>
> It seems that the code I sent is failing because the GLOBAL_ID tag has been created by MOAB without a default value and
> I'm not able to set it
> without removing the tag.
> I added the following lines before calling tag_get_handle (GLOBAL_ID,...)
>
> std::vector<Tag> tags;
> instance.tag_get_tags(tags);
> for (unsigned int i = 0; i < tags.size(); i++)
> {
> std::string name;
> instance.tag_get_name(tags[i], name);
> if (name == "GLOBAL_ID")
> {
> std::vector<unsigned char> vals(sizeof(int));
> result = instance.tag_get_default_value(tags[i], &vals[0]);
> if (result != MB_SUCCESS)
> {
> std::cout<<"faile to get globalid tag def value, deleting tag... "<<std::endl;
> instance.tag_delete(tags[i]);
> }
> }
> }
>
> and know it works as follows...
>
> pcomm->reduce_tags(gid_tag_vec, gid_tag_vec, MPI_SUM, sharedFaces);
> provides in gid_tag_vec the sum of the tag values on shared faces, so it sums the value of the tag on the owned and on
> the not_owned entity. This is what I need in my code.
>
> pcomm->reduce_tags(gid_tag_vec, gid_sum_tag_vec, MPI_OP_NULL, sharedFaces);
> provides in gid_sum_tag_vec the values of gid_tag_vec on the owned ents, so this call replicates the behavior of
> exchange_tags.
>
> As you pointed out there is an issue when you want the result in a different tag, in particular
> pcomm->reduce_tags(gid_tag_vec, gid_sum_tag_vec, MPI_SUM, sharedFaces);
> returns an error in ParallelComm::unpack_tags() if the tags have different default values.
>
> Moreover I don't understand if the behavior of
> pcomm->reduce_tags(gid_tag_vec, gid_sum_tag_vec, MPI_SUM, sharedFaces);
> is correct.
> This call provides in gid_sum_tag_vec the sum of the gid_tag on the owned entity and the gid_sum_tag on the not_owned
> entity.
> If gid_sum_tag has values on the owned entity these are ignored.
>
> Thanks for help.
> Lorenzo
>
>
>
>>
>> On May 4, 2012, at 5:46 PM, Tautges wrote:
>>
>>> If I read your message right, it's a bug with when you want the result in a different tag? Will fix this soon, should
>>> be easy.
>>>
>>> On your msg about mbzoltan, the fix is much appreciated, we'll definitely get that in the code base. Dont know yet
>>> about the option string, haven't looked at code yet.
>>>
>>> - tim
>>>
>>> (Sent from an Androd that dosnt autocorect as wel as an ipone)
>>>
>>>
>>>
>>> -------- Original message --------
>>> Subject: Re: question about reduce_tags behavior
>>> From: Lorenzo Alessio Botti <ihabiamx at yahoo.it <mailto:ihabiamx at yahoo.it>>
>>> To: Tim Tautges <tautges at mcs.anl.gov <mailto:tautges at mcs.anl.gov>>,MOAB-dev at mcs.anl.gov <mailto:MOAB-dev at mcs.anl.gov>
>>> CC:
>>>
>>>
>>> Hi Tim,
>>> I've found the bug in my code...
>>> To get the sum of a tag on shared entities I need to call
>>>
>>> pcomm->reduce_tags(gid_tag_vec, gid_tag_vec, MPI_SUM, sharedFaces);
>>> and not
>>> pcomm->reduce_tags(gid_tag_vec, gid_sum_tag_vec, MPI_SUM, sharedFaces);
>>>
>>> Here is the new version, now it works...
>>>
>>
>
--
================================================================
"You will keep in perfect peace him whose mind is
steadfast, because he trusts in you." Isaiah 26:3
Tim Tautges Argonne National Laboratory
(tautges at mcs.anl.gov) (telecommuting from UW-Madison)
phone (gvoice): (608) 354-1459 1500 Engineering Dr.
fax: (608) 263-4499 Madison, WI 53706
More information about the moab-dev
mailing list