Skip to content

Commit

Permalink
Merge pull request #256 from slimgroup/fs-fix
Browse files Browse the repository at this point in the history
Fs fix
  • Loading branch information
mloubout authored Jun 3, 2024
2 parents 5d43f62 + 432cb5a commit ca7c08a
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
- name: Set julia python
run: |
python3 -m pip install -U pip
python3 -m pip install matplotlib seiscm colorcet
python3 -m pip install "matplotlib<3.9" seiscm colorcet
echo "PYTHON=$(which python3)" >> $GITHUB_ENV
julia -e 'using Pkg;Pkg.add(["PyCall", "PyPlot", "SlimPlotting"])'
Expand Down
27 changes: 3 additions & 24 deletions .github/workflows/ci-judi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
name: JUDI base on Julia ${{ matrix.version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
DEVITO_ARCH: gcc-11
DEVITO_LANGUAGE: "openmp"
OMP_NUM_THREADS: 4
GROUP: "JUDI"
Expand All @@ -28,21 +29,12 @@ jobs:

matrix:
version: ['1.6', '1.7', '1.8', '1.9', '1.10']
os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest, macos-13]

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

- name: Cache julia install
uses: actions/cache@v4
env:
cache-name: cache-julia-pkgs
with:
# julia is installed in ~/.julia
path: ~/.julia
key: ${{ matrix.os }}-${{ matrix.version }}-${{ env.cache-name }}

- name: Setup julia
uses: julia-actions/setup-julia@v1
with:
Expand All @@ -54,19 +46,6 @@ jobs:
with:
python-version: 3.9

- name: setup devito config
run: |
if [ "${{matrix.os}}" = "macos-latest" ]; then
brew install llvm libomp
echo "/opt/homebrew/bin:/opt/homebrew/opt/llvm/bin" >> GITHUB_PATH
echo "LD_LIBRARY_PATH=/opt/homebrew/opt/llvm/lib" >> GITHUB_ENV
echo "DEVITO_ARCH=clang" >> $GITHUB_ENV
echo "DEVITO_PLATFORM=m1" >> $GITHUB_ENV
else
echo "DEVITO_ARCH=gcc-12" >> $GITHUB_ENV
echo "DEVITO_PLATFORM=cpu64" >> $GITHUB_ENV
fi
- name: Set julia python
run: |
PYTHON=$(which python3) julia -e 'using Pkg;Pkg.add("PyCall");Pkg.build("PyCall")'
Expand All @@ -82,4 +61,4 @@ jobs:
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
file: lcov.info
file: lcov.info
31 changes: 5 additions & 26 deletions .github/workflows/ci-op.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
name: ${{ matrix.op }} on Julia ${{ matrix.version }} - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
DEVITO_ARCH: gcc-11
DEVITO_LANGUAGE: "openmp"
DEVITO_LOGGING: "INFO"
OMP_NUM_THREADS: ${{ matrix.omp }}
Expand All @@ -34,17 +35,17 @@ jobs:
omp: [2]

include:
- os: macos-latest
- os: macos-13
version: '1.6'
op: "ISO_OP"
omp: 1

- os: macos-latest
- os: macos-13
version: '1.8'
op: "ISO_OP"
omp: 1

- os: macos-latest
- os: macos-13
version: '1.9'
op: "ISO_OP"
omp: 1
Expand All @@ -63,15 +64,6 @@ jobs:
- name: Checkout JUDI
uses: actions/checkout@v4

- name: Cache julia install
uses: actions/cache@v4
env:
cache-name: cache-julia-pkgs
with:
# julia is installed in ~/.julia
path: ~/.julia
key: ${{ matrix.os }}-${{ matrix.version }}-${{ env.cache-name }}

- name: Setup julia
uses: julia-actions/setup-julia@v1
with:
Expand All @@ -83,19 +75,6 @@ jobs:
with:
python-version: 3.9

- name: setup devito config
run: |
if [ "${{matrix.os}}" = "macos-latest" ]; then
brew install llvm libomp
echo "/opt/homebrew/bin:/opt/homebrew/opt/llvm/bin" >> GITHUB_PATH
echo "LD_LIBRARY_PATH=/opt/homebrew/opt/llvm/lib" >> GITHUB_ENV
echo "DEVITO_ARCH=clang" >> $GITHUB_ENV
echo "DEVITO_PLATFORM=m1" >> $GITHUB_ENV
else
echo "DEVITO_ARCH=gcc-12" >> $GITHUB_ENV
echo "DEVITO_PLATFORM=cpu64" >> $GITHUB_ENV
fi
- name: Set julia python
run: |
PYTHON=$(which python3) julia -e 'using Pkg;Pkg.add("PyCall");Pkg.build("PyCall")'
Expand All @@ -111,4 +90,4 @@ jobs:
- uses: julia-actions/julia-processcoverage@v1
- uses: codecov/codecov-action@v3
with:
file: lcov.info
file: lcov.info
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "JUDI"
uuid = "f3b833dc-6b2e-5b9c-b940-873ed6319979"
authors = ["Philipp Witte, Mathias Louboutin"]
version = "3.4.2"
version = "3.4.3"

This comment has been minimized.

Copy link
@mloubout

mloubout Jun 3, 2024

Author Member

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
6 changes: 3 additions & 3 deletions src/TimeModeling/Preconditioners/DataPreconditioners.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,9 @@ transpose(I::FrequencyFilter{T}) where T = I

function tracefilt!(x, y, ypad, filter)
n = length(y)
ypad[1:n-1] .= view(y, n:-1:2)
ypad[n:end] .= y
x .= filtfilt(filter, ypad)[n:end]
ypad[1:n] .= y
ypad[n:end] .= view(y, n:-1:1)
x .= filtfilt(filter, ypad)[1:n]
nothing
end

Expand Down
5 changes: 3 additions & 2 deletions src/pysource/fields_exprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def extended_rec(model, wavelet, v):
return [Inc(ws, model.grid.time_dim.spacing * wf * wt)]


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

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

return fs_eq

Expand Down
2 changes: 1 addition & 1 deletion src/pysource/sensitivity.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def grad_expr(gradm, u, v, model, w=None, freq=None, dft_sub=None, ic="as"):
if model.fs and ic in ["fwi", "isic"]:
# Only need `fs` processing for isic for the spatial derivatives.
eq_g = [Eq(gradm, gradm - expr, subdomain=model.grid.subdomains['nofsdomain'])]
eq_g += freesurface(model, eq_g, (*as_tuple(u), *as_tuple(v)))
eq_g += freesurface(model, eq_g, (*as_tuple(u), *as_tuple(v)), fd_only=True)
else:
eq_g = [Eq(gradm, gradm - expr)]
return eq_g
Expand Down

1 comment on commit ca7c08a

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/108150

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v3.4.3 -m "<description of version>" ca7c08a59ee80a18fe7e690d77e5aaa0f7080833
git push origin v3.4.3

Please sign in to comment.