Skip to content

Commit

Permalink
tiny notebook fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Jun 2, 2023
1 parent 73ea2a9 commit f6c7ae8
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 40 deletions.
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.3.1"
version = "3.3.2"

This comment has been minimized.

Copy link
@mloubout

mloubout Jun 7, 2023

Author Member

[deps]
ChainRulesCore = "d360d2e6-b24c-11e9-a2a3-2a2ae2dbcce4"
Expand Down
8 changes: 4 additions & 4 deletions docs/src/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ export DEVITO_PLATFORM=nvidiaX

## Running with Docker

If you do not want to install JUDI, you can run [JUDI] as a [docker image](https://hub.docker.com/repository/docker/mloubout/judi). The first possibility is to run the docker container as a Jupyter notebook. [JUDI] provides two docker images for the latest [JUDI] release for Julia versions `1.6` (LTS) and `1.7` (latest stable version). The images names are `mloubout/judi:JVER-latest` where `JVER` is the Julia version. This docker images contain pre-installed compilers for CPUs (gcc-10) and Nvidia GPUs (nvc) via the nvidia HPC sdk. The environment is automatically set for [Devito] based on the hardware available.
If you do not want to install JUDI, you can run [JUDI](https://github.com/slimgroup/JUDI.jl) as a [docker image](https://hub.docker.com/repository/docker/mloubout/judi). The first possibility is to run the docker container as a Jupyter notebook. [JUDI](https://github.com/slimgroup/JUDI.jl) provides two docker images for the latest [JUDI](https://github.com/slimgroup/JUDI.jl) release for Julia versions `1.6` (LTS) and `1.7` (latest stable version). The images names are `mloubout/judi:JVER-latest` where `JVER` is the Julia version. This docker images contain pre-installed compilers for CPUs (gcc-10) and Nvidia GPUs (nvc) via the nvidia HPC sdk. The environment is automatically set for [Devito] based on the hardware available.

**Note**: If you wish to use your gpu, you will need to install [nvidia-docker](https://docs.nvidia.com/ai-enterprise/deployment-guide/dg-docker.html) and run `docker run --gpus all` in order to make the GPUs available at runtime from within the image.

To run [JUDI] via docker execute the following command in your terminal:
To run [JUDI](https://github.com/slimgroup/JUDI.jl) via docker execute the following command in your terminal:

```bash
docker run -p 8888:8888 mloubout/judi:1.7-latest
Expand All @@ -65,9 +65,9 @@ docker run -it mloubout/judi:1.7-latest /bin/bash

Inside the container, all examples are located in the directory `/app/judi/examples/scripts`.

**Previous versions**: As of version `v2.6.7` of JUDI, we also ship version-tagged images as `mloubout/judi:JVER-ver` where `ver` is the version of [JUDI] wanted, for example the current [JUDI] version with Julia 1.7 is `mloubout/judi:1.7-v2.6.7`
**Previous versions**: As of version `v2.6.7` of JUDI, we also ship version-tagged images as `mloubout/judi:JVER-ver` where `ver` is the version of [JUDI](https://github.com/slimgroup/JUDI.jl) wanted, for example the current [JUDI](https://github.com/slimgroup/JUDI.jl) version with Julia 1.7 is `mloubout/judi:1.7-v2.6.7`

**Development version**: Additionally, we provide two images corresponding to the latest development version of [JUDI] (latest state of the master branch). These images are called `mloubout/judi:JVER-dev` and can be used in a similar way.
**Development version**: Additionally, we provide two images corresponding to the latest development version of [JUDI](https://github.com/slimgroup/JUDI.jl) (latest state of the master branch). These images are called `mloubout/judi:JVER-dev` and can be used in a similar way.

## Testing

Expand Down
82 changes: 56 additions & 26 deletions examples/notebooks/03_constrained_fwi.ipynb
Original file line number Diff line number Diff line change
@@ -1,25 +1,26 @@
{
"cells": [
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"# FWI Example\n",
"We will peform FWI using the following steps:\n",
"1. [Prepare models](#models)\n",
"2. [Setup Constraints](#constraints) with [SetIntersectionProjection](https://github.com/slimgroup/SetIntersectionProjection.jl)\n",
"3. [Build a small local compute cluster (2 workers)](#cluster)\n",
"1. [Prepare models](#prepare-models)\n",
"2. [Setup Constraints](#setup-constraints-with-setintersectionprojection) with [SetIntersectionProjection](https://github.com/slimgroup/SetIntersectionProjection.jl)\n",
"3. [Build a small local compute cluster (2 workers)](#build-a-small-local-compute-cluster)\n",
" * Take care of some HPC details related to thread affinity\n",
"4. [Create source and receivers geometries](#pos)\n",
"5. [Build `F`, the JUDI modeling operator](#buildF)\n",
"6. [Use `F` to create data for both models](#data)\n",
"7. [Visualize data](#vizD)\n",
"8. [Assess if data is cycle skipped at the farthest offsets](#cskiped)\n",
"9. [Build the `objective` function](#objective)\n",
"10. [Perform the FWI using `minConf_PQN`](#inversion) from [JUDI](https://github.com/slimgroup/JUDI.jl)\n",
"11. [Visualize velocity models and objective function](#plotres)\n",
"12. [Visualize data match](#matchD)\n",
"14. [Remove workers](#del)\n",
"4. [Create source and receivers geometries](#create-source-and-receivers-geometries)\n",
"5. [Build `F`, the JUDI modeling operator](#build-F-the-judi-modeling-operator)\n",
"6. [Use `F` to create data for both models](#use-F-to-create-the-data-in-both-models)\n",
"7. [Visualize data](#visualize-data)\n",
"8. [Assess if data is cycle skipped at the farthest offsets](#assess-if-data-is-cycle-skipped-at-the-farthest-offsets)\n",
"9. [Build the `objective` function](#build-the-objective-functions)\n",
"10. [Perform the FWI using `minConf_PQN`](#perform-the-FWI-using-minConf_PQN) from [JUDI](https://github.com/slimgroup/JUDI.jl)\n",
"11. [Visualize velocity models and objective function](#visualize-velocity-models-and-objective-function)\n",
"12. [Visualize data match](#visualize-data-match)\n",
"13. [Remove workers](#remove-workers)\n",
"\n",
"#### Note on runtime\n",
"Warning: this notebook takes more than 1 hour to run for 16 shots with two workers on an Intel 8168.\n",
Expand Down Expand Up @@ -49,10 +50,11 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 1. Prepare models <a id='models'></a>"
"## Prepare models"
]
},
{
Expand Down Expand Up @@ -89,6 +91,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -129,10 +132,11 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 2. Setup Constraints with [SetIntersectionProjection](https://github.com/slimgroup/SetIntersectionProjection.jl) <a id='constraints'></a>"
"## Setup Constraints with [SetIntersectionProjection](https://github.com/slimgroup/SetIntersectionProjection.jl)"
]
},
{
Expand Down Expand Up @@ -160,6 +164,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -268,10 +273,11 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 3. Build a small local compute cluster (2 workers) <a id='cluster'></a>\n",
"## Build a small local compute cluster\n",
"\n",
"#### Setup OMP environment variables for the cluster\n",
"\n",
Expand Down Expand Up @@ -379,10 +385,11 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 4. Create source and receivers geometries <a id='pos'></a>\n",
"## Create source and receivers geometries\n",
"We use 8 shot locations evenly distributed across the left of the model."
]
},
Expand Down Expand Up @@ -435,6 +442,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -480,10 +488,11 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 5. Build `F`, the JUDI modeling operator <a id='buildF'></a>"
"## Build `F`, the JUDI modeling operator"
]
},
{
Expand All @@ -510,10 +519,11 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 6. Use `F` to create the data in both models <a id='data'></a>"
"## Use `F` to create the data in both models"
]
},
{
Expand Down Expand Up @@ -617,6 +627,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -633,10 +644,11 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 7. Visualize data <a id='vizD'></a>"
"## Visualize data"
]
},
{
Expand All @@ -663,6 +675,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -725,10 +738,11 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 8. Assess if data is cycle skipped at the farthest offsets <a id='cskiped'></a>\n",
"## Assess if data is cycle skipped at the farthest offsets\n",
"Next we plot the far offset traces for these three shots in order to assess if the data is cycle skipped. \n",
"\n",
"You can ovbserve in the plots below that the refraction waveforms (first arrivals) in the initial model are not cycle skipped with respect to the true model, so we can proceed. \n",
Expand Down Expand Up @@ -768,13 +782,15 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 9. Build the `objective` functions <a id='objective'></a>"
"## Build the `objective` functions"
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -811,6 +827,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -868,6 +885,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -986,10 +1004,11 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 10. Perform the FWI using `minConf_PQN` <a id='inversion'></a>\n",
"## Perform the FWI using `minConf_PQN`\n",
"We will do 10 functions evaluation cost of projected quasi-Newton with two setup:\n",
"- Bounds constraints only\n",
"- Bounds + tv constrains"
Expand Down Expand Up @@ -2546,10 +2565,11 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 11. Visualize velocity models and objective function <a id='plotres'></a>"
"## Visualize velocity models and objective function"
]
},
{
Expand Down Expand Up @@ -2587,6 +2607,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -2632,6 +2653,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -2668,6 +2690,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -2705,10 +2728,11 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 12. Visualize data match <a id='matchD'></a>\n",
"## Visualize data match\n",
"#### Generate data in the FWI velocity model"
]
},
Expand Down Expand Up @@ -2757,6 +2781,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand All @@ -2774,6 +2799,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -2841,6 +2867,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -2868,6 +2895,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -2895,6 +2923,7 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
Expand Down Expand Up @@ -2922,10 +2951,11 @@
]
},
{
"attachments": {},
"cell_type": "markdown",
"metadata": {},
"source": [
"## 14. Remove workers <a id='del'></a>"
"## Remove workers"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion src/TimeModeling/LinearOperators/callable.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function (J::judiJacobian{D, O, FT})(q::judiMultiSourceVector) where {D, O, FT}
end

function (J::judiJacobian{D, O, FT})(x::Array{D, N}) where {D, O, FT, N}
if length(x) == prod(J.model.n)
if length(x) == prod(size(J.model))
return J(;m=m)
end
new_q = _as_src(J.qInjection.op, J.model, x)
Expand Down
Loading

1 comment on commit f6c7ae8

@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/85075

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.3.2 -m "<description of version>" f6c7ae8e1309c664bcff6ba585580db838422e0b
git push origin v3.3.2

Please sign in to comment.