From 4b6c45e64aaaba096dbcae5a3e2f7fb71bfd6d4d Mon Sep 17 00:00:00 2001 From: Dave May Date: Wed, 6 Sep 2023 11:43:21 -0700 Subject: [PATCH 1/9] Permit usage of petsc gpu matrices (MATAIJCUSPARSE) --- app/common/PetscDGMatrix.cpp | 6 ++++++ app/common/PetscInterplMatrix.cpp | 1 + app/common/PetscLinearSolver.cpp | 17 +++++++++++++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/app/common/PetscDGMatrix.cpp b/app/common/PetscDGMatrix.cpp index 1f235fc2..b80da8e8 100644 --- a/app/common/PetscDGMatrix.cpp +++ b/app/common/PetscDGMatrix.cpp @@ -55,6 +55,12 @@ PetscDGMatrix::PetscDGMatrix(std::size_t blockSize, DGOperatorTopo const& topo) case HASH_DEF(MATIS): preallocate_IS(topo); break; + case HASH_DEF(MATSEQAIJCUSPARSE): + preallocate_SeqAIJ(topo); + break; + case HASH_DEF(MATMPIAIJCUSPARSE): + preallocate_MPIAIJ(topo); + break; default: break; } diff --git a/app/common/PetscInterplMatrix.cpp b/app/common/PetscInterplMatrix.cpp index 467e8e3c..66b7aa20 100644 --- a/app/common/PetscInterplMatrix.cpp +++ b/app/common/PetscInterplMatrix.cpp @@ -17,6 +17,7 @@ PetscInterplMatrix::PetscInterplMatrix(std::size_t rowBlockSize, std::size_t col CHKERRTHROW(MatSetSizes(A_, localRows, localCols, PETSC_DETERMINE, PETSC_DETERMINE)); CHKERRTHROW(MatSetBlockSizes(A_, rowBlockSize, columnBlockSize)); CHKERRTHROW(MatSetType(A_, MATAIJ)); + CHKERRTHROW(MatSetFromOptions(A_)); // Local to global mapping PetscInt* l2g; diff --git a/app/common/PetscLinearSolver.cpp b/app/common/PetscLinearSolver.cpp index 5596aca5..b2209c58 100644 --- a/app/common/PetscLinearSolver.cpp +++ b/app/common/PetscLinearSolver.cpp @@ -85,8 +85,21 @@ void PetscLinearSolver::setup_mg(AbstractDGOperator& dgop, PC p i_op->assemble(to_degree, from_degree, I); CHKERRTHROW(PCMGSetInterpolation(pc, l + 1, I.mat())); - Mat A_l; - CHKERRTHROW(MatPtAP(A_lp1, I.mat(), MAT_INITIAL_MATRIX, PETSC_DEFAULT, &A_l)); + // Construct coarse level operator via A_c = Pt A P + //Mat A_l; + //CHKERRTHROW(MatPtAP(A_lp1, I.mat(), MAT_INITIAL_MATRIX, PETSC_DEFAULT, &A_l)); + + // PETSc manpage for MatPtAP() states that For matrix types without a + // special implementation of PtAP, MatPtAP() fallbacks back to + // using MatMatMult() followed by MatTransposeMatMult(). + // The following fall back will always work + Mat A_l, AP, Pt; + CHKERRTHROW(MatMatMult(A_lp1, I.mat(), MAT_INITIAL_MATRIX, 1, &AP)); + CHKERRTHROW(MatTranspose(I.mat(), MAT_INITIAL_MATRIX, &Pt)); + CHKERRTHROW(MatMatMult(Pt, AP, MAT_INITIAL_MATRIX, 1, &A_l)); + CHKERRTHROW(MatDestroy(&Pt)); + CHKERRTHROW(MatDestroy(&AP)); + CHKERRTHROW(PCMGGetSmoother(pc, l, &smooth)); CHKERRTHROW(KSPSetOperators(smooth, A_l, A_l)); mat_cleanup.push_back(A_l); From 88fd93c855da15390497b8242d14a6b93036828a Mon Sep 17 00:00:00 2001 From: Thomas-Ulrich Date: Thu, 28 Sep 2023 10:20:16 +0200 Subject: [PATCH 2/9] add CITATION.cff --- CITATION.cff | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 CITATION.cff diff --git a/CITATION.cff b/CITATION.cff new file mode 100644 index 00000000..51074875 --- /dev/null +++ b/CITATION.cff @@ -0,0 +1,29 @@ +# This CITATION.cff file was generated with cffinit. +# Visit https://bit.ly/cffinit to generate yours today! + +cff-version: 1.2.0 +title: Tandem +message: >- + If you use this software, please cite it using the + metadata from this file. +type: software +authors: + - given-names: Carsten + family-names: Uphoff + - given-names: Dave + family-names: May + - given-names: Alice-Agnes + family-names: Gabriel + - given-names: Thomas + family-names: Ulrich + - given-names: Nico + family-names: Schliwa + - given-names: Casper + family-names: Pranger +repository-code: 'https://github.com/TEAR-ERC/tandem/' +url: 'https://tandem.readthedocs.io/en/latest/' +abstract: >- + Tandem is a scalable discontinuous Galerkin code on + unstructured curvilinear grids for linear elasticity + problems and sequences of earthquakes and aseismic slip. +license: BSD-3-Clause From a2c1fd528aed8d420440164da3f5817675bc96cd Mon Sep 17 00:00:00 2001 From: Thomas-Ulrich Date: Thu, 28 Sep 2023 10:50:12 +0200 Subject: [PATCH 3/9] add issue template --- .github/ISSUE_TEMPLATE/bug_report.md | 29 +++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 28 ++++++++++++++++++ .../ISSUE_TEMPLATE/problem_using_tandem.md | 14 +++++++++ 3 files changed, 71 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/ISSUE_TEMPLATE/problem_using_tandem.md diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..305974f5 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,29 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: 'bug' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. Tell us what the code actually does. + +**Expected behavior** +A clear and concise description of what you expected to happen. Tell us what you want the code to do. + +**To Reproduce** +Steps to reproduce the behavior: +1. Which version do you use? Provide branch and commit id. +2. Which build settings do you use? Which compiler version do you use? +3. On which machine does your problem occur? If on a cluster: Which modules are loaded? +4. Provide parameter/material files. + +**Screenshots/Console output** +If you suspect a problem in the numerics/physics add a screenshot of your output. + +If you encounter any errors/warnings/... during execution please provide the console output. + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 00000000..6f99224f --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,28 @@ +--- +name: Feature request +about: Suggest adding a feature that is not yet in tandem +labels: feature + +--- + + + +### Rationale + + + +### Description + + + + +### Additional information + + + +### General information + +- [ ] I have searched the issues of this repo and believe this is not a duplicate + + +Other than that, thanks for taking the time to contribute to tandem! diff --git a/.github/ISSUE_TEMPLATE/problem_using_tandem.md b/.github/ISSUE_TEMPLATE/problem_using_tandem.md new file mode 100644 index 00000000..63af07e4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/problem_using_tandem.md @@ -0,0 +1,14 @@ +--- +name: Problem using tandem +about: Any problem, which evolves around how you can use tandem. +labels: discussion + +--- + +If you have a problem using tandem, please open a *discussion*. This could include things like: +* How do I set up a model (mesh, material parameters, ...). +* How do I interpret/visualize results. +* How can I tune tandem for performance on my cluster. + +You should open an issue, if you found a possible bug or you want to request a new feature, which is not yet implemented in tandem. + From 77611cc8b95824970aa918796118420c49ecea16 Mon Sep 17 00:00:00 2001 From: Thomas-Ulrich Date: Thu, 28 Sep 2023 10:52:28 +0200 Subject: [PATCH 4/9] add CONTRIBUTING.md --- CONTRIBUTING.md | 89 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..18f29a81 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,89 @@ +# Contributing to tandem +First off, thanks for taking the time to contribute! The following is a set of guidelines for contributing to tandem. We sincerely ask you to read and follow our [**Code of Conduct**](CODE_OF_CONDUCT.md). + +## Contributing as a user +### Reporting issues + +A great way to contribute to tandem is to send a detailed report when you encounter a problem. Sufficiently detailed reports are highly appreciate. A good report should allow us reproducing the issue. + +Go [here](https://github.com/TEAR-ERC/tandem/issues) and click on "New issue". Select either "Bug report" or "Feature request" and click on the corresponding "Get started" button. A new web page will pop up where you will need to fill in a template and give a descriptive title. Once it is done, click on "Submit new issue". + +## Contributing as a developer +### Workflow + +### Step 1 +You need a local fork of the project. Please, go to our [main GitHub page](https://github.com/TEAR-ERC/tandem) and press the “fork” button in GitHub. This will create a copy of the tandem repository in your own GitHub account. + +### Step 2 +Clone the forked tandem project from GitHub to your PC or laptop: +``` +$ git clone --recurse-submodules https://github.com//tandem.git +``` + +Let's open the new project’s directory: +``` +$ cd tandem +``` + +At this point, your local copy of the tandem project has a single reference to a remote repository i.e., the one that you've just forked in the previous step. + +``` +$ git remote -v +origin https://github.com//tandem.git (fetch) +origin https://github.com//tandem.git (push) +``` + +You need to set up a reference to the original remote tandem repository (referred to as `upstream`) to be able to grab new changes from the tandem main branch. It will allow you to synchronize your contribution with us. +``` +$ git remote add upstream https://github.com/TEAR-ERC/tandem.git +$ git remote -v +origin https://github.com//tandem.git (fetch) +origin https://github.com//tandem.git (push) +upstream https://github.com/TEAR-ERC/tandem.git (fetch) +upstream https://github.com/TEAR-ERC/tandem.git (push) +``` + +### Step 3 +We highly recommend cloning the latest main branch of the tandem project, creating a new branch out of it with a descriptive name and adding your contribution to tandem there. +``` +$ git checkout main +$ git pull upstream main +$ git branch +$ git checkout +``` +We also recommend following the following format for your branch names i.e., `/` where `` can be *feature*, *bugfix*, *extension*, etc. + +### Step 4 +Make a commit once you did some changes in your local copy of tandem + +``` +$ git add +$ git commit --message +``` +Note that code formatting is enforced in src test and app. +If you change files in these folders, you can enforce a suitable formatting by running: + +``` +.ci/format.sh $(which clang-format-11) . +``` + +Push it to your remote repository +``` +git push origin +``` +Now it is time to make a pull request (PR). Open the following web-page +``` +https://github.com//tandem/tree/ +``` +and click on "Compare & pull request". Write a descriptive title and a body of your PR, and click on "Create pull request". + +You can create a `draft pull request` If your contribution is not ready yet but you still want to show it to tandem maintainers. In this case, click on a green downward arrow next to "Create pull request", select "Create draft pull request" and proceed. + +### Step 5 +Once you submit your PR, one or two tandem maintainers will review it with you. After that, we may have questions. Please, check back on your PR to keep up with the conversation. Maintainers will start reviewing your contribution if at least the following requirements are fulfilled: + +- There is no merge conflict with the latest tandem main branch +- All CI tests are passed + +### Step 6 +Congratulations, your PR is merged! The whole tandem community thanks you. From a3ccb28f7677b6d6f878944f70a26b97bc142a76 Mon Sep 17 00:00:00 2001 From: Thomas-Ulrich Date: Thu, 28 Sep 2023 10:56:45 +0200 Subject: [PATCH 5/9] add code of conduct --- CODE_OF_CONDUCT.md | 129 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000..c95fa484 --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,129 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement (Alice-Agnes Gabriel, algabriel (at) ucsd (dot) edu, and Dave May, dmay (at) ucsd (dot) edu). + +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. + From aa21fe002cac7e6a0583cdfa4f82a2397f18fb49 Mon Sep 17 00:00:00 2001 From: Thomas-Ulrich Date: Thu, 28 Sep 2023 13:06:31 +0200 Subject: [PATCH 6/9] address Nico review --- .github/ISSUE_TEMPLATE/bug_report.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md index 305974f5..ab170f40 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -18,7 +18,7 @@ Steps to reproduce the behavior: 1. Which version do you use? Provide branch and commit id. 2. Which build settings do you use? Which compiler version do you use? 3. On which machine does your problem occur? If on a cluster: Which modules are loaded? -4. Provide parameter/material files. +4. Provide your .toml, .lua files and the PETSc options you used. **Screenshots/Console output** If you suspect a problem in the numerics/physics add a screenshot of your output. From d524624d8648908345a0f6e7e323fe8893421a1d Mon Sep 17 00:00:00 2001 From: Thomas-Ulrich Date: Tue, 16 Jan 2024 12:42:22 +0100 Subject: [PATCH 7/9] add missing empty-line --- .github/ISSUE_TEMPLATE/feature_request.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md index 6f99224f..71e52b84 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -17,6 +17,7 @@ labels: feature ### Additional information + From 96336517fbeb2b39154b94cf140d2e9134fbb61e Mon Sep 17 00:00:00 2001 From: Thomas-Ulrich Date: Fri, 21 Jun 2024 08:36:34 +0200 Subject: [PATCH 8/9] update CITATION.cff --- CITATION.cff | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/CITATION.cff b/CITATION.cff index 51074875..6ef092ff 100644 --- a/CITATION.cff +++ b/CITATION.cff @@ -5,7 +5,12 @@ cff-version: 1.2.0 title: Tandem message: >- If you use this software, please cite it using the - metadata from this file. + metadata from this file, or cite + Uphoff, C., May, D. A., & Gabriel, A. A. (2023). + A discontinuous Galerkin method for sequences of earthquakes + and aseismic slip on multiple faults using unstructured + curvilinear grids. Geophysical Journal International, 233(1), 586-626. + https://doi.org/10.1093/gji/ggac467 type: software authors: - given-names: Carsten @@ -14,6 +19,8 @@ authors: family-names: May - given-names: Alice-Agnes family-names: Gabriel + - given-names: Jeena + family-names: Yun - given-names: Thomas family-names: Ulrich - given-names: Nico From e4bcc2f521fd5a32ff3289aea740f1923c6e598c Mon Sep 17 00:00:00 2001 From: Thomas-Ulrich Date: Fri, 21 Jun 2024 08:41:26 +0200 Subject: [PATCH 9/9] change proposed clang-format version --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 18f29a81..e034ffcc 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -64,7 +64,7 @@ Note that code formatting is enforced in src test and app. If you change files in these folders, you can enforce a suitable formatting by running: ``` -.ci/format.sh $(which clang-format-11) . +.ci/format.sh $(which clang-format) . ``` Push it to your remote repository