Skip to content

Commit ca7c08a

Browse files
authored
Merge pull request #256 from slimgroup/fs-fix
Fs fix
2 parents 5d43f62 + 432cb5a commit ca7c08a

File tree

7 files changed

+17
-58
lines changed

7 files changed

+17
-58
lines changed

.github/workflows/ci-examples.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- name: Set julia python
6464
run: |
6565
python3 -m pip install -U pip
66-
python3 -m pip install matplotlib seiscm colorcet
66+
python3 -m pip install "matplotlib<3.9" seiscm colorcet
6767
echo "PYTHON=$(which python3)" >> $GITHUB_ENV
6868
julia -e 'using Pkg;Pkg.add(["PyCall", "PyPlot", "SlimPlotting"])'
6969

.github/workflows/ci-judi.yml

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
name: JUDI base on Julia ${{ matrix.version }} - ${{ matrix.os }}
2020
runs-on: ${{ matrix.os }}
2121
env:
22+
DEVITO_ARCH: gcc-11
2223
DEVITO_LANGUAGE: "openmp"
2324
OMP_NUM_THREADS: 4
2425
GROUP: "JUDI"
@@ -28,21 +29,12 @@ jobs:
2829

2930
matrix:
3031
version: ['1.6', '1.7', '1.8', '1.9', '1.10']
31-
os: [ubuntu-latest, macos-latest]
32+
os: [ubuntu-latest, macos-13]
3233

3334
steps:
3435
- name: Checkout JUDI
3536
uses: actions/checkout@v4
3637

37-
- name: Cache julia install
38-
uses: actions/cache@v4
39-
env:
40-
cache-name: cache-julia-pkgs
41-
with:
42-
# julia is installed in ~/.julia
43-
path: ~/.julia
44-
key: ${{ matrix.os }}-${{ matrix.version }}-${{ env.cache-name }}
45-
4638
- name: Setup julia
4739
uses: julia-actions/setup-julia@v1
4840
with:
@@ -54,19 +46,6 @@ jobs:
5446
with:
5547
python-version: 3.9
5648

57-
- name: setup devito config
58-
run: |
59-
if [ "${{matrix.os}}" = "macos-latest" ]; then
60-
brew install llvm libomp
61-
echo "/opt/homebrew/bin:/opt/homebrew/opt/llvm/bin" >> GITHUB_PATH
62-
echo "LD_LIBRARY_PATH=/opt/homebrew/opt/llvm/lib" >> GITHUB_ENV
63-
echo "DEVITO_ARCH=clang" >> $GITHUB_ENV
64-
echo "DEVITO_PLATFORM=m1" >> $GITHUB_ENV
65-
else
66-
echo "DEVITO_ARCH=gcc-12" >> $GITHUB_ENV
67-
echo "DEVITO_PLATFORM=cpu64" >> $GITHUB_ENV
68-
fi
69-
7049
- name: Set julia python
7150
run: |
7251
PYTHON=$(which python3) julia -e 'using Pkg;Pkg.add("PyCall");Pkg.build("PyCall")'
@@ -82,4 +61,4 @@ jobs:
8261
- uses: julia-actions/julia-processcoverage@v1
8362
- uses: codecov/codecov-action@v3
8463
with:
85-
file: lcov.info
64+
file: lcov.info

.github/workflows/ci-op.yml

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
name: ${{ matrix.op }} on Julia ${{ matrix.version }} - ${{ matrix.os }}
2020
runs-on: ${{ matrix.os }}
2121
env:
22+
DEVITO_ARCH: gcc-11
2223
DEVITO_LANGUAGE: "openmp"
2324
DEVITO_LOGGING: "INFO"
2425
OMP_NUM_THREADS: ${{ matrix.omp }}
@@ -34,17 +35,17 @@ jobs:
3435
omp: [2]
3536

3637
include:
37-
- os: macos-latest
38+
- os: macos-13
3839
version: '1.6'
3940
op: "ISO_OP"
4041
omp: 1
4142

42-
- os: macos-latest
43+
- os: macos-13
4344
version: '1.8'
4445
op: "ISO_OP"
4546
omp: 1
4647

47-
- os: macos-latest
48+
- os: macos-13
4849
version: '1.9'
4950
op: "ISO_OP"
5051
omp: 1
@@ -63,15 +64,6 @@ jobs:
6364
- name: Checkout JUDI
6465
uses: actions/checkout@v4
6566

66-
- name: Cache julia install
67-
uses: actions/cache@v4
68-
env:
69-
cache-name: cache-julia-pkgs
70-
with:
71-
# julia is installed in ~/.julia
72-
path: ~/.julia
73-
key: ${{ matrix.os }}-${{ matrix.version }}-${{ env.cache-name }}
74-
7567
- name: Setup julia
7668
uses: julia-actions/setup-julia@v1
7769
with:
@@ -83,19 +75,6 @@ jobs:
8375
with:
8476
python-version: 3.9
8577

86-
- name: setup devito config
87-
run: |
88-
if [ "${{matrix.os}}" = "macos-latest" ]; then
89-
brew install llvm libomp
90-
echo "/opt/homebrew/bin:/opt/homebrew/opt/llvm/bin" >> GITHUB_PATH
91-
echo "LD_LIBRARY_PATH=/opt/homebrew/opt/llvm/lib" >> GITHUB_ENV
92-
echo "DEVITO_ARCH=clang" >> $GITHUB_ENV
93-
echo "DEVITO_PLATFORM=m1" >> $GITHUB_ENV
94-
else
95-
echo "DEVITO_ARCH=gcc-12" >> $GITHUB_ENV
96-
echo "DEVITO_PLATFORM=cpu64" >> $GITHUB_ENV
97-
fi
98-
9978
- name: Set julia python
10079
run: |
10180
PYTHON=$(which python3) julia -e 'using Pkg;Pkg.add("PyCall");Pkg.build("PyCall")'
@@ -111,4 +90,4 @@ jobs:
11190
- uses: julia-actions/julia-processcoverage@v1
11291
- uses: codecov/codecov-action@v3
11392
with:
114-
file: lcov.info
93+
file: lcov.info

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "JUDI"
22
uuid = "f3b833dc-6b2e-5b9c-b940-873ed6319979"
33
authors = ["Philipp Witte, Mathias Louboutin"]
4-
version = "3.4.2"
4+
version = "3.4.3"
55

66
[deps]
77
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"

src/TimeModeling/Preconditioners/DataPreconditioners.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,9 +198,9 @@ transpose(I::FrequencyFilter{T}) where T = I
198198

199199
function tracefilt!(x, y, ypad, filter)
200200
n = length(y)
201-
ypad[1:n-1] .= view(y, n:-1:2)
202-
ypad[n:end] .= y
203-
x .= filtfilt(filter, ypad)[n:end]
201+
ypad[1:n] .= y
202+
ypad[n:end] .= view(y, n:-1:1)
203+
x .= filtfilt(filter, ypad)[1:n]
204204
nothing
205205
end
206206

src/pysource/fields_exprs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def extended_rec(model, wavelet, v):
102102
return [Inc(ws, model.grid.time_dim.spacing * wf * wt)]
103103

104104

105-
def freesurface(model, eq, mfuncs=None):
105+
def freesurface(model, eq, mfuncs=None, fd_only=False):
106106
"""
107107
Generate the stencil that mirrors the field as a free surface modeling for
108108
the acoustic wave equation
@@ -145,7 +145,8 @@ def freesurface(model, eq, mfuncs=None):
145145

146146
dzmapper = {d: v.subs(mapper) for d, v in Dz.items()}
147147
fs_eq.append(p.func(lhs, rhs.subs(dzmapper), subdomain=fsdomain))
148-
fs_eq.append(p.func(lhs._subs(z, 0), 0, subdomain=fsdomain))
148+
if not fd_only:
149+
fs_eq.append(p.func(lhs._subs(z, 0), 0, subdomain=fsdomain))
149150

150151
return fs_eq
151152

src/pysource/sensitivity.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def grad_expr(gradm, u, v, model, w=None, freq=None, dft_sub=None, ic="as"):
4646
if model.fs and ic in ["fwi", "isic"]:
4747
# Only need `fs` processing for isic for the spatial derivatives.
4848
eq_g = [Eq(gradm, gradm - expr, subdomain=model.grid.subdomains['nofsdomain'])]
49-
eq_g += freesurface(model, eq_g, (*as_tuple(u), *as_tuple(v)))
49+
eq_g += freesurface(model, eq_g, (*as_tuple(u), *as_tuple(v)), fd_only=True)
5050
else:
5151
eq_g = [Eq(gradm, gradm - expr)]
5252
return eq_g

0 commit comments

Comments
 (0)