[Dune] communication of dynamic vectors

arya fallahi arya.fallahi at psi.ch
Thu Mar 15 10:47:03 CET 2012


Sorry I made copy-paste a mistake, the communicator is called through the following line:

DataHandle<typename ElementMapper, std::vector<LocalVector> > datatransfer(elementMapper , a_);
      grid_.template communicate<DataHandle<typename ElementMapper,std::vector<LocalVector> > >
      (datatransfer,Dune::InteriorBorder_All_Interface,Dune::ForwardCommunication);

Best,
Arya

On Mar 15, 2012, at 10:31 AM, arya fallahi wrote:

> Hi Martin,
> 
> There is no stupid question, there MAY be stupid answers ;-).
> 
> So, I forgot to mention that I am using the svn version of DUNE and I have done the update just 2 days ago.
> 
> Concerning your question about the Vector class, let me say it exactly. Consider the communicator I sent to you. and I want to communicate by calling the following lines:
> 
> typedef typename Dune::LeafMultipleCodimMultipleGeomTypeMapper<Grid,P0Layout> ElementMapper;
> 
> ElementMapper elementMapper(grid_);
> 
> DataHandle<typename ElementMapper, std::vector<LocalVector> > datatransfer(elementMapper , a_);
>       grid_.template communicate<DataHandle<typename ElementMapper,std::vector<LocalVector> > >
>       (a_,Dune::InteriorBorder_All_Interface,Dune::ForwardCommunication);
> 
> 
> So, as you see "Vector" in the communicator is "std::vector<LocalVector>" When I determine LocalVector through the following line:
> 
> typedef Dune::FieldVector<double,6> LocalVector;
> 
> Everything is ok, including the run on multiple processors. However, when I determine LocalVector through the following line:
> 
> typedef Dune::DynamicVector<double> LocalVector;
> 
> The run performs successfully only on one processor and on multiple ones I receive the following error when I let it run on 2 processors (no matter if the fixedsize is true or false):
> 
> [pcp042851:69307] *** Process received signal ***
> [pcp042851:69307] Signal: Segmentation fault (11)
> [pcp042851:69307] Signal code: Address not mapped (1)
> [pcp042851:69307] Failing at address: 0x400000001
> [pcp042851:69306] *** Process received signal ***
> [pcp042851:69306] Signal: Segmentation fault (11)
> [pcp042851:69306] Signal code: Address not mapped (1)
> [pcp042851:69306] Failing at address: 0x400000001
> [pcp042851:69307] [ 0] 2   libSystem.B.dylib                   0x00007fff882301ba _sigtramp + 26
> [pcp042851:69307] [ 1] 3   ???                                 0x00007fff5fbfbb68 0x0 + 140734799788904
> [pcp042851:69307] [ 2] 4   eltd                                0x000000010008c94c _ZNSt6vectorIdSaIdEEaSERKS1_ + 172
> [pcp042851:69307] [ 3] 5   eltd                                0x00000001000d352e _ZNK4Dune16CommDataHandleIFIN7DataHandleINS_39LeafMultipleCodimMultipleGeomTypeMapperINS_14ALUSimplexGridILi3ELi3EEENS1_8P0LayoutEEESt6vectorINS_13DynamicVectorIdEESaISA_EEEESA_E6gatherIN12ALUGridSpace16ObjectStreamImplENS_6EntityILi0ELi3EKNS_9ALU3dGridILNS_20ALU3dGridElementTypeE4EP19ompi_communicator_tEENS_15ALU3dGridEntityEEEEEvRT_RKT0_ + 382
> [pcp042851:69307] [ 4] 6   eltd                                0x00000001000d3f86 _ZN12ALUGridSpace21GatherScatterBaseImplIN4Dune9ALU3dGridILNS1_20ALU3dGridElementTypeE4EP19ompi_communicator_tEENS1_16CommDataHandleIFIN7DataHandleINS1_39LeafMultipleCodimMultipleGeomTypeMapperINS1_14ALUSimplexGridILi3ELi3EEENS8_8P0LayoutEEESt6vectorINS1_13DynamicVectorIdEESaISH_EEEESH_EELi0EE8sendDataERNS_16ObjectStreamImplERKNS_6Gitter8helementE + 198
> [pcp042851:69307] [ 5] 7   eltd                                0x00000001002a69d0 _ZN12ALUGridSpace13GitterDunePll28sendInteriorGhostElementDataERNS_12ObjectStreamEPNS_11IteratorSTIINS_6Gitter5hfaceEEERNS_13GatherScatterE + 96
> [pcp042851:69307] [ 6] 8   eltd                                0x00000001002b8190 _ZN12ALUGridSpace13GitterDunePll19doInteriorGhostCommERSt6vectorINS_12ObjectStreamESaIS2_EERNS_13GatherScatterES7_S7_S7_NS0_17CommunicationTypeE + 608
> [pcp042851:69307] [ 7] 9   eltd                                0x00000001002d3b54 _ZN12ALUGridSpace13GitterDunePll15doCommunicationERNS_13GatherScatterES2_S2_S2_NS0_17CommunicationTypeE + 596
> [pcp042851:69307] [ 8] 10  eltd                                0x00000001000071e5 T.96101 + 389
> [pcp042851:69307] [ 9] 11  eltd                                0x000000010000da11 T.95985 + 1889
> [pcp042851:69307] [10] 12  eltd                                0x000000010021fb5a _ZN7ElTdNonDispersiveIN4Dune14ALUSimplexGridILi3ELi3EEENS_16ReducedWebbBasisIS3_EENS_9DoFMapperINS1_8GridViewINS1_25DefaultLeafGridViewTraitsIKS3_LNS1_21PartitionIteratorTypeE4EEEEES5_EENS1_13DynamicMatrixIdEENS1_13DynamicVectorIdEENS_24BoundaryIntegralInDirectIS3_S5_SD_SF_SH_EEE19updateTimeStepSolveEv + 1178
> [pcp042851:69307] [11] 13  eltd                                0x000000010002fefb _ZN7ElTdNonDispersiveIN4Dune14ALUSimplexGridILi3ELi3EEENS_16ReducedWebbBasisIS3_EENS_9DoFMapperINS1_8GridViewINS1_25DefaultLeafGridViewTraitsIKS3_LNS1_21PartitionIteratorTypeE4EEEEES5_EENS1_13DynamicMatrixIdEENS1_13DynamicVectorIdEENS_24BoundaryIntegralInDirectIS3_S5_SD_SF_SH_EEE14updateTimeStepEv + 27
> [pcp042851:69307] [12] 14  eltd                                0x0000000100217e5b _ZN7ElTdSolveINS_4ElTdIN4Dune14ALUSimplexGridILi3ELi3EEENS_16ReducedWebbBasisIS4_EENS_9DoFMapperINS2_8GridViewINS2_25DefaultLeafGridViewTraitsIKS4_LNS2_21PartitionIteratorTypeE4EEEEES6_EENS2_13DynamicMatrixIdEENS2_13DynamicVectorIdEENS_24BoundaryIntegralInDirectIS4_S6_SE_SG_SI_EEEES4_S6_SE_SG_SI_EEiPNS_RKT0_ + 2091
> [pcp042851:69307] [13] 15  eltd                                0x0000000100027a6f main + 9567
> [pcp042851:69307] [14] 16  eltd                                0x0000000100005634 start + 52
> [pcp042851:69307] [15] 17  ???                                 0x0000000000000002 0x0 + 2
> [pcp042851:69307] *** End of error message ***
> [pcp042851:69306] [ 0] 2   libSystem.B.dylib                   0x00007fff882301ba _sigtramp + 26
> [pcp042851:69306] [ 1] 3   ???                                 0x00007fff5fbfbb68 0x0 + 140734799788904
> [pcp042851:69306] [ 2] 4   eltd                                0x000000010008c94c _ZNSt6vectorIdSaIdEEaSERKS1_ + 172
> [pcp042851:69306] [ 3] 5   eltd                                0x00000001000d352e _ZNK4Dune16CommDataHandleIFIN713DataHandleINS_39LeafMultipleCodimMultipleGeomTypeMapperINS_14ALUSimplexGridILi3ELi3EEENS1_8P0LayoutEEESt6vectorINS_13DynamicVectorIdEESaISA_EEEESA_E6gatherIN12ALUGridSpace16ObjectStreamImplENS_6EntityILi0ELi3EKNS_9ALU3dGridILNS_20ALU3dGridElementTypeE4EP19ompi_communicator_tEENS_15ALU3dGridEntityEEEEEvRT_RKT0_ + 382
> [pcp042851:69306] [ 4] 6   eltd                                0x00000001000d3f86 _ZN12ALUGridSpace21GatherScatterBaseImplIN4Dune9ALU3dGridILNS1_20ALU3dGridElementTypeE4EP19ompi_communicator_tEENS1_16CommDataHandleIFIN7DataHandleINS1_39LeafMultipleCodimMultipleGeomTypeMapperINS1_14ALUSimplexGridILi3ELi3EEENS8_8P0LayoutEEESt6vectorINS1_13DynamicVectorIdEESaISH_EEEESH_EELi0EE8sendDataERNS_16ObjectStreamImplERKNS_6Gitter8helementE + 198
> [pcp042851:69306] [ 5] 7   eltd                                0x00000001002a69d0 _ZN12ALUGridSpace13GitterDunePll28sendInteriorGhostElementDataERNS_12ObjectStreamEPNS_11IteratorSTIINS_6Gitter5hfaceEEERNS_13GatherScatterE + 96
> [pcp042851:69306] [ 6] 8   eltd                                0x00000001002b817e _ZN12ALUGridSpace13GitterDunePll19doInteriorGhostCommERSt6vectorINS_12ObjectStreamESaIS2_EERNS_13GatherScatterES7_S7_S7_NS0_17CommunicationTypeE + 590
> [pcp042851:69306] [ 7] 9   eltd                                0x00000001002d3b54 _ZN12ALUGridSpace13GitterDunePll15doCommunicationERNS_13GatherScatterES2_S2_S2_NS0_17CommunicationTypeE + 596
> [pcp042851:69306] [ 8] 10  eltd                                0x00000001000071e5 T.96101 + 389
> [pcp042851:69306] [ 9] 11  eltd                                0x000000010000da11 T.95985 + 1889
> [pcp042851:69306] [10] 12  eltd                                0x000000010021fb5a _ZN7Hades3d17ElTdNonDispersiveIN4Dune14ALUSimplexGridILi3ELi3EEENS_16ReducedWebbBasisIS3_EENS_9DoFMapperINS1_8GridViewINS1_25DefaultLeafGridViewTraitsIKS3_LNS1_21PartitionIteratorTypeE4EEEEES5_EENS1_13DynamicMatrixIdEENS1_13DynamicVectorIdEENS_24BoundaryIntegralInDirectIS3_S5_SD_SF_SH_EEE19updateTimeStepSolveEv + 1178
> [pcp042851:69306] [11] 13  eltd                                0x000000010002fefb _ZN7ElTdNonDispersiveIN4Dune14ALUSimplexGridILi3ELi3EEENS_16ReducedWebbBasisIS3_EENS_9DoFMapperINS1_8GridViewINS1_25DefaultLeafGridViewTraitsIKS3_LNS1_21PartitionIteratorTypeE4EEEEES5_EENS1_13DynamicMatrixIdEENS1_13DynamicVectorIdEENS_24BoundaryIntegralInDirectIS3_S5_SD_SF_SH_EEE14updateTimeStepEv + 27
> [pcp042851:69306] [12] 14  eltd                                0x0000000100217e5b _ZN7ElTdSolveINS_4ElTdIN4Dune14ALUSimplexGridILi3ELi3EEENS_16ReducedWebbBasisIS4_EENS_9DoFMapperINS2_8GridViewINS2_25DefaultLeafGridViewTraitsIKS4_LNS2_21PartitionIteratorTypeE4EEEEES6_EENS2_13DynamicMatrixIdEENS2_13DynamicVectorIdEENS_24BoundaryIntegralInDirectIS4_S6_SE_SG_SI_EEEES4_S6_SE_SG_SI_EEiPNS_RKT0_ + 2091
> [pcp042851:69306] [13] 15  eltd                                0x0000000100027a6f main + 9567
> [pcp042851:69306] [14] 16  eltd                                0x0000000100005634 start + 52
> [pcp042851:69306] [15] 17  ???                                 0x0000000000000002 0x0 + 2
> [pcp042851:69306] *** End of error message ***
> 
> 
> I hope it is now more clear, but if it's not. Let me know, and I will prepare a simple example program and file the bug report.
> 
> Thank you very much for your assistance and support,
> 
> Best regards,
> Arya
>  
> On Mar 15, 2012, at 9:06 AM, Martin Nolte wrote:
> 
>> Call me stupid, but I still don't know what Vector::value_type really is. And this information might or might not have a huge impact.
>> 
>> Best,
>> 
>> Martin
>> 
>> Martin
>> 
>> On 03/15/2012 12:48 AM, Fallahi Arya wrote:
>>> Hi Martin, Andreas and Christian,
>>> 
>>> First thanks a lot for your quick replies and your guesses. Actually, I thought I was clear enough and have written the whole required things, but it seems I was wrong. Sorry for the disturbance. I thought maybe you already had faced with such an issue.
>>> 
>>> As I mentioned in my first email, I receive error when the template "Vector" is set to "DynamicVector" and it runs ok when it is set to "FieldVector". Furthermore, I am using ALUGrid.
>>> 
>>> The code compiles correctly and completely, so the error does not happen during the compilation. The error was returned by C++ during the runtime, exactly when the communication is to be fulfilled. I myself could actually understand nothing from the message, but if it may be helpful I will send it tomorrow morning, because I should run the code again to see the error.
>>> 
>>> The reason I want to use "DynamicVector" is that the dimensions of the vector is found by a function at the very beginning of the code. So, although it never changes in the code, it can not be of type "const". That's the reason I am trying to use "DynamicVector" instead of "FieldVector" as the template parameter (referenced by "Vector"). Perhaps, the suggestion that the fixedsize is not true is the sort of the problem. I will check it again and let you know tomorrow, when I send you the error message.
>>> 
>>> Thanks again for your support,
>>> Arya
>>> 
>>> 
>>> 
>>> -----Original Message-----
>>> From: dune-bounces+arya.fallahi=psi.ch at dune-project.org on behalf of Martin Nolte
>>> Sent: Wed 3/14/2012 8:58 PM
>>> To: dune at dune-project.org
>>> Subject: Re: [Dune] communication of dynamic vectors
>>> 
>>> Hi Arya,
>>> 
>>> Sorry, but any answer to your request would be pure guess work. What kind of
>>> error message are you referring to (compiler error, runtime exception,
>>> assertion, undefined behavior, ...). Moreover, the code is absolutely useless,
>>> because you are not stating the template arguments. For example: What is Vector?
>>> Not to mention: What grid are you using?
>>> 
>>> Maybe you could you even provide a simple example program and file a correct bug
>>> report? This would potentially allow us to reproduce the error and give you a
>>> helpful answer.
>>> 
>>> Please note: Even writing such a reply takes a lot of time and DUNE' development
>>> team is rather small, its support team is even non-existent. If you want useful
>>> answers (unlike the one I just wrote), you might want to consider writing
>>> understandable or reproducible questions.
>>> 
>>> Best,
>>> 
>>> Martin
>>> 
>>> On 03/14/2012 07:27 PM, arya fallahi wrote:
>>>> Dear Dune team,
>>>> 
>>>> Recently, I have had a problem with the communication of variables with type
>>>> DynamicVector. I have the following communicator inside a code, which is written
>>>> in accordance with the Dune guide notes:
>>>> 
>>>> template<classElementMapper, classVector>
>>>> classDataHandle: publicDune::CommDataHandleIF<DataHandle<ElementMapper,Vector>,
>>>> typenameVector::value_type>
>>>> {
>>>> 
>>>> public:
>>>> typedeftypenameVector::value_typeDataType;
>>>> bool contains (int dim, int codim) const { return (codim==0); }
>>>> bool fixedsize (int dim, int codim) const {returntrue; }
>>>> 
>>>> template<classEntityType>  size_t size (EntityType&  e) const { return(1); }
>>>> 
>>>> template<classMessageBuffer, classEntityType>
>>>> void gather (MessageBuffer&  buff, const EntityType&  e) const
>>>> {
>>>> unsigned int globalElementIndex=elementMapper_.map(e);
>>>> buff.write(v_[globalElementIndex]);
>>>> }
>>>> 
>>>> template<classMessageBuffer, classEntityType>
>>>> void scatter (MessageBuffer&  buff, const EntityType&  e, size_t n)
>>>> {
>>>> DataType x;
>>>> buff.read(x);
>>>> unsigned int globalElementIndex=elementMapper_.map(e);
>>>> v_[globalElementIndex] = x;
>>>> }
>>>> 
>>>> DataHandle (const ElementMapper&  elementMapper, Vector&  v):
>>>> elementMapper_(elementMapper),v_(v){}
>>>> 
>>>> private:
>>>> constElementMapper&  elementMapper_;
>>>> Vector&  v_;
>>>> };
>>>> 
>>>> This works well when variables with type FieldVector
>>>> (Dune::FieldVector<double,6>) are going to be communicated. However, when I want
>>>> to communicate DynamicVector (Dune::DynamicVector<double>) data, the code stops
>>>> and I receive an error message. I believe the problem lies in the communication
>>>> part, since the code with DynamicVector works well on 1 processor. Do you have
>>>> any idea why such a thing happens? Have you previously faced with this problem?
>>>> 
>>>> Best regards and thanks,
>>>> 
>>>> Arya Fallahi,
>>>> Dr. sc. techn. ETH,
>>>> Computational Accelerator Scientist
>>>> Paul Scherrer Institute (PSI),
>>>> CH-5232 Villigen, Switzerland,
>>>> arya.fallahi at psi.ch<mailto:arya.fallahi at psi.ch>,
>>>> +41(0)56 310 50 17
>>>> 
>>>> 
>>>> 
>>>> 
>>>> _______________________________________________
>>>> Dune mailing list
>>>> Dune at dune-project.org
>>>> http://lists.dune-project.org/mailman/listinfo/dune
>>> 
>> 
>> -- 
>> Dr. Martin Nolte <nolte at mathematik.uni-freiburg.de>
>> 
>> Universität Freiburg                                   phone: +49-761-203-5630
>> Abteilung für angewandte Mathematik                    fax:   +49-761-203-5632
>> Hermann-Herder-Straße 10
>> 79104 Freiburg, Germany
> 
> Arya Fallahi, 
> Dr. sc. techn.  ETH, 
> Computational Accelerator Scientist 
> Paul Scherrer Institute (PSI), 
> CH-5232 Villigen, Switzerland, 
> arya.fallahi at psi.ch, 
> +41(0)56 310 50 17
> 
> 
> _______________________________________________
> Dune mailing list
> Dune at dune-project.org
> http://lists.dune-project.org/mailman/listinfo/dune

Arya Fallahi, 
Dr. sc. techn.  ETH, 
Computational Accelerator Scientist 
Paul Scherrer Institute (PSI), 
CH-5232 Villigen, Switzerland, 
arya.fallahi at psi.ch, 
+41(0)56 310 50 17


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.dune-project.org/pipermail/dune/attachments/20120315/554c69b1/attachment.htm>


More information about the Dune mailing list