Skip to content

Commit

Permalink
Merge pull request #232 from slimgroup/geom-3d
Browse files Browse the repository at this point in the history
Field data improvements
  • Loading branch information
mloubout authored Mar 27, 2024
2 parents 05e9ff9 + d0aee53 commit 18119a3
Show file tree
Hide file tree
Showing 63 changed files with 4,445 additions and 1,073 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:

steps:
- name: Checkout JUDI
uses: actions/checkout@v3
uses: actions/checkout@v4

- id: set-matrix
run: echo "matrix=$(ls examples/scripts/*.jl examples/machine-learning/*.jl | xargs -n 1 | jq -R -s -c 'split("\n")[:-1]')" >> $GITHUB_OUTPUT
Expand All @@ -52,7 +52,7 @@ jobs:

steps:
- name: Checkout JUDI
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup julia
uses: julia-actions/setup-julia@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci-judi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ jobs:

steps:
- name: Checkout JUDI
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Cache julia install
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-julia-pkgs
with:
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/ci-op.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ jobs:
name: ${{ matrix.op }} on Julia ${{ matrix.version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
DEVITO_ARCH: gcc-9
DEVITO_ARCH: gcc-11
DEVITO_LANGUAGE: "openmp"
DEVITO_LOGGING: "ERROR"
DEVITO_LOGGING: "INFO"
OMP_NUM_THREADS: ${{ matrix.omp }}
GROUP: ${{ matrix.op }}

Expand Down Expand Up @@ -62,14 +62,10 @@ jobs:

steps:
- name: Checkout JUDI
uses: actions/checkout@v3

- name: Install GCC 9
if : runner.os == 'macOS'
run : brew install gcc@9
uses: actions/checkout@v4

- name: Cache julia install
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-julia-pkgs
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

steps:
- name: Checkout master
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: julia-actions/setup-julia@latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
run: echo ${{ github.event_name }}

- name: Checkout JUDI
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/[email protected]
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4

- name: Set up Python 3.9
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.9

Expand Down
13 changes: 11 additions & 2 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,23 @@ SegyIO = "0.7.7 - 0.8.3, >= 0.8.5"
TimerOutputs = "0.5"
julia = "1.6"

[extensions]
FluxJUDIExt = "Flux"
JLD2JUDIExt = "JLD2"
ZygoteJUDIExt = "Zygote"

[extras]
Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595"
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
TimerOutputs = "a759f4b9-e2f1-59dc-863e-4aeb61b1ea8f"

[targets]
test = ["Aqua", "ArgParse", "JLD2", "Printf", "Test", "TimerOutputs", "Flux"]
test = ["Aqua", "JLD2", "Printf", "Test", "TimerOutputs", "Flux"]

[weakdeps]
Flux = "587475ba-b771-5e3f-ad9e-33799f191a9c"
JLD2 = "033835bb-8acc-5ee8-8aae-3f567f8a3819"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
9 changes: 8 additions & 1 deletion deps/build.jl
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,16 @@ struct DevitoException <: Exception
msg::String
end

pk = pyimport("pkg_resources")
python = PyCall.pyprogramname

try
pk = pyimport("pkg_resources")
catch e
Cmd([python, "-m", "pip", "install", "--user", "setuptools"])
run(cmd)
pk = pyimport("pkg_resources")
end

################## Devito ##################
# pip command
cmd = Cmd([python, "-m", "pip", "install", "-U", "--user", "devito[extras,tests]>=4.4"])
Expand Down
2 changes: 2 additions & 0 deletions docker/Dockerfile.base
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ ENV DEBIAN_FRONTEND noninteractive

# Install nvidia HPC sdk
RUN apt-get update -y && \
apt-get install -y -q python3 python3-dev python3-pip && \
apt-get install -y -q wget git apt-utils vim curl jq && \
apt-get install -y -q liblapack-dev libblas-dev libibverbs-dev && \
wget -q -P /app/ https://developer.download.nvidia.com/hpc-sdk/21.5/nvhpc-21-5_21.5_amd64.deb \
Expand Down Expand Up @@ -85,3 +86,4 @@ WORKDIR /app/judi/notebooks
EXPOSE 8888

CMD /root/.local/bin/jupyter-notebook --ip="*" --no-browser --allow-root

36 changes: 33 additions & 3 deletions docs/src/preconditioners.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Seismic Preconditioners

JUDI provides a selected number of preconditioners known to be beneficial to FWI and RTM. We welcome additional preconditionners from the community. Additionnaly, any JOLI operator can be used as a preconditiner in conbination with JUDI operator thanks to the fundamental interface between JUDI and JOLI.
JUDI provides a selected number of preconditioners known to be beneficial to FWI and RTM. We welcome additional preconditioners from the community. Additionnaly, any JOLI operator can be used as a preconditiner in conbination with JUDI operator thanks to the fundamental interface between JUDI and JOLI.

```@contents
Pages = ["preconditioners.md"]
Expand Down Expand Up @@ -74,7 +74,7 @@ m_mute = I'*vec(m)

## Data preconditioners

These preconditioners are design to act on the shot records (data). These preconditioners are indexable by source number so that working with a subset of shot is trivial to implement.
These preconditioners are design to act on the shot records (data). These preconditioners are indexable by source number so that working with a subset of shot is trivial to implement. Additionally, all [DataPreconditionner](@ref) are compatible with out-of-core JUDI objects such as `judiVector{SeisCon}` so that the preconditioner is only applied to single shot data at propagation time.


### Data topmute
Expand All @@ -100,4 +100,34 @@ A `TimeDifferential{K}` is a linear operator that implements a time derivative (

```@docs
TimeDifferential
```
```

## Inversion wrappers

For large scale and practical cases, the inversions wrappers [fwi_objective](@ref) and [lsrtm_objective](@ref) are used to minimize the number of PDE solves. Those wrapper support the use of preconditioner as well for better results.

**Usage:**

For fwi, you can use the `data_precon` keyword argument to be applied to the residual (the preconditioner is applied to both the field and synthetic data to ensure better misfit):

```julia
fwi_objective(model, q, dobs; data_precon=precon)
```

where `precon` can be:

- A single [DataPreconditionner](@ref)
- A list/tuple of [DataPreconditionner](@ref)
- A product of [DataPreconditionner](@ref)

Similarly, for LSRTM, you can use the `model_precon` keyword argument to be applied to the perturbation `dm` and the `data_precon` keyword argument to be applied to the residual:

```julia
lsrtm_objective(model, q, dobs, dm; model_precon=dPrec, data_precon=dmPrec)
```

where `dPrec` and `dmPrec` can be:

- A single preconditioner ([DataPreconditionner](@ref) for `data_precon` and [ModelPreconditionner](@ref) for `model_precon`)
- A list/tuple of preconditioners ([DataPreconditionner](@ref) for `data_precon` and ModelPreconditionner](@ref) for `model_precon`)
- A product of preconditioners ([DataPreconditionner](@ref) for `data_precon` and ModelPreconditionner](@ref) for `model_precon`)
Loading

0 comments on commit 18119a3

Please sign in to comment.