Skip to content

Commit f1db033

Browse files
authored
Merge pull request #28 from gridap/gridap_v0.16
Gridap v0.16
2 parents 9b7f925 + 310d3d3 commit f1db033

34 files changed

+2627
-1643
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,12 @@ jobs:
88
fail-fast: false
99
matrix:
1010
version:
11-
- '1.5'
11+
- '1.6'
1212
os:
1313
- ubuntu-18.04
1414
arch:
1515
- x64
1616
steps:
17-
- name: Install dependencies
18-
run: sudo apt-get update; sudo apt-get install libopenmpi-dev petsc-dev
1917
- uses: actions/checkout@v2
2018
- uses: julia-actions/setup-julia@v1
2119
with:
@@ -32,8 +30,6 @@ jobs:
3230
${{ runner.os }}-test-
3331
${{ runner.os }}-
3432
- uses: julia-actions/julia-buildpkg@v1
35-
env:
36-
JULIA_MPI_BINARY: system
3733
- uses: julia-actions/julia-runtest@v1
3834
- uses: julia-actions/julia-processcoverage@v1
3935
- uses: codecov/codecov-action@v1
@@ -46,7 +42,7 @@ jobs:
4642
- uses: actions/checkout@v2
4743
- uses: julia-actions/setup-julia@v1
4844
with:
49-
version: '1.5'
45+
version: '1.6'
5046
- run: |
5147
julia --project=docs -e '
5248
using Pkg
@@ -56,4 +52,4 @@ jobs:
5652
- run: julia --project=docs docs/make.jl
5753
env:
5854
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59-
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}
55+
DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ Manifest.toml
88
/docs/site/
99
deps/build.log
1010
deps/deps.jl
11+
deps/PetscDataTypes.jl

Project.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
name = "GridapPETSc"
22
uuid = "bcdc36c2-0c3e-11ea-095a-c9dadae499f1"
3-
authors = ["Víctor Sande <vsande@cimne.upc.edu>"]
4-
version = "0.2.1"
3+
authors = ["Francesc Verdugo <fverdugo@cimne.upc.edu>","Víctor Sande <vsande@cimne.upc.edu>"]
4+
version = "0.3.0"
55

66
[deps]
77
Gridap = "56d4f2e9-7ea1-5844-9cf6-b9c51ca7ce8e"
88
Libdl = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
9+
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
910
MPI = "da04e1cc-30fd-572f-bb4f-1f8673147195"
11+
PETSc_jll = "8fa3689e-f0b9-5420-9873-adf6ccf46f2d"
1012
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
13+
SparseMatricesCSR = "a0a7dd2c-ebf4-11e9-1f05-cf50bc540ca1"
1114

1215
[compat]
13-
Gridap = "0.15"
16+
Gridap = "0.16"
1417
MPI = "0.14, 0.15, 0.16"
18+
SparseMatricesCSR = "0.6.1"
1519
julia = "1.3"
20+
PETSc_jll = "3.13"
1621

1722
[extras]
1823
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

README.md

Lines changed: 7 additions & 130 deletions
Original file line numberDiff line numberDiff line change
@@ -5,142 +5,19 @@
55
[![Build Status](https://github.com/gridap/GridapPETSc.jl/workflows/CI/badge.svg?branch=master)](https://github.com/gridap/GridapPETSc.jl/actions?query=workflow%3ACI)
66
[![Codecov](https://codecov.io/gh/gridap/GridapPETSc.jl/branch/master/graph/badge.svg)](https://codecov.io/gh/gridap/GridapPETSc.jl)
77

8-
[Gridap](https://github.com/gridap/Gridap.jl) (Grid-based approximation of partial differential equations in Julia) plugin to use PETSC ([Portable, Extensible Toolkit for Scientific Computation](https://www.mcs.anl.gov/petsc/)).
9-
10-
## Basic Usage
11-
12-
```julia
13-
using MPI
14-
using Gridap
15-
using GridapPETSc
16-
using SparseArrays
17-
18-
MPI.Init()
19-
GridapPETSc.Init()
20-
21-
A = sparse([1,2,3,4,5],[1,2,3,4,5],[1.0,2.0,3.0,4.0,5.0])
22-
b = ones(A.n)
23-
x = similar(b)
24-
ps = PETScSolver()
25-
ss = symbolic_setup(ps, A)
26-
ns = numerical_setup(ss, A)
27-
solve!(x, ns, b)
28-
29-
GridapPETSc.Finalize()
30-
MPI.Finalize()
31-
```
32-
33-
## Usage in a Finite Element computation
34-
35-
```julia
36-
using MPI
37-
using Gridap
38-
using GridapPETSc
39-
40-
tol = 1e-10
41-
42-
MPI.Init()
43-
GridapPETSc.Init(["-ksp_rtol","$tol"])
44-
45-
domain = (0,1,0,1,0,1)
46-
cells = (10,10,10)
47-
model = CartesianDiscreteModel(domain,cells)
48-
49-
order = 1
50-
V = TestFESpace( model,
51-
ReferenceFE(lagrangian,Float64,order),
52-
conformity=:H1, dirichlet_tags="boundary" )
53-
U = TrialFESpace(V)
54-
55-
Ω = Triangulation(model)
56-
57-
degree = 2*order
58-
= Measure(Ω,degree)
59-
60-
f(x) = x[1]*x[2]
61-
62-
a(u,v) = ( (v)(u) )*
63-
l(v) = ( v*f )*
64-
65-
ass = SparseMatrixAssembler(SparseMatrixCSR{0,PetscReal,PetscInt},U,V)
66-
op = AffineFEOperator(a,l,ass)
67-
68-
ls = PETScSolver()
69-
solver = LinearFESolver(ls)
70-
71-
uh = solve(solver,op)
72-
73-
GridapPETSc.Finalize()
74-
MPI.Finalize()
75-
```
8+
[Gridap](https://github.com/gridap/Gridap.jl) plugin to use PETSC ([Portable, Extensible Toolkit for Scientific Computation](https://www.mcs.anl.gov/petsc/)).
769

7710
## Installation
7811

79-
**GridPETSc** itself is installed when you add and use it into another project.
80-
81-
Please, ensure that your system fulfills the requirements.
82-
83-
To include into your project form Julia REPL, use the following commands:
84-
85-
```
86-
pkg> add GridapPETSc
87-
julia> using GridapPETSc
88-
```
89-
90-
If, for any reason, you need to manually build the project, write down the following commands in Julia REPL:
91-
```
92-
pkg> add GridapPETSc
93-
pkg> build GridapPETSc
94-
julia> using GridapPETSc
95-
```
96-
97-
### Requirements
98-
99-
`GridapPETSc` julia package requires `PETSC` library ([Portable, Extensible Toolkit for Scientific Computation](https://www.mcs.anl.gov/petsc/)) and `OPENMPI` to work correctly. `PETSc` library can be manually installed in any path on your local machine. In order to succesfull describe your custom installation to be located by `GridapPETSc`, you must export `PETSC_DIR` and `PETSC_ARCH` environment variables. If this environment variables are not available, `GridapPETSc` will try to find the library in the usual linux user library directory (`/usr/lib`).
100-
101-
`PETSC_DIR` and `PETSC_ARCH` are a couple of variables that control the configuration and build process of PETSc:
102-
103-
- `PETSC_DIR`: this variable should point to the location of the PETSc installation that is used. Multiple PETSc versions can coexist on the same file-system. By changing `PETSC_DIR` value, one can switch between these installed versions of PETSc.
104-
- `PETSC_ARCH`: this variable gives a name to a configuration/build. Configure uses this value to stores the generated config makefiles in `${PETSC_DIR}/${PETSC_ARCH}`. Make uses this value to determine this location of these makefiles which intern help in locating the correct include and library files.
105-
106-
Thus one can install multiple variants of PETSc libraries - by providing different `PETSC_ARCH` values to each configure build. Then one can switch between using these variants of libraries from make by switching the `PETSC_ARCH` value used.
107-
108-
If configure doesn't find a `PETSC_ARCH` value (either in env variable or command line option), it automatically generates a default value and uses it. Also - if make doesn't find a `PETSC_ARCH` env variable - it defaults to the value used by last successful invocation of previous configure. `PETSC_ARCH` value can be an empty string too.
109-
110-
#### Basic PETSc installation on Debian-based systems
111-
112-
`PETSc` can be obtained from the default repositories of your Debian-based OS by means of `apt` tool.
113-
114-
Basic `PETSc` installation in order to use it from `GridapPETSc` julia package is as follows:
115-
116-
```
117-
$ sudo apt-get update
118-
$ sudo apt-get install openmpi-bin petsc-dev
119-
```
120-
121-
## Continuous integration
122-
123-
In order to take advantage of `GridapPETSc` julia package during continuous integration, you must ensure that the requirements are fullfilled in the CI environment.
124-
125-
If your CI process is based on `Travis-CI` you can add the following block at the beginning of your `.travis.yml` file:
12+
`GridapPETSc` julia package requires the `PETSC` library ([Portable, Extensible Toolkit for Scientific Computation](https://www.mcs.anl.gov/petsc/)) and `MPI` to work correctly. You have two main options to install these dependencies.
12613

127-
```
128-
addons:
129-
apt:
130-
update: true
131-
packages:
132-
- openmpi-bin
133-
- petsc-dev
134-
```
14+
- **Do nothing [recommended in most cases].** Use the default precompiled `MPI` installation provided by [`MPI.jl`](https://github.com/JuliaParallel/MPI.jl) and the pre-compiled `PETSc` library provided by [`PETSc_jll`](https://github.com/JuliaBinaryWrappers/PETSc_jll.jl). This will happen under the hood when you install `GridapPETSc`. You can also force the installation of these default dependencies by setting the environment variables `JULIA_MPI_BINARY` and `JULIA_PETSC_LIBRARY` to empty values.
13515

136-
If your CI process is based on `GitHub Actions` you can add the following block at the beginning of the test steps in the `.github/workflows/ci.yml` file:
16+
- **Choose a specific installation of `MPI` and `PETSc` available in the system [recommended in HPC clusters]**.
17+
- First, choose a `MPI` installation. See the documentation of [`MPI.jl`](https://github.com/JuliaParallel/MPI.jl) for further details. An easy way to achieve this is to create the environment variable `JULIA_MPI_BINARY` containing the path to the `MPI` binary.
18+
- Second, choose a `PETSc` installation. To this end, create an environment variable `JULIA_PETSC_LIBRARY` containing the path to the dynamic library object of the `PETSC` installation (i.e., the `.so` file in linux systems). **Very important: The chosen `PETSc` lirbary needs to be configured with the `MPI` installation considered in previous step**.
13719

138-
```
139-
steps:
140-
- name: Install dependencies
141-
run: sudo apt-get update; sudo apt-get install openmpi-bin petsc-dev
142-
```
14320

14421
## Notes
14522

146-
`GridapPETSc` default sparse matrix format is 0-based compressed sparse row. This types of sparse matrix can be described by `SparseMatrixCSR{0,PetscReal,PetscInt}` and `SymSparseMatrixCSR{0,PetscReal,PetscInt}`.These types of matrix are implemented in the [SparseMatricesCSR](https://gridap.github.io/SparseMatricesCSR.jl/stable/)) julia package.
23+
`GridapPETSc` default sparse matrix format is 0-based compressed sparse row. This types of sparse matrix can be described by `SparseMatrixCSR{0,PetscReal,PetscInt}` and `SymSparseMatrixCSR{0,PetscReal,PetscInt}` implemented in the [SparseMatricesCSR](https://gridap.github.io/SparseMatricesCSR.jl/stable/) Julia package.

0 commit comments

Comments
 (0)