On Sun, Dec 18, 2022 at 9:44 AM 김성익 <ksi2...@gmail.com> wrote: > For example, before using preallocaotor, I made A matrix. (A matrix has > information about indices of global matrix) > And the code structures are as below. > for (int i=0; i<num; i++){ > MatGetRow(A,~~) // for getting indices info of global matrix. > MatSetvalues(preallocator, value_from_A); > } > Current state, I got an error at 'MatGetRow' when I run this code in > parallel. > That's why I want "all mpi ranks has information of A matrix". >
Just from your explanation, this does not sound like a scalable algorithm for this, and FEM should be scalable. I would take a look at some parallel FEM codes before settling on this structure. However, if you really wish to do this, you can create the original matrix and then call https://petsc.org/main/docs/manualpages/Mat/MatCreateSubMatrices/ with every process giving all indices as the argument. Thanks, Matt > Thanks, > Hyung Kim > > > 2022년 12월 18일 (일) 오후 11:36, Junchao Zhang <junchao.zh...@gmail.com>님이 작성: > >> I am not clear on what you said "this information must be viewed in all >> mpi ranks." Even with preallocator, each rank only needs to insert entries >> it knows (i.e., don't need to get all entries) >> >> Maybe you could provide an example code for us to better understand what >> you mean? >> >> --Junchao Zhang >> >> >> On Sun, Dec 18, 2022 at 8:25 AM 김성익 <ksi2...@gmail.com> wrote: >> >>> Hello, >>> >>> >>> Is there a matrix version function of VecScatterCreateToAll? >>> >>> I'm using preallocator for preallocation of global matrix. >>> Prior to using the preallocator, information related to allocation is >>> stored in the specific matrix, and this information must be viewed in all >>> mpi ranks. >>> For using preallocator, I need scattering the specific matrix info to >>> all mpi ranks. >>> >>> Thanks, >>> Hyung Kim >>> >> -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>