In Matlab calling sparse() is equivalent to building a sparsity pattern (just forget about the actual values) from the I, J row and column indices. And that is NOT a negligible expense. It is a sizeable fraction of the cost of building a Laplacian matrix on triangles, for instance.
On Tuesday, March 12, 2024 at 2:46:07 PM UTC-7 bruno.t...@gmail.com wrote: > I am not sure why but I need to approve all of your messages. Usually we > only need to approve the first time someone posts. Not sure what's going on > here. > > I don't remember how long the computation of the sparsity pattern took but > it was small. The reason this part is not parallelized in deal.II is > because nobody found out that this was a bottleneck. If you fill your > matrix with ones, you probably want the sparsity pattern computation to be > multithreaded. However, if you are assembling a mass matrix on a > non-uniform mesh, you have so much more work to do that it doesn't matter > if you build your sparsity pattern in serial. In theory, I agree everything > should be multithreaded but in practice, it has not been worth the effort > so far. If the performance of the assembly is really critical, you should > use the MatrixFree class instead of building a matrix. > > Bruno > > Le mar. 12 mars 2024 à 17:22, Petr Krysl <krysl...@gmail.com> a écrit : > >> That is a good point about Tpetra: I will check it out. >> >> > SparsityPattern is usually extremely fast >> It can still become a bottleneck, provided everything else runs in >> parallel. ;-) >> Which reminds me: I wanted to ask you about the WorkStream paper: The >> sparsity pattern computation was not reported. >> Could you tell me how expensive it was compared to the sequential >> assembly of the matrix? >> For linear problems, both the sparsity pattern computation and the >> computation of the entries need to be done. >> Therefore, It does not really help if the computation of the entries is >> run in parallel, when the sparsity pattern is done in serial. >> Isn't that right? >> >> On Tuesday, March 12, 2024 at 12:08:29 PM UTC-7 bruno.t...@gmail.com >> wrote: >> >>> In Trilinos, the Tpetra library has Graph which is basically a >>> SparsityPattern. Tpetra uses Kokkos (which abstracts multithreading and GPU >>> support) everywhere so I would expect that they use Kokkos to build the >>> Graph too. Multithreading for dealii's SparsityPattern is not planned so >>> far. It could be done but building the SparsityPattern is usually extremely >>> fast compared to the rest of the code and so, it's not worth doing. >>> >>> Bruno >>> >>> Le mar. 12 mars 2024 à 14:17, Petr Krysl <krysl...@gmail.com> a écrit : >>> >>>> Thanks, that is a helpful confirmation. >>>> Would you know if there is any multithreading sparsity pattern >>>> computation available anywhere? >>>> Is something like this planned for dealii? >>>> >>>> On Tuesday, March 12, 2024 at 10:39:22 AM UTC-7 bruno.t...@gmail.com >>>> wrote: >>>> >>>>> Hello, >>>>> >>>>> SparsityPattern is used for deal.II own matrices which do not support >>>>> MPI. As far as I can tell, SparsityPattern does not use multithreading >>>>> and >>>>> I don't think adding elements is threadsafe. So you are right. >>>>> >>>>> Best, >>>>> >>>>> Bruno >>>>> >>>>> On Tuesday, March 12, 2024 at 12:58:37 PM UTC-4 krysl...@gmail.com >>>>> wrote: >>>>> >>>>>> It would appear that the sparsity pattern is not (and cannot be) >>>>>> computed in parallel. That is my reading of the code. Am I wrong? >>>>> >>>>> -- >>>> The deal.II project is located at http://www.dealii.org/ >>>> For mailing list/forum options, see >>>> https://groups.google.com/d/forum/dealii?hl=en >>>> --- >>>> You received this message because you are subscribed to a topic in the >>>> Google Groups "deal.II User Group" group. >>>> To unsubscribe from this topic, visit >>>> https://groups.google.com/d/topic/dealii/hq6L0-qgpbE/unsubscribe. >>>> To unsubscribe from this group and all its topics, send an email to >>>> dealii+un...@googlegroups.com. >>>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/dealii/d9905f95-ef78-4564-a605-e10c2c19d981n%40googlegroups.com >>>> >>>> <https://groups.google.com/d/msgid/dealii/d9905f95-ef78-4564-a605-e10c2c19d981n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >> The deal.II project is located at http://www.dealii.org/ >> For mailing list/forum options, see >> https://groups.google.com/d/forum/dealii?hl=en >> --- >> You received this message because you are subscribed to a topic in the >> Google Groups "deal.II User Group" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/dealii/hq6L0-qgpbE/unsubscribe. >> To unsubscribe from this group and all its topics, send an email to >> dealii+un...@googlegroups.com. >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/dealii/5f66ea8c-1725-4dab-b026-fb7e19e92e14n%40googlegroups.com >> >> <https://groups.google.com/d/msgid/dealii/5f66ea8c-1725-4dab-b026-fb7e19e92e14n%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- The deal.II project is located at http://www.dealii.org/ For mailing list/forum options, see https://groups.google.com/d/forum/dealii?hl=en --- You received this message because you are subscribed to the Google Groups "deal.II User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to dealii+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/a5277543-bc58-4af6-a2c1-3930c5100553n%40googlegroups.com.