[deal.II] PETSc Vector set deprecated
Hello, I am building PETSc vectors with the set operation and I see it’s deprecated. The documentation suggests to use “import( )” but I don’t see how to use it. How can I use import( ) as a replacement for set( ) as the documentation suggests? Please provide an example. Thank you, Zachary -- 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/8CBCFFAA-05DE-42F3-A65A-0A5842736424%40gmail.com.
Re: [deal.II] PETSC SparsMatrix initialization error
SGetStartVector() line 809 in /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_math_slepc/slepc/work/slepc-3.13.2/src/eps/interface/epssolve.c #6 STGetOperator_Private() line 285 in /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_math_slepc/slepc/work/slepc-3.13.2/src/sys/classes/st/interface/stsolve.c [1]PETSC ERROR: #7 STApply() line 64 in /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_math_slepc/slepc/work/slepc-3.13.2/src/sys/classes/st/interface/stsolve.c [1]PETSC ERROR: #8 EPSGetStartVector() line 809 in /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_math_slepc/slepc/work/slepc-3.13.2/src/eps/interface/epssolve.c [1]PETSC ERROR: [0]PETSC ERROR: #9 EPSSolve_KrylovSchur_Symm() line 32 in /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_math_slepc/slepc/work/slepc-3.13.2/src/eps/impls/krylov/krylovschur/ks-symm.c [0]PETSC ERROR: #10 EPSSolve() line 149 in /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_math_slepc/slepc/work/slepc-3.13.2/src/eps/interface/epssolve.c #9 EPSSolve_KrylovSchur_Symm() line 32 in /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_math_slepc/slepc/work/slepc-3.13.2/src/eps/impls/krylov/krylovschur/ks-symm.c [1]PETSC ERROR: #10 EPSSolve() line 149 in /opt/local/var/macports/build/_opt_bblocal_var_buildworker_ports_build_ports_math_slepc/slepc/work/slepc-3.13.2/src/eps/interface/epssolve.c libc++abi.dylib: terminating with uncaught exception of type dealii::SLEPcWrappers::SolverBase::ExcSLEPcError: An error occurred in line <169> of file in function void dealii::SLEPcWrappers::SolverBase::solve(const unsigned int, unsigned int *) The violated condition was: ierr == 0 Additional information: An error with error number 60 occurred while calling a SLEPc function libc++abi.dylib: terminating with uncaught exception of type dealii::SLEPcWrappers::SolverBase::ExcSLEPcError: An error occurred in line <169> of file in function void dealii::SLEPcWrappers::SolverBase::solve(const unsigned int, unsigned int *) The violated condition was: ierr == 0 Additional information: An error with error number 60 occurred while calling a SLEPc function -Zachary > On Jan 8, 2021, at 5:25 PM, Wolfgang Bangerth wrote: > > On 1/8/21 3:58 PM, Zachary 42! wrote: >> Yes, the error comes when I try to use the Slepc solver (the matrix builds >> without errors). Running the attached file (Sorry, I’v been experimenting >> trying to get things working so I think I should include what I am testing >> now), At the bottom of the error output, I get: >> >> An error occurred in Line <169> of file >> in function >> void dealii::SLEPcWrappers::SolverBase::solve(const unsigned int, unsigned >> int*) >> The violated condition was: >> ierr == 0 >> Additional information: >> An error with error number 60 occurred while calling a SLEPc function >> -- > > But that's a different error. Have you tried to look up what error code 60 > means in SLEPc? > > Best > W. > > > -- > > Wolfgang Bangerth email: bange...@colostate.edu > www: http://www.math.colostate.edu/~bangerth/ > > -- > 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/If0Ep9rJ67Q/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > dealii+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/dealii/a3b74574-5a16-47d8-c69c-ce52243f67d0%40colostate.edu. -- 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 unsub
Re: [deal.II] PETSC SparsMatrix initialization error
No, that's not what you want. You need to partition the columns in the same way as you partition the vectors you want to multiply the matrix by. We generally partition the vectors in the same way as the rows of the matrix, and so then you also have to choose the same partitioning for the columns of the matrix.Ah okay, I thought I wasn’t explaining my desired layout well. I will change my matrix layout so I can have distributed square sparse matrices.If you look at the backtrace, at which point do you get this error? Is it really out of the SLEPC functions? I would suspect that it comes out of the set-up phase for your matrix.Yes, the error comes when I try to use the Slepc solver (the matrix builds without errors). Running the attached file (Sorry, I’v been experimenting trying to get things working so I think I should include what I am testing now), At the bottom of the error output, I get:An error occurred in Line <169> of file in functionvoid dealii::SLEPcWrappers::SolverBase::solve(const unsigned int, unsigned int*)The violated condition was: ierr == 0Additional information: An error with error number 60 occurred while calling a SLEPc function---Zachary -- 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/93297721-D794-49CE-BCAC-52080F39C661%40gmail.com. step-test_reinit.cc Description: Binary data On Jan 8, 2021, at 2:13 PM, Wolfgang Bangerthwrote:You said “the local number of columns also needs to add up to the global number of columns” but my desired layout is local_num_columns == global_num_columns.No, that's not what you want. You need to partition the columns in the same way as you partition the vectors you want to multiply the matrix by. We generally partition the vectors in the same way as the rows of the matrix, and so then you also have to choose the same partitioning for the columns of the matrix.I only press this because I get the similar dimension error when I tried to use Slepc to solve the test matrix so maybe my initial sparse matrix dimension is wrong (or my matrix). Please take a look at the file I am attaching. It’s the same code you ran before but I added a section using Slepc to solve the eigenvalue problem. It’s bare bones and produces the dimension error just like before. This code works for one processor and given the error, this is not a surprise. For 2 processors, I get “Sum of local length 64 does not equal global length 128, my local length 64”.If you look at the backtrace, at which point do you get this error? Is it really out of the SLEPC functions? I would suspect that it comes out of the set-up phase for your matrix.Best W.-- Wolfgang Bangerth email: bange...@colostate.edu www: http://www.math.colostate.edu/~bangerth/-- 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/If0Ep9rJ67Q/unsubscribe.To unsubscribe from this group and all its topics, send an email to dealii+unsubscr...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/dealii/8741cd0a-8f48-8c67-ae10-1c5c6a3d7802%40colostate.edu. -- 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/93297721-D794-49CE-BCAC-52080F39C661%40gmail.com.
Re: [deal.II] PETSC SparsMatrix initialization error
Hi W., Apologies for not asking a specific question. Your help with the SparseMatrix constructor still left me confused and I was hoping for clarity. ( To answer your question, the code ran without error but the error came back once I tried to use Slepc. ) You said “the local number of columns also needs to add up to the global number of columns” but my desired layout is local_num_columns == global_num_columns. If I create the local dynamic sparsity pattern with dimension local_num_rows.n_elements() X local_num_rows.size(), does the sparse matrix constructor set the local_num_columns == global_num_columns? I don’t want to assume things but this is one of the pitfalls of abstraction, I suppose. I only press this because I get the similar dimension error when I tried to use Slepc to solve the test matrix so maybe my initial sparse matrix dimension is wrong (or my matrix). Please take a look at the file I am attaching. It’s the same code you ran before but I added a section using Slepc to solve the eigenvalue problem. It’s bare bones and produces the dimension error just like before. This code works for one processor and given the error, this is not a surprise. For 2 processors, I get “Sum of local length 64 does not equal global length 128, my local length 64”. I have been hitting this particular wall for quite some time but I know my last message Timo responded to did not come across like that at all. He is completely correct and I will keep his constructive comments in mind. Much appreciated, Zachary -- 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/3AE61492-4D0D-4BA2-8814-255049C574DA%40gmail.com. step-test_reinit.cc Description: Binary data > On Jan 7, 2021, at 10:43 PM, Wolfgang Bangerth wrote: > > On 1/6/21 8:07 AM, Zachary 42! wrote: >> Here is my code again with hopefully better comments. Looking at the loop >> structure for the dynamic_sparsity_pattern should make it clear. I think >> the 3rd argument in the constructor for the dynamic sparsity pattern is >> wrong if I want these dimensions. > > Zachary -- there's no question in your email. What happens if you try with > your code? > > Timo put it well: We enjoy helping, but there is a limit to how much time we > can offer. > > Best > W. > -- > > Wolfgang Bangerth email: bange...@colostate.edu > www: http://www.math.colostate.edu/~bangerth/ > > -- > 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/If0Ep9rJ67Q/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > dealii+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/dealii/6f33e8b9-90aa-4453-3c17-a1a1a958de40%40colostate.edu. -- 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/3AE61492-4D0D-4BA2-8814-255049C574DA%40gmail.com.
[deal.II] Re: Slepc Solver Dimension error
Sorry, forgot the file! -- 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/7C57CF5F-FE43-4DC0-9FD2-CBDF5005B05A%40gmail.com. step-test_reinit.cc Description: Binary data > On Jan 7, 2021, at 7:15 PM, Zachary 42! wrote: > > Hi everyone, > > I get a “sum of local lengths 32 does not equal global length 128” PETSC > error in the following test file. It dies at the eigensolver.solve step. I > tried to use the test and tutorial programs but to no avail. Still wrapping > my head around the logic so please excuse me. > > Thank you, > > Zachary > > -- 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/7C57CF5F-FE43-4DC0-9FD2-CBDF5005B05A%40gmail.com.
[deal.II] Slepc Solver Dimension error
Hi everyone, I get a “sum of local lengths 32 does not equal global length 128” PETSC error in the following test file. It dies at the eigensolver.solve step. I tried to use the test and tutorial programs but to no avail. Still wrapping my head around the logic so please excuse me. Thank you, Zachary -- 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/5E2940CD-803F-4FD9-A11E-DF3A1CC4D7D4%40gmail.com.
[deal.II] AlignedVector set at index
Hi everyone, Ideally I would like to create an AlignedVector with a begin and end and then push_back only to those indices within those bounds. Is there a way to accomplish this? I assume the push_back function works similar to std::vector and starts the index count at zero, I would like to assign an aligned vector to a particular index like the std::vector insert function. I see there is apply_to_subrang() in AlignedVectorSet() but I don’t see any tests or examples using them. Thank you, Zachary -- 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/6A46BA2C-B2CC-416E-83F8-6C6D990EBD12%40gmail.com.
Re: [deal.II] PETSC SparsMatrix initialization error
Sorry, I am not sure why my code’s format changed when I copied and pasted, trying again... #include #include #include #include #include using namespace dealii; class OneBodyHamiltonianOperator { public: /** * Declare type for container size. */ using size_type = dealii::types::global_dof_index; OneBodyHamiltonianOperator(const dealii::IndexSet _local_row_set, const uint32_t a_my_proc, const uint32_t a_num_procs); /// Destructor ~OneBodyHamiltonianOperator(); private: dealii::PETScWrappers::MPI::SparseMatrix m_H1; dealii::DynamicSparsityPattern m_dynamic_sparsity_pattern; }; OneBodyHamiltonianOperator::OneBodyHamiltonianOperator( const dealii::IndexSet _local_row_set, const uint32_t a_my_proc, const uint32_t a_num_procs) { dealii::IndexSet local_owned_rows(a_local_row_set.size()); local_owned_rows.add_range(*a_local_row_set.begin(), *a_local_row_set.begin() + a_local_row_set.n_elements()); dealii::IndexSet local_owned_columns(a_local_row_set.size()); local_owned_columns.add_range(0, a_local_row_set.size()); m_dynamic_sparsity_pattern.reinit(a_local_row_set.size(), a_local_row_set.size(), local_owned_rows); for (dealii::IndexSet::ElementIterator i = a_local_row_set.begin(); i != a_local_row_set.end(); ++i) { for (uint32_t j = 0; j < a_local_row_set.size(); ++j) { auto ith = *i; m_dynamic_sparsity_pattern.add(ith, j); } } m_H1.reinit(local_owned_rows, local_owned_rows, m_dynamic_sparsity_pattern, MPI_COMM_WORLD); for (dealii::IndexSet::ElementIterator i = a_local_row_set.begin(); i != a_local_row_set.end(); ++i) { auto ith = *i; for (uint32_t j = 0; j < m_dynamic_sparsity_pattern.row_length(ith); ++j) { m_H1.add(ith, m_dynamic_sparsity_pattern.column_number(ith, j), 1); // added 1 for test value } } m_H1.compress(dealii::VectorOperation::add); } OneBodyHamiltonianOperator::~OneBodyHamiltonianOperator() {} void test(const int _proc, const int _proc, const ConditionalOStream ) { auto nbas = 64; auto nchannels = 2; IndexSet local_row_set = Utilities::create_evenly_distributed_partitioning(my_proc, n_proc, nbas * nchannels); OneBodyHamiltonianOperator H1(local_row_set, my_proc, n_proc); } int main(int argc, char **argv) { Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); MPI_Comm comm(MPI_COMM_WORLD); const auto my_proc = Utilities::MPI::this_mpi_process(comm); const auto n_proc = Utilities::MPI::n_mpi_processes(comm); ConditionalOStream pcout(std::cout, (my_proc == 0)); test(n_proc, my_proc, pcout); return 0; } > On Jan 5, 2021, at 11:03 PM, Wolfgang Bangerth wrote: > > On 1/5/21 11:32 AM, Zachary Streeter wrote: >> Yes, I want to use the constructor with the dynamic sparsity pattern. So >> with your suggestion in mind, would that just be the following: >> dealii::IndexSet local_owned(a_local_row_set.size()); >> local_owned.add_range(*a_local_row_set.begin(), >> *a_local_row_set.begin() + >> a_local_row_set.n_elements()); >> m_dynamic_sparsity_pattern.reinit(a_local_row_set.size(), >> a_local_row_set.size(), >> local_owned); >> std::vector local_rows_per_process(num_procs, >> a_local_row_set.n_elements() ); > > This creates a vector of size num_procs in which all entries are equal to > a_local_row_set.n_elements(). But why would all processors have the same > number of rows? And are you sure that a_local_row_set.n_elements() is the > same number on all processors anyway? > >> std::vector local_columns_per_process(num_procs, >> a_local_row_set.n_elements() ); // before used a_local_row_set.size() here! >> m_H1.reinit(MPI_COMM_WORLD, m_dynamic_sparsity_pattern, >> local_rows_per_process, local_columns_per_process, my_proc); > > I would try to stick with the fourth reinit() function here: > https://dealii.org/developer/doxygen/deal.II/classPETScWrappers_1_1MPI_1_1SparseMatrix.html#a645ab9f99494a47ebb6492e92e707130 > It's the simplest to use because every processor only has to pass an IndexSet > object that describes which rows (and columns) it owns. > > Best > W. > > -- > > Wolfgang Bangerth email: bange...@colostate.edu > www: http://www.math.colostate.edu/~bangerth/ > > -- > The
Re: [deal.II] PETSC SparsMatrix initialization error
W., Ah yes you are correct in your thinking. My test case was every process did have the same number of rows but I would need to communicate that with a gather to account for the number of rows not divisible by the number of given processors. I will use the 4th reinit function to avoid needing to do this, thank you! Using the same number of local columns as local rows in the reinit functions is still puzzling to me, so let me be clear of my desired layout. I have a matrix that is total_num_rows X total_num_columns. I would like to divide up, by processor, only on the row dimension so I would think the local layout would be ( total_num_rows / num_procs ) X total_num_columns, which is why I was trying to use size() for the local column number. Here is my code again with hopefully better comments. Looking at the loop structure for the dynamic_sparsity_pattern should make it clear. I think the 3rd argument in the constructor for the dynamic sparsity pattern is wrong if I want these dimensions. #include #include #include #include #include using namespace dealii; class OneBodyHamiltonianOperator { public: /** * Declare type for container size. */ using size_type = dealii::types::global_dof_index; OneBodyHamiltonianOperator(const dealii::IndexSet _local_row_set, const uint32_t a_my_proc, const uint32_t a_num_procs); /// Destructor ~OneBodyHamiltonianOperator(); private: dealii::PETScWrappers::MPI::SparseMatrix m_H1; dealii::DynamicSparsityPattern m_dynamic_sparsity_pattern; }; OneBodyHamiltonianOperator::OneBodyHamiltonianOperator( const dealii::IndexSet _local_row_set, const uint32_t a_my_proc, const uint32_t a_num_procs) { m_dynamic_sparsity_pattern.reinit( a_local_row_set.size(), a_local_row_set.size(), // sqaure matrix a_local_row_set); // this maybe what's wrong for wanting // a_local_row_set.n_elements() X a_local_row_set.size() for (dealii::IndexSet::ElementIterator i = a_local_row_set.begin(); i != a_local_row_set.end(); // row dimension has a_local_row_set.n_elements() // num of elements ++i) { for (uint32_t j = 0; j < a_local_row_set.size(); ++j) // column dimension has a_local_row_set.size() dimension { auto ith = *i; m_dynamic_sparsity_pattern.add(ith, j); } } m_H1.reinit(a_local_row_set, a_local_row_set, // would think number of local columns is the // full dimension because only partitioning on // row dimension m_dynamic_sparsity_pattern, MPI_COMM_WORLD); for (dealii::IndexSet::ElementIterator i = a_local_row_set.begin(); i != a_local_row_set.end(); ++i) { auto ith = *i; for (uint32_t j = 0; j < m_dynamic_sparsity_pattern.row_length(ith); ++j) { m_H1.add(ith, m_dynamic_sparsity_pattern.column_number(ith, j), 1); // added 1 for test value } } m_H1.compress(dealii::VectorOperation::add); } OneBodyHamiltonianOperator::~OneBodyHamiltonianOperator() {} void test(const int _proc, const int _proc, const ConditionalOStream ) { // Have matrices with (nbas * nchannels) X (nbas * nchannels) auto nbas = 64; auto nchannels = 2; IndexSet local_row_set = Utilities::create_evenly_distributed_partitioning( my_proc, n_proc, nbas * nchannels); // partition on num_rows (i.e. nbas * nchannels) OneBodyHamiltonianOperator H1(local_row_set, my_proc, n_proc); } int main(int argc, char **argv) { Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); MPI_Comm comm(MPI_COMM_WORLD); const auto my_proc = Utilities::MPI::this_mpi_process(comm); const auto n_proc = Utilities::MPI::n_mpi_processes(comm); ConditionalOStream pcout(std::cout, (my_proc == 0)); test(n_proc, my_proc, pcout); return 0; } > On Jan 5, 2021, at 11:03 PM, Wolfgang Bangerth wrote: > > On 1/5/21 11:32 AM, Zachary Streeter wrote: >> Yes, I want to use the constructor with the dynamic sparsity pattern. So >> with your suggestion in mind, would that just be the following: >> dealii::IndexSet local_owned(a_local_row_set.size()); >> local_owned.add_range(*a_local_row_set.begin(), >> *a_local_row_set.begin() + >> a_local_row_set.n_elements()); >> m_dynamic_sparsity_pattern.reinit(a_local_row_set.size(), >> a_local_row_set.size(), >> local_owned); >> std::vector local_rows_per_process(num_procs, >> a_local_row_set.n_elements() ); > > This creates a vector of size num_procs in which all entries are equal to >
[deal.II] PETSC SparsMatrix initialization error
Hi everyone, I am trying to debug this strange behavior. I am trying to build a PETSC sparse parallel matrix using 4 processors. This gives me 32 local number of rows (so 128 global number of rows). But when I pass the local_num_of_rows variable into the reinit function, this is the PETSC error I get: PETSC ERROR: Nonconforming object sizes PETSC ERROR: Sum of local lengths 512 does not equal global length 128, my local length 128 Here is my reinit function and necessary vectors: std::vector local_rows_per_process(num_procs,local_num_rows); std::vector local_columns_per_process(num_procs,number_of_columns); spm.reinit(MPI_COMM_WORLD, dsp, local_rows_per_process, local_columns_per_process, my_proc); The number of local rows for this example is local_num_rows=32, I printed to check. Though when it is passed into the reinit function, it looks like it is using the global number of rows. I get the same error from the constructor that doesn’t use the dynamic sparsity pattern: spm.reinit(MPI_COMM_WORLD,global_row_size,global_column_size,local_row_size,local_column_size,number_of_non_zeros); Just for clarifying this constructor, what is “local_rows” and “local_columns” for this constructor? The documentation just says see the class documentation. I see where the 4th constructor uses “local_rows_per_process” and this means how many rows do all other processors own and same for the columns so I thought I had that figured out for my constructor with the dynamic sparsity pattern but maybe not. For this constructor, I just used the local number of rows and columns. Can someone please show me what they would do to debug this situation? Thank you, Zachary -- 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/E60642F6-E3A0-465E-AAFA-4B3A184F974D%40gmail.com.
[deal.II] Distribute local sparsity pattern
Hi there, I am trying to build a parallel PETSc sparse matrix by building a local sparsity pattern and subsequently distributing the pattern to all processes so I then have the full sparsity pattern for the PETSc sparse matrix (I read this needs to be done but please correct me if I am wrong). When I try to reinit the PETSc sparse matrix I get a segfault so I am hunting down the problem. My understanding for “distribute_sparsity_pattern” is it sends local sparsity patterns to all other processes and saves the full global pattern in the dynamic sparsity pattern you passed in. So I figured that after I call this function, my local number of rows should be the global number of rows but the number of rows is the same as before I called this function (i.e. the actual local number of rows) so I think I am not using this function correctly and my PETSc sparse matrix doesn’t have the global dynamic sparsity pattern I think it must have, which results in a segfault. NOTE: The matrix is a square matrix with rows and columns of size “nbas * nchannels” and the rows are divided amongst the processes. Here is the code for distributing my locally built sparsity pattern dsp: IndexSet local_owned( nbas * nchannels * nbas * nchannels ); \\ allocate global sized index set local_owned.add_range( LocalStart(), LocalEnd() ); \\ start of local row first column and end of last local row at last column SparsityTools::distribute_sparsity_pattern( dsp, local_owned, comm, local_owned ); Here is the code for initializing my PETSc sparse matrix: std::vector local_rows_per_process( num_procs); // allocate a vector of length number of process std::vector local_columns_per_process( num_procs, nbas * nchannels); // columns are full length and rows are divided by num_procs for(int i=0; i < num_procs; ++i ) { local_rows_per_process[ i ] = i * local_rows; // Saw this in a test but initially thought this should just all be local_rows for each i } Matrix.reinit( comm, dsp, local_rows_per_process, local_columns_per_process, my_proc); -- 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/1942C0DC-2A53-4A9C-AFD6-C136192C72DB%40gmail.com.
[deal.II] New Build Error? Usable debug flags failed
Hello, I recently tried to build deal.II locally because the cluster is down and I have the error below. How can I attack this? I appreciate any guidance in advance! -- Include /Users/zachary/Documents/Coding/dealii/cmake/setup_finalize.cmake -- Performing Test DEAL_II_HAVE_USABLE_FLAGS_DEBUG -- Performing Test DEAL_II_HAVE_USABLE_FLAGS_DEBUG - Failed CMake Error at cmake/setup_finalize.cmake:137 (MESSAGE): Configuration error: Cannot compile a test program with the final set of compiler and linker flags: CXX flags (DEBUG): -openmp-simd -std=c++14 -O0 LD flags (DEBUG): -Wl,--as-needed LIBRARIES (DEBUG): /opt/local/lib/libz.dylib;rt;/opt/local/lib/libmetis.dylib;/opt/local/lib/libgsl.dylib;/opt/local/lib/libgslcblas.dylib;/opt/local/lib/libscalapack.dylib;/opt/intel/compilers_and_libraries_2020.2.258/mac/mkl/lib/libmkl_intel_lp64.dylib;/opt/intel/compilers_and_libraries_2020.2.258/mac/mkl/lib/libmkl_intel_thread.dylib;/opt/intel/compilers_and_libraries_2020.2.258/mac/mkl/lib/libmkl_core.dylib;/opt/intel/compilers_and_libraries_2020.2.258/mac/compiler/lib/libiomp5.dylib;-lm;-ldl;/opt/local/lib/slepc/lib/libslepc.dylib;/opt/local/lib/petsc/lib/libpetsc.dylib;/opt/local/lib/libvecLibFort.dylib;/opt/local/lib/mpich-mp/libmpifort.dylib;/opt/local/lib/mpich-mp/libmpi.dylib;/opt/local/lib/mpich-mp/libpmpi.dylib;gfortran;quadmath;m;dl; Call Stack (most recent call first): cmake/macros/macro_verbose_include.cmake:19 (INCLUDE) CMakeLists.txt:132 (VERBOSE_INCLUDE) -- Configuring incomplete, errors occurred! See also "/Users/zachary/Documents/Coding/dealii/build/CMakeFiles/CMakeOutput.log". See also "/Users/zachary/Documents/Coding/dealii/build/CMakeFiles/CMakeError.log”. -Zachary -- 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/60BC375B-6080-45ED-ACC3-A602506C691F%40gmail.com.
[deal.II] Calculating local PETSC matrix
Hi everyone, I want to create a PETSC matrix across multiple nodes using MPI. This should be simply finding the appropriate local index within my loops and build up the matrix. What are some of the functionalities I should look into for this? There are multiple “partition” so I thought it would be quicker to just ask. There is also potentially needing to send ghost elements to neighboring ranks so any suggestions with that using these PETSC matrices would be appreciated! Cheers, Zachary -- 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/494ECBF5-7805-4216-8569-04CD6A42505D%40gmail.com.
[deal.II] OpenMP
Hi everyone, I am wondering if deal.II has any OpenMP capabilities or if they would be easily incorporated? I know the deal.II project uses TBB for multithreading but I would like to run multithreaded on computers that may not have TBB. Cheers, Zachary -- 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/ADAE27EA-7132-425F-913C-ED99412B3D02%40gmail.com.
[deal.II] Creating a SOA with nice OOP like interface
Hi everyone, I saw on lecture 22 “Some data structure design considerations” Prof. Wolfgang described a struct of arrays (SOA) with an accessor interface. This keeps nice encapsulation while also providing nice cache use. I would like to understand this design better for my personal programming growth, separating interface and data so the data is stored optimally. Here is a snippet from the iterators section of the documentation: "Since dereferencing iterators yields accessor objects, these calls are to member functions Accessor::vertex(), Accessor::child() etc. These in turn figure out the relevant data from the various data structures that store this data. How this is actually done and what data structures are used is not really of concern to authors of applications in deal.II. In particular, by hiding the actual data structures we are able to store data in an efficient way, not necessarily in a way that makes it easily accessible or understandable to application writers.” What classes should I look at that shows this design the most succinctly? How is the data actually stored? This design seems very important for writing data oriented code but still provided a nice interface layer on top and I would like to get comfortable with it. Cheers, Zachary -- 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/1AFF639A-6557-4603-BDF7-D9F94DB622EC%40gmail.com.
[deal.II] Compiling f90 files
Hi everyone, I want to use some fortran modules in my test build of deal.II. What would be the best way to create this structure? Maybe create a fortran directory in source and create a obj_fortran OBJECT but I am not sure if the DEAL_II_ADD_LIBRARY macro will work with .f90 files. This would require ADD_SUBDIRECTORY(fortran) in source/CMakeLists.txt but I need to make sure this fortran object is linked to other objects built from other directories in source. For example, the obj_test built in source/tests/CMakeLists.txt needs to be linked with this obj_fortran built from source/fortran/CMakeLists.txt. Cheers, Zachary -- 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/F639A587-E3E3-46A7-BB0A-5C7C1ADB4EE4%40gmail.com.
[deal.II] Building on Cluster
Hi everyone, I am having an issue with building deal.II on my groups cluster. I am trying to build with Intel MPI compilers like mpiicc and mpiicpc. Here is the output where the error is: - Include /global/home/users/lstreeter/dealii/cmake/checks/check_01_cxx_features.cmake -- Performing Test DEAL_II_HAVE_CXX14_FEATURES -- Performing Test DEAL_II_HAVE_CXX14_FEATURES - Failed -- Performing Test DEAL_II_HAVE_CXX14_CLANGAUTODEBUG_BUG_OK -- Performing Test DEAL_II_HAVE_CXX14_CLANGAUTODEBUG_BUG_OK - Failed -- Performing Test DEAL_II_HAVE_CXX11_FEATURES -- Performing Test DEAL_II_HAVE_CXX11_FEATURES - Failed -- Performing Test DEAL_II_HAVE_CXX11_FUNCTIONAL_LLVMBUG20084_OK -- Performing Test DEAL_II_HAVE_CXX11_FUNCTIONAL_LLVMBUG20084_OK - Failed -- C++14 support is disabled. -- C++14 support not available. Try to set -std=c++14 explicitly -- Performing Test DEAL_II_HAVE_FLAG_std=c__14 -- Performing Test DEAL_II_HAVE_FLAG_std=c__14 - Success -- Configuration changed. Unsetting cached variable "DEAL_II_HAVE_CXX14_FEATURES" and rerunning checks. -- Configuration changed. Unsetting cached variable "DEAL_II_HAVE_CXX14_CLANGAUTODEBUG_BUG_OK" and rerunning checks. -- Configuration changed. Unsetting cached variable "DEAL_II_HAVE_CXX11_FEATURES" and rerunning checks. -- Configuration changed. Unsetting cached variable "DEAL_II_HAVE_CXX11_FUNCTIONAL_LLVMBUG20084_OK" and rerunning checks. -- Performing Test DEAL_II_HAVE_CXX14_FEATURES -- Performing Test DEAL_II_HAVE_CXX14_FEATURES - Failed -- Performing Test DEAL_II_HAVE_CXX14_CLANGAUTODEBUG_BUG_OK -- Performing Test DEAL_II_HAVE_CXX14_CLANGAUTODEBUG_BUG_OK - Success -- Performing Test DEAL_II_HAVE_CXX11_FEATURES -- Performing Test DEAL_II_HAVE_CXX11_FEATURES - Success -- Performing Test DEAL_II_HAVE_CXX11_FUNCTIONAL_LLVMBUG20084_OK -- Performing Test DEAL_II_HAVE_CXX11_FUNCTIONAL_LLVMBUG20084_OK - Success -- C++14 support is disabled. CMake Error at cmake/checks/check_01_cxx_features.cmake:315 (MESSAGE): The current version of deal.II requires a compiler with enabled C++14 support. Make sure to use a modern enough compiler (GCC version 5 onwards, Clang version 4 onwards, or Microsoft MS VS 2015 onwards) and check that the compiler flag "-std=" is either unset, or set to at least c++14. Call Stack (most recent call first): cmake/macros/macro_verbose_include.cmake:19 (INCLUDE) CMakeLists.txt:118 (VERBOSE_INCLUDE) -- Configuring incomplete, errors occurred! See also "/global/home/users/lstreeter/dealii/build/CMakeFiles/CMakeOutput.log". See also "/global/home/users/lstreeter/dealii/build/CMakeFiles/CMakeError.log”. —end of error It’s not passing the -std=c++14 checks though I know the Intel compilers are up to date (2020). I have tried passing the standard into my cmake command but that didn’t work. ( cmake -DWITH_MPI=ON -DCMAKE_CXX_FLAGS=“-std=c++14” .. ) The default gcc is too old for the -std=c++14 standard but I did try a newer version and it passed the -std=c++14 checks. This leads me to think either deal.II isn’t checking for the -std=c++14 correctly or when I load in the intel compilers, the cluster is still using the -std found in the default gcc, which is too old (though, I don’t know how this could be). Or many other things but that’s at least what I think at the moment. I did notice the message says GCC, clang, and Microsoft but not Intel; is that anything? This absolutely could be the cluster environment setup and I have been emailing them throughout the day but nothing fruitful yet. Any suggestions? Cheers, Zachary -- 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/5C440AB9-34FD-4C44-ADEC-A6CE98036382%40gmail.com.
[deal.II] CTest with MPI
Hi everyone, I am trying to run some MPI tests and I don’t see on the deal.II website how to use ctest for running MPI programs. I just saw how the output file needs to indicate the number of processors used in the test so numdiff works correctly. How do you use ctest for running a MPI test program? Thank you, Zachary Streeter -- 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/AD423270-3757-4D06-B3B0-2E5D7787DFFB%40gmail.com.
[deal.II] Adding new obj target
Hi folks, I am trying to add another include/source directory and subsequent obj to dealii for potential future contributions to dealii. Though I am having linking errors because my new obj needs to link agains the lac_obj (need Trilinos and other interfaces). I thought the ADD_DEPENDICIES in the source/CMakeLists.txt file is where this is taking care of but apparently not. I am following the exact same CMakeLists.txt files as in the other source/dirs but I am still getting the undefined symbols error due to object targets not apparently linking together. [ 80%] Linking CXX shared library ../lib/libdealii.dylib Undefined symbols for architecture x86_64: "dealii::PETScWrappers::SparseMatrix::SparseMatrix(int const&, bool)", referenced from: test::Operator::Operator(int const&) in Operator.cc.o test::Operator::Operator(int const&, std::__1::basic_string, std::__1::allocator > const&) in Operator.cc.o ld: symbol(s) not found for architecture x86_64 So looks like the obj_lac needs to link with the obj_test and it doesn’t appear to be… Here is my source/Test/CMakeLists.txt file which builds fine: INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) SET(_src Operator.cc ) SET(_n_includes_per_unity_file 20) IF(DEAL_II_UNITY_BUILD) LIST(SORT _unity_include_src) ENDIF() SETUP_SOURCE_LIST("${_unity_include_src}" "${_separate_src}" ${_n_includes_per_unity_file} _src ) FILE(GLOB _header ${CMAKE_SOURCE_DIR}/include/test/*.h ) DEAL_II_ADD_LIBRARY(obj_test OBJECT ${_src} ${_header}) I didn’t change anything in the souce/CMakeLists.txt file. -- 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/DE13C37A-F916-4295-AE97-685F856C5291%40gmail.com.
[deal.II] Running new tests with argument
Hi folks, I am trying to add a new test that requires reading in a file so I’m passing it in as an argument. I am not sure how to use CTest and the other test setup in deal.II to pass in a file as an argument. Cheers, Zachary -- 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/F4D11B95-0211-40DD-A97C-326B6A358261%40gmail.com.