Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • T Trilinos
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 936
    • Issues 936
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 22
    • Merge requests 22
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • James Willenbring
  • Trilinos
  • Issues
  • #2056

Closed
Open
Created Dec 06, 2017 by James Willenbring@jmwilleMaintainer

Matrix Assembly Efficiency in PyTrilinos

Created by: michael-a-hansen

Hello,

I have some questions about efficiently filling and updating a matrix with tools available to PyTrilinos. The problem I'm solving is very nonlinear and while the Jacobian matrix structure is fixed (block tri-diagonal with large blocks), the elements themselves need to be recomputed frequently. Scraping tutorials and examples has led me to code such as the following, where InsertGlobalValues is called on an EpetraCrsMatrix in a Python loop over the rows. However, I observe this code is usually around 60x slower than assembling a Scipy sparse matrix via direct specification of full coordinate form.

Given a fixed Jacobian matrix structure, and capabilities available in PyTrilinos,

  1. Is there a faster way to assemble the matrix than A.InsertGlobalValues on EpetraCrsMatrix? I think VbrMatrix may be helpful for my block structure but I haven't found a PyTrilinos example.
  2. Given a FillCompleted matrix, is there an efficient way to replace its elements?
my_map = Epetra.Map(ndof, 0, comm)
A = Epetra.CrsMatrix(Epetra.Copy, my_map, 0)

for row, (cols, vals) in enumerate(rowmap):  # cols and vals are _all_ elements in the row
    A.InsertGlobalValues(row, vals, cols)
A.FillComplete()

Environment

  • Trilinos cloned at commit b2341eff32 [Thu Oct 12 10:07:25 2017 -0600], built all packages including PyTrilinos.
  • Python3.6
  • Mac OS X 10.12.16, Apple LLVM version 8.1.0 (clang-802.0.42), gcc 4.2.1
  • Running in serial
Assignee
Assign to
Time tracking