-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #87 from slimgroup/scalar-reduce
Misc bug fixes
- Loading branch information
Showing
27 changed files
with
150 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: CI-examples | ||
|
||
on: | ||
# Trigger the workflow on push to master or pull request | ||
# to be merged in master | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test: | ||
name: JUDI example on Julia ${{ matrix.version }} | ||
runs-on: ${{ matrix.os }} | ||
env: | ||
DEVITO_ARCH: gcc-9 | ||
DEVITO_LANGUAGE: "openmp" | ||
DEVITO_BACKEND: "core" | ||
DEVITO_LOGGING: "ERROR" | ||
OMP_NUM_THREADS: ${{ matrix.omp }} | ||
NITER: 1 | ||
|
||
strategy: | ||
fail-fast: false | ||
|
||
matrix: | ||
os: [ubuntu-latest] | ||
omp: [2] | ||
version: [1.6, 1.7] | ||
|
||
steps: | ||
- name: Checkout JUDI | ||
uses: actions/checkout@v2 | ||
|
||
- name: Install GCC 9 | ||
if : runner.os == 'macOS' | ||
run : brew install gcc@9 | ||
|
||
- name: Set julia python | ||
run: | | ||
PYTHON=$(which python3) julia -e 'using Pkg;Pkg.add("PyCall");Pkg.build("PyCall")' | ||
- name: Setup julia | ||
uses: julia-actions/setup-julia@v1 | ||
with: | ||
version: "${{ matrix.version }}" | ||
arch: x64 | ||
|
||
- name: Build JUDI | ||
uses: julia-actions/julia-buildpkg@latest | ||
|
||
- name: Install packages | ||
run: | | ||
julia -e 'using Pkg;Pkg.add(["NLopt", "JOLI", "PyPlot", "IterativeSolvers", "SlimOptim", "HDF5", "SegyIO", "SetIntersectionProjection"])' | ||
julia -e 'using Pkg; Pkg.develop(PackageSpec(path=pwd()))' | ||
- name: Run base examples | ||
working-directory: examples/scripts | ||
run: | | ||
julia -p 2 -e 'for f in filter!(e->e≠"runall.jl", readdir(".")); include(f); end' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
# 2D FWI on Overthrust model using minConf library | ||
# Author: Philipp Witte, [email protected] | ||
# Authors: | ||
# Philipp Witte, [email protected] | ||
# Date: December 2017 | ||
# | ||
# Mathias Louboutin, [email protected] | ||
# Date: January 2022 | ||
|
||
using Statistics, Random, Pkg | ||
using LinearAlgebra | ||
using JUDI, SlimOptim, HDF5, SegyIO, PyPlot, FFTW | ||
using Statistics, Random, LinearAlgebra | ||
using JUDI, SlimOptim, HDF5, SegyIO, PyPlot | ||
using SetIntersectionProjection | ||
|
||
# Load starting model | ||
n,d,o,m0 = read(h5open("../../data/overthrust_model.h5","r"), "n", "d", "o", "m0") | ||
model0 = Model((n[1],n[2]), (d[1],d[2]), (o[1],o[2]), m0) | ||
|
||
# Bound constraints | ||
v0 = sqrt.(1f0 ./ model0.m) | ||
v0 = sqrt.(1f0 ./ m0) | ||
|
||
# Load data | ||
block = segy_read("../../data/overthrust_shot_records.segy") | ||
|
@@ -27,7 +28,7 @@ q = judiVector(src_geometry,wavelet) | |
############################### FWI ########################################### | ||
|
||
# Optimization parameters | ||
niterations = 10 | ||
niterations = parse(Int, get(ENV, "NITER", "10")) | ||
batchsize = 10 | ||
fhistory_SGD = zeros(Float32,niterations) | ||
|
||
|
@@ -50,7 +51,6 @@ options.rho_ini=[1.0f0] | |
|
||
set_zero_subnormals(true) | ||
BLAS.set_num_threads(2) | ||
FFTW.set_num_threads(2) | ||
options.parallel=false | ||
options.feasibility_only = false | ||
options.zero_ini_guess=true | ||
|
@@ -89,7 +89,7 @@ options.rho_ini = ones(length(TD_OP))*10.0 | |
|
||
proj_intersection = x-> PARSDMM(x, AtA, TD_OP, set_Prop, P_sub, model0, options) | ||
|
||
function prj(input) | ||
function proj(input) | ||
input = Float32.(input) | ||
(x,dummy1,dummy2,dymmy3) = proj_intersection(vec(input.data)) | ||
return reshape(x, model0.n) | ||
|
@@ -118,7 +118,7 @@ for j=1:niterations | |
step, fval = ls(ϕ, 1f0, fval, dot(gradient, p)) | ||
|
||
# Update model and bound projection | ||
model0.m = proj(model0.m .+ step .* p) | ||
model0.m .= proj(model0.m .+ step .* p) | ||
end | ||
|
||
figure(); imshow(sqrt.(1f0./adjoint(model0.m))); title("FWI with SPG") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
1 comment
on commit 1ed8989
There was a problem hiding this comment.
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/53014
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 v2.6.4 -m "<description of version>" 1ed8989ce88e5770578d4bd9acf67c929f283e7f
git push origin v2.6.4
@JuliaRegistrator register