Giter VIP home page Giter VIP logo

deepwave's Introduction

Deepwave

DOI

Deepwave provides wave propagation modules for PyTorch, for applications such as seismic imaging/inversion. You can use it to perform forward modelling and backpropagation, so it can simulate wave propagation to generate synthetic data, invert for the scattering potential (RTM/LSRTM), other model parameters (FWI), initial wavefields, or source wavelets. You can use it to integrate wave propagation into a larger chain of operations with end-to-end forward and backpropagation. Deepwave enables you to easily experiment with your own objective functions or functions that generate the inputs to the propagator, letting PyTorch's automatic differentiation do the hard work of calculating how to backpropagate through them.

To install it, I recommend first installing PyTorch using the instructions on the PyTorch website. Deepwave can then be installed using

    pip install deepwave

The documentation contains examples and instructions on how to install and use Deepwave. You might also like to watch a video summary of Deepwave.

Features

  • Supports the 2D constant density acoustic / scalar wave equation (regular and Born modelling) and 2D elastic wave equation (P-SV)
  • Runs on CPUs and appropriate GPUs
  • The gradient of all outputs (final wavefields and receiver data) can be calculated with respect to the model parameters (wavespeed, scattering potential, etc.), initial wavefields, and source amplitudes
  • Uses the Pasalic and McGarry PML for accurate absorbing boundaries in the scalar wave propagator
  • Uses C-PML with the W-AFDA free-surface method for the elastic wave propagator
  • The PML width for each edge can be set independently, allowing a free surface (no PML) on any side
  • Finite difference accuracy can be set by the user
  • A region of the model around the sources and receivers currently being propagated can be automatically extracted to avoid the unnecessary computation of propagation in distant parts of the model
  • Double backpropagation through the regular scalar propagator, including calculating the Hessian

Quick Example

In a few lines you can make a velocity model, propagate a wave from a source in the top left corner to a receiver in the top right, calculate an objective function, and backpropagate to obtain its gradient with respect to the velocity.

import torch
import deepwave
import matplotlib.pyplot as plt

v = 1500 * torch.ones(100, 100)
v[50:] = 2000
v.requires_grad_()

out = deepwave.scalar(
    v, grid_spacing=4, dt=0.004,
    source_amplitudes=deepwave.wavelets.ricker(25, 200, 0.004, 0.06).reshape(1, 1, -1),
    source_locations=torch.tensor([[[0, 0]]]),
    receiver_locations=torch.tensor([[[0, 99]]])
)

(out[-1]**2).sum().backward()

_, ax = plt.subplots(1, 3, figsize=(9, 3))
ax[0].imshow(v.detach())
ax[0].set_title("Velocity model")
ax[1].plot(out[-1].detach().flatten())
ax[1].set_title("Receiver data")
ax[2].imshow(v.grad.detach(), vmin=-1e-5, vmax=1e-5)
ax[2].set_title("Gradient")

Output from quick example

There are more examples in the documentation.

Citing

If you would like to cite Deepwave, I suggest:

@software{richardson_alan_2023,
  author       = {Richardson, Alan},
  title        = {Deepwave},
  month        = sep,
  year         = 2023,
  publisher    = {Zenodo},
  version      = {v0.0.20},
  doi          = {10.5281/zenodo.8381177},
  url          = {https://doi.org/10.5281/zenodo.8381177}
}

deepwave's People

Contributors

ar4 avatar atilasaraiva avatar vkazei avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

deepwave's Issues

A question of gradient calculation when backward with CPML

Hello @ar4 !
I wrote a pure torch version #42 of the autograd_FWI referring to DeepWave. It works well without absorption boundary, although its performance is much worse than DeepWave.
However, when I add a CPML to the two-dimensional elastic wave modeling, the auxiliary variables 'cpml_dpdx' led to the error of gradient calculation when backward.

Would you mind giving me some solutions?

RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation: [torch.FloatTensor [160]] is at version 60; expected version 59 instead. Hint: enable anomaly detection to find the operation that failed to compute its gradient, with torch.autograd.set_detect_anomaly(True).

m_vyy[i] = ay[y] * m_vyy[i] + by[y] * dvydy;

Here is my cpml absorption boundary code, which is similar to your deepwave

dvxdx, cpml_dvxdx = rs_cpml_absorb(dvxdx, cpml_dvxdx, ax, bx, ddx)
dvzdz, cpml_dvzdz = rs_cpml_absorb(dvzdz, cpml_dvzdz, az, bz, ddz)

wavefield.p +=  self.mesh.dt * Mp * (dvxdx + dvzdz)
record[:, it, :] = wavefield.p[:, receiver_location[0], receiver_location[1]]
return record
# def rs_cpml_absorb(dpdx, cpml_dpdx, ax, bx, kkx):   ## Its gradient is not accurate
#     cpml_dpdx.data = bx * cpml_dpdx.data + ax * dpdx.data
#     dpdx.data = dpdx.data / kkx + cpml_dpdx.data
#     return dpdx, cpml_dpdx

def rs_cpml_absorb(dpdx, cpml_dpdx ,ax, bx, kkx):
    cpml_dpdx = bx * cpml_dpdx + ax * dpdx
    dpdx = dpdx / kkx + cpml_dpdx
    return dpdx, cpml_dpdx

-Kelen

GradcheckError with deepwave v0.0.13 on nixpkgs

Hello!

I'm the maintainer for the deepwave package on the Nixpkgs package repository. While updating it to the v0.0.13 version I noticed a particular test is failing and I'd like to report it here. Here is the full test phase log:

    _gradcheck_real_imag(gradcheck_fn, func, func_out, tupled_inputs, outputs, eps,
/nix/store/13hks8798xqfz1xflajl1v29di04r8z1-python3.9-pytorch-1.11.0/lib/python3.9/site-packages/torch/autograd/gradcheck.py:1061: in _gradcheck_real_imag
    gradcheck_fn(func, func_out, tupled_inputs, outputs, eps,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

func = <function scalarbornprop at 0x7ffea053f3a0>
func_out = (tensor([[[ 2.0908e-02,  2.7553e-01,  1.2889e+00,  1.8004e+00,  1.8285e+00,
           1.8062e+00,  1.7811e+00,  1.759...   6.3811e-06, -9.2151e-07, -1.8668e-07]]], dtype=torch.float64,
       grad_fn=<CppNode<ScalarBornCPUFunction>>), ...)
tupled_inputs = (tensor([[1506.1053, 1522.4555, 1523.4253],
        [1517.7099, 1555.6068, 1510.9444],
        [1546.0913, 1570.8365, ...orch.float64,
       requires_grad=True), tensor([[[0, 2],
         [1, 2]],

        [[2, 2],
         [3, 2]]]), ...)
outputs = (tensor([[[ 2.0908e-02,  2.7553e-01,  1.2889e+00,  1.8004e+00,  1.8285e+00,
           1.8062e+00,  1.7811e+00,  1.759...   6.3811e-06, -9.2151e-07, -1.8668e-07]]], dtype=torch.float64,
       grad_fn=<CppNode<ScalarBornCPUFunction>>), ...)
eps = 1e-06, rtol = 1e-05, atol = 1e-08, check_grad_dtypes = True
nondet_tol = 0.001

    def _slow_gradcheck(func, func_out, tupled_inputs, outputs, eps, rtol, atol, check_grad_dtypes,
                        nondet_tol, *, use_forward_ad=False, complex_indices=None, test_imag=False):
        func_out = _as_tuple(func_out)
        if not outputs:
            return _check_no_differentiable_outputs(func, tupled_inputs, func_out, eps)
    
        numerical = _transpose(_get_numerical_jacobian(func, tupled_inputs, outputs, eps=eps, is_forward_ad=use_forward_ad))
    
        if use_forward_ad:
            analytical_forward = _get_analytical_jacobian_forward_ad(func, tupled_inputs, func_out, check_grad_dtypes=check_grad_dtypes)
    
            for i, n_per_out in enumerate(numerical):
                for j, n in enumerate(n_per_out):
                    a = analytical_forward[j][i]
                    if not _allclose_with_type_promotion(a, n.to(a.device), rtol, atol):
                        raise GradcheckError(_get_notallclose_msg(a, n, i, j, complex_indices, test_imag,
                                                                  is_forward_ad=True))
        else:
            for i, o in enumerate(outputs):
                analytical = _check_analytical_jacobian_attributes(tupled_inputs, o, nondet_tol, check_grad_dtypes)
    
                for j, (a, n) in enumerate(zip(analytical, numerical[i])):
                    if not _allclose_with_type_promotion(a, n.to(a.device), rtol, atol):
>                       raise GradcheckError(_get_notallclose_msg(a, n, i, j, complex_indices, test_imag))
E                       torch.autograd.gradcheck.GradcheckError: Jacobian mismatch for output 6 with respect to input 4,
E                       numerical:tensor([[ 3.0910e-06,  3.2390e-04,  1.0494e-02,  ...,  0.0000e+00,
E                                 0.0000e+00,  0.0000e+00],
E                               [-3.1462e-05, -4.6165e-04, -4.2815e-03,  ...,  0.0000e+00,
E                                 0.0000e+00,  0.0000e+00],
E                               [ 1.4742e-05, -3.6820e-03,  4.0949e-03,  ...,  0.0000e+00,
E                                 0.0000e+00,  0.0000e+00],
E                               ...,
E                               [ 0.0000e+00,  0.0000e+00,  0.0000e+00,  ...,  2.1815e-09,
E                                -9.9844e-11, -4.1739e-12],
E                               [ 0.0000e+00,  0.0000e+00,  0.0000e+00,  ..., -3.1082e-10,
E                                 1.0950e-11,  3.4516e-13],
E                               [ 0.0000e+00,  0.0000e+00,  0.0000e+00,  ...,  2.6232e-11,
E                                -8.3089e-13, -2.1348e-14]], dtype=torch.float64)
E                       analytical:tensor([[ 3.0910e-06,  3.2390e-04,  1.0494e-02,  ..., -0.0000e+00,
                    if not _allclose_with_type_promotion(a, n.to(a.device), rtol, atol):
>                       raise GradcheckError(_get_notallclose_msg(a, n, i, j, complex_indices, test_imag))
E                       torch.autograd.gradcheck.GradcheckError: Jacobian mismatch for output 6 with respect to input 4,
E                       numerical:tensor([[ 3.0910e-06,  3.2390e-04,  1.0494e-02,  ...,  0.0000e+00,
E                                 0.0000e+00,  0.0000e+00],
E                               [-3.1462e-05, -4.6165e-04, -4.2815e-03,  ...,  0.0000e+00,
E                                 0.0000e+00,  0.0000e+00],
E                               [ 1.4742e-05, -3.6820e-03,  4.0949e-03,  ...,  0.0000e+00,
E                                 0.0000e+00,  0.0000e+00],
E                               ...,
E                               [ 0.0000e+00,  0.0000e+00,  0.0000e+00,  ...,  2.1815e-09,
E                                -9.9844e-11, -4.1739e-12],
E                               [ 0.0000e+00,  0.0000e+00,  0.0000e+00,  ..., -3.1082e-10,
E                                 1.0950e-11,  3.4516e-13],
E                               [ 0.0000e+00,  0.0000e+00,  0.0000e+00,  ...,  2.6232e-11,
E                                -8.3089e-13, -2.1348e-14]], dtype=torch.float64)
E                       analytical:tensor([[ 3.0910e-06,  3.2390e-04,  1.0494e-02,  ..., -0.0000e+00,
E                                -0.0000e+00, -0.0000e+00],
E                               [-3.1462e-05, -4.6165e-04, -4.2815e-03,  ..., -0.0000e+00,
E                                -0.0000e+00, -0.0000e+00],
E                               [ 1.4742e-05, -3.6820e-03,  4.0949e-03,  ..., -0.0000e+00,
E                                -0.0000e+00, -0.0000e+00],
E                               ...,
E                               [-0.0000e+00, -0.0000e+00, -0.0000e+00,  ...,  2.1815e-09,
E                                -9.9844e-11, -4.1739e-12],
E                               [-0.0000e+00, -0.0000e+00, -0.0000e+00,  ..., -3.1083e-10,
E                                 1.0950e-11,  3.4519e-13],
E                               [-0.0000e+00, -0.0000e+00, -0.0000e+00,  ...,  2.6227e-11,
E                                -8.3129e-13, -2.1350e-14]], dtype=torch.float64)

/nix/store/13hks8798xqfz1xflajl1v29di04r8z1-python3.9-pytorch-1.11.0/lib/python3.9/site-packages/torch/autograd/gradcheck.py:1114: GradcheckError
=========================== short test summary info ============================
FAILED tests/test_scalar_born.py::test_born_gradcheck_2d_different_pml - torc...
================== 1 failed, 74 passed in 2372.49s (0:39:32) ===================

cannot find -lcudart

Hi, Alan.
Thanks for the deepwave.
I also have some problem installing the newest version of deepwave. I used the command " conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=10.2 -c pytorch" to install pytorch and then used "pip install deepwave" . But when I tried to "import deep wave", I have the error below. So could you please tell me which version of pytorch you used?:

Traceback (most recent call last):
File "/nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1808, in _run_ninja_build
subprocess.run(
File "/nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/subprocess.py", line 516, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/nas/home/wxu/lsrtmdip/lsrtm_test_Marmousi.py", line 4, in
import deepwave
File "/nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/deepwave/init.py", line 26, in
torch.utils.cpp_extension.load(
File "/nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1202, in load
return _jit_compile(
File "/nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1425, in _jit_compile
write_ninja_file_and_build_library(
File "/nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1537, in write_ninja_file_and_build_library
run_ninja_build(
File "/nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/utils/cpp_extension.py", line 1824, in run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error building extension 'deepwave': [1/5] c++ -MMD -MF scalar.o.d -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include/TH -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include/THC -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/include -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -march=native -Ofast -fopenmp -c /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/deepwave/scalar.cpp -o scalar.o
[2/5] c++ -MMD -MF scalar_born.o.d -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include/TH -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include/THC -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/include -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -march=native -Ofast -fopenmp -c /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/deepwave/scalar_born.cpp -o scalar_born.o
[3/5] /nas/home/wxu/miniconda3/envs/lsrtmdip/bin/nvcc -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include/TH -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include/THC -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/include -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS
-D__CUDA_NO_BFLOAT16_CONVERSIONS
-D__CUDA_NO_HALF2_OPERATORS
--expt-relaxed-constexpr -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 --compiler-options '-fPIC' --restrict -O3 --use_fast_math -std=c++14 -c /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/deepwave/scalar.cu -o scalar.cuda.o
[4/5] /nas/home/wxu/miniconda3/envs/lsrtmdip/bin/nvcc -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include/TH -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/include/THC -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/include -isystem /nas/home/wxu/miniconda3/envs/lsrtmdip/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS
-D__CUDA_NO_BFLOAT16_CONVERSIONS
-D__CUDA_NO_HALF2_OPERATORS
--expt-relaxed-constexpr -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 --compiler-options '-fPIC' --restrict -O3 --use_fast_math -std=c++14 -c /nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/deepwave/scalar_born.cu -o scalar_born.cuda.o
[5/5] c++ scalar.o scalar_born.o scalar.cuda.o scalar_born.cuda.o -shared -march=native -Ofast -fopenmp -L/nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/lib -lc10 -lc10_cuda -ltorch_cpu -ltorch_cuda_cu -ltorch_cuda_cpp -ltorch -ltorch_python -L/nas/home/wxu/miniconda3/envs/lsrtmdip/lib64 -lcudart -o deepwave.so
FAILED: deepwave.so
c++ scalar.o scalar_born.o scalar.cuda.o scalar_born.cuda.o -shared -march=native -Ofast -fopenmp -L/nas/home/wxu/miniconda3/envs/lsrtmdip/lib/python3.8/site-packages/torch/lib -lc10 -lc10_cuda -ltorch_cpu -ltorch_cuda_cu -ltorch_cuda_cpp -ltorch -ltorch_python -L/nas/home/wxu/miniconda3/envs/lsrtmdip/lib64 -lcudart -o deepwave.so
/usr/bin/ld: cannot find -lcudart: No such file or directory
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.

Process finished with exit code 1

Originally posted by @XuVV in #50 (comment)

Hello @XuVV. I am moving your issue here as I think it has a different cause than Naveen's.

I suspect that NVCC is looking for the CUDA runtime library (libcudart) in the wrong place. To check, please report the output of these commands:
ls /home/wxu/miniconda3/envs/lsrtmdip/lib64/libcudart*
ls /home/wxu/miniconda3/envs/lsrtmdip/lib/libcudart*

Some questions about deepwave

Dear Alan,

I'm very glad to get the so wonderful codes. I try to implement other PML methods some days ago, but the PML method in deepwave have good enough result. So I give up this idea. I have read most codes in the deepwave. I have same questions about it.
question 1,
Is that possible to extend to wave case from acoustic case? I mean using velocity-stress form of the elastodynamic equations to generate seismic data and then we can inverse vp,vs and ฯ using deepwave.
question 2,
Is the deepwave using RNN? I have read the paper that you wrote at 2018 "Seismic Full-Waveform Inversion Using Deep Learning Tools and Techniques". In this paper, you believe conventional seismic FWI can be constructed as a RNN, but I can't found any codes in deepwave about RNN. So, is that true that the forward function of finite difference is the process of RNN?

Add wavefield compression/storage to disk feature

Deepwave currently stores wavefields from forward modeling in memory for use
during backpropagation. This is fine for small 2D models, but is likely to
require more memory than is available for realistic 3D datasets. Adding
storage options that are appropriate for such situations would allow Deepwave
to be applied to more datasets and on low memory systems.

One option that should be provided is to store the wavefields on disk. This
might require that the compiled propagator is called for several time steps,
the saved wavefields from those time steps are saved to disk, and then the
compiled propagator is called again for the next few time steps, etc.

Another option (potentially to be combined with storing to disk) is to
compress the wavefield. There are several possible ways to do this, such as
simply converting to 16 bit floats, but others should also be considered such
as compressing the wavefields using a video encoder.

For GPU propagators, it is preferable that the compression is done on the GPU
as transferring the uncompressed data from GPU to CPU memory could be slow.

It is also possible to avoid this issue by recomputing the forward wavefields during backpropagation. This is an option to consider, but it might add considerable complexity to the code.

Errors and warnings during installation

HI ,Thanks for writing Deepwave!
I ran into the same problem as erellaz, and I can't even implement it on the CPU. I installed deepwave on the computers of friends around me, but we encountered many warnings during the installation process.
Thanks for your sharing. If you have a good way, please let me know.

Originally posted by @Shipeng-Xiao in #27 (comment)

(Moved from #27 in case the problem has a different cause from the one discussed in that issue)

Is that possible to swith the forward and backward function in BornPropagator.

It is nice to see the implementation of Born operator in deepwave. The born approximation is a linear operator. Is that possible to have another function ( Propagator) which considers the RTM imaging as forward operator while the Born modeling as backward operator. Or there exists a simple way to achieve this?

Some problem reinstall deepwave

Dear Alan,

I have coded the elastic case code of the deepwave. But when I test my code, I meet one problem. I try to reinstall the deepwave to compile my cpp and cu codes to pyd file. There is one error I can't solve the detail is as follow:
C:\Users\Keting\Downloads\deepwave\deepwave-master>python setup.py install
Warning: 'classifiers' should be a list, got type 'tuple'
running install
running bdist_egg
running egg_info
writing deepwave.egg-info\PKG-INFO
writing dependency_links to deepwave.egg-info\dependency_links.txt
writing requirements to deepwave.egg-info\requires.txt
writing top-level names to deepwave.egg-info\top_level.txt
reading manifest file 'deepwave.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'deepwave.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
D:\software\anaconda\lib\site-packages\torch\utils\cpp_extension.py:287: UserWarning: Error checking compiler version for cl: [WinError 2] ็ณป็ปŸๆ‰พไธๅˆฐๆŒ‡ๅฎš็š„ๆ–‡ไปถใ€‚
warnings.warn('Error checking compiler version for {}: {}'.format(compiler, error))
building 'scalar1d_cpu_iso_4_float' extension
Emitting ninja build file C:\Users\Keting\Downloads\deepwave\deepwave-master\build\temp.win-amd64-3.8\Release\build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
1.10.2
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\link.exe /nologo /INCREMENTAL:NO /LTCG /DLL /MANIFEST:EMBED,ID=2 /MANIFESTUAC:NO /LIBPATH:D:\software\anaconda\lib\site-packages\torch\lib /LIBPATH:D:\software\anaconda\libs /LIBPATH:D:\software\anaconda\PCbuild\amd64 "/LIBPATH:C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\lib\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.2\lib\um\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\ucrt\x64" "/LIBPATH:C:\Program Files (x86)\Windows Kits\10\lib\10.0.19041.0\um\x64" c10.lib torch.lib torch_cpu.lib torch_python.lib /EXPORT:PyInit_scalar1d_cpu_iso_4_float C:\Users\Keting\Downloads\deepwave\deepwave-master\build\temp.win-amd64-3.8\Release\deepwave\scalar\scalar_cpu.obj C:\Users\Keting\Downloads\deepwave\deepwave-master\build\temp.win-amd64-3.8\Release\deepwave\scalar\scalar.obj C:\Users\Keting\Downloads\deepwave\deepwave-master\build\temp.win-amd64-3.8\Release\deepwave\scalar\scalar_wrapper.obj /OUT:build\lib.win-amd64-3.8\scalar1d_cpu_iso_4_float.cp38-win_amd64.pyd /IMPLIB:C:\Users\Keting\Downloads\deepwave\deepwave-master\build\temp.win-amd64-3.8\Release\deepwave\scalar\scalar1d_cpu_iso_4_float.cp38-win_amd64.lib -fopenmp
LINK : warning LNK4044: unrecognized optionโ€œ/fopenmpโ€๏ผ›ignored
LINK : error LNK2001: unresolved external symbol PyInit_scalar1d_cpu_iso_4_float
C:\Users\Keting\Downloads\deepwave\deepwave-master\build\temp.win-amd64-3.8\Release\deepwave\scalar\scalar1d_cpu_iso_4_float.cp38-win_amd64.lib : fatal error LNK1120: 1 unresolved external command
error: command 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\bin\HostX86\x64\link.exe' failed with exit status 1120

This problem bothered me all day, Do you know how to solve it?

Keting.

Add a Born propagator

Deepwave currently contains forward modeling of the full wavefield, which is
needed for FWI, but seismic imaging, such as LSRTM, needs forward modeling of
the scattered wavefield. This can be obtained using Born forward modeling. This
would use a wave speed model to propagate a source wave as usual,
creating a wavefield u_0, but would also use a scattering amplitude model,
which, in combination with u_0, would be used to calculate the sources for
the scattered wavefield, u_sc. Backpropagation also needs to be defined
so that the scattering amplitude model can be updated.

The propagator should check whether the scattering amplitude model is all
zeros, in which case the scattered wavefield does not need to be calculated
as it will be zero. This is generally the case for RTM and the first iteration
of LSRTM.

Provide PyTorch module that cuts off predicted data < 0s

The source wavelet often begins before time 0, the start of the recorded data in seismic surveys. Deepwave produces receiver amplitudes of the same length as the source amplitude, so in these cases the source amplitudes, and thus the predicted receiver amplitudes, will start before the true receiver amplitudes do. Comparing the predicted and true amplitudes will therefore result in an error unless the beginning of the predicted amplitudes (before time 0) is cut off. This could be done using a new PyTorch module that cuts the predicted amplitudes so that they are the same length as the true amplitudes. It could be used like this:

loss = criterion(new_module(predicted, true))

(where new_module is the new module and I don't know what it should be called). This could probably be a pure Python module that allows autograd to calculate its affect on gradients.

is that possible to get the source file of compiled PYD file?

Hi, I want to know how the propagator works in the scalar.py file, but source file of propagator is the type of PYD, such as "scalar1d_cpu_iso_4_double.cp38-win_amd64.pyd" . I can't open it using any way. So, is that possible to share the source file of these PYD files?

Failed to install on MacOS

Hi,

I tried to install DeepWave on my Macbook. Unfortunately, the installation failed because it failed to build the wheel. Could you assist me with this? I attached the error below. Thank
error.docx
s!

Installation error with cuda

Hi Alan, thanks for your deepwave.
Deepwave-cpu works well for me. But when I install deepwave with cuda on my windows, it returns an error. Looking for your help.
Here is the report from pip.

 "C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin\nvcc" -c deepwave\scalar\scalar_gpu.cu -o build\temp.win-amd64-3.7\Release\deepwave\scalar\scalar_gpu.obj -Ideepwave\scalar -ID:\Miniconda3\envs\deepwave\lib\site-packages\torch\include -ID:\Miniconda3\envs\deepwave\lib\site-packages\torch\include\torch\csrc\api\include -ID:\Miniconda3\envs\deepwave\lib\site-packages\torch\include\TH -ID:\Miniconda3\envs\deepwave\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\include" -ID:\Miniconda3\envs\deepwave\include -ID:\Miniconda3\envs\deepwave\Include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Tools\MSVC\14.29.30133\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Xcudafe--diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcompiler /EHsc -Xcompiler /wd4190 -Xcompiler /wd4018 -Xcompiler /wd4275 -Xcompiler /wd4267 -Xcompiler /wd4244 -Xcompiler /wd4251 -Xcompiler /wd4819 -Xcompiler /MD -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__-D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --restrict -O3 --use_fast_math -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=scalar1d_gpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_8
6,code=sm_86 --use-local-env

C:\Users\dell\AppData\Local\Temp\pip-install-hyawlsyh\deepwave_c21d48d98eb94f2487b9e27bb82533bf\deepwave\scalar\scalar.h(203): fatal error C1189: #error: "Must specify the dimension, e.g. -D DEEPWAVE_DIM=1"
scalar_gpu.cu
error: command 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.6\bin\nvcc.exe' failed with exit code 2
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

ร— Encountered error while trying to install package.
โ•ฐโ”€> deepwave

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.

Improve GPU performance

There are currently many opportunities for improving GPU performance. These include:

  • replacing atomicAdd in imaging_condition, such as with a parallel reduction sum
  • replacing atomicAdd in add_sources, such as by combining sources that are in the same cell
  • only performing the full PML calculation in the PML regions with the simpler plain wave equation in the interior
  • using shared memory for the finite difference calculations
  • adding the option to use cuDNN for the finite difference calculations
  • tuning the threadblock sizes

Issue when maximum offset is smaller than the full model

Dear developer,

First, I'd like to thank you for such wonderful module.

I was trying to implement FWI in a model that is laterally long, such that the wave is not recorded on all the receivers when the source is at the edge. I am getting the error below. If I increase the recording time, I won't get the error but this will increase the computation time which I am trying to reduce as possible.

The below error is actually from the example in the fwi notebook
(https://colab.research.google.com/drive/1PMO1rFAaibRjwjhBuyH3dLQ1sW5wfec_).

I just change nt to :
nt= int(1.5/dt)

Traceback (most recent call last):
File "deepwave_seam_example1.py", line 141, in
batch_rcv_amps_pred = prop(batch_src_amps, batch_x_s, batch_x_r, dt)
File "python3.7/site-packages/torch/nn/modules/module.py", line 532, in call
result = self.forward(*input, **kwargs)
File "/python3.7/site-packages/deepwave/base/propagator.py", line 147, in forward
*model.properties.values())
File "/python3.7/site-packages/deepwave/scalar/scalar.py", line 62, in forward
timestep = Timestep(dt, model.dx, max_vel)
File "/python3.7/site-packages/deepwave/scalar/scalar.py", line 464, in init
self.step_ratio = int(np.ceil(dt / max_dt))
ValueError: cannot convert float NaN to integer

You can see that things sort of blow up even the loss become nan. I checked the CFL condition and everything seem correct.

I hope you can figure the error.

Regards
Abdullah

Allow variable dz

Deepwave currently assumes that all cells in the model have the same shape. Seismic wave speed tends to increase with depth, however, and so it is possible to improve performance without greatly complicating the code by allowing the cell size in the depth direction, dz, to increase with depth. This would require that the finite difference coefficients depend on depth rather than being the same for all cells.

import deepwave error

Hi Alan,

I installed the latest version of deepwave and the installation went smoothly. However, I am unable to import the package and getting the error mentioned below. Could you please help? Thank you.!

My torch version is 1.12.0+cu113

import torch
import deepwave

CalledProcessError Traceback (most recent call last)
File ~/.conda/envs/openfwi/lib/python3.8/site-packages/torch/utils/cpp_extension.py:1808, in _run_ninja_build(build_directory, verbose, error_prefix)
1807 stdout_fileno = 1
-> 1808 subprocess.run(
1809 command,
1810 stdout=stdout_fileno if verbose else subprocess.PIPE,
1811 stderr=subprocess.STDOUT,
1812 cwd=build_directory,
1813 check=True,
1814 env=env)
1815 except subprocess.CalledProcessError as e:
1816 # Python 2 and 3 compatible way of getting the error object.

File ~/.conda/envs/openfwi/lib/python3.8/subprocess.py:516, in run(input, capture_output, timeout, check, *popenargs, **kwargs)
515 if check and retcode:
--> 516 raise CalledProcessError(retcode, process.args,
517 output=stdout, stderr=stderr)
518 return CompletedProcess(process.args, retcode, stdout, stderr)

CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

RuntimeError Traceback (most recent call last)
Cell In[2], line 1
----> 1 import deepwave

File ~/.conda/envs/openfwi/lib/python3.8/site-packages/deepwave/init.py:31
27 if torch.cuda.is_available():
28 sources += [source_dir / 'scalar.cu',
29 source_dir / 'scalar_born.cu',
30 source_dir / 'elastic.cu']
---> 31 torch.utils.cpp_extension.load(
32 name="deepwave",
33 sources=sources,
34 is_python_module=False,
35 extra_cflags=['-march=native', '-Ofast', '-fopenmp'],
36 extra_cuda_cflags=['--restrict', '-O3', '--use_fast_math'],
37 extra_ldflags=['-march=native', '-Ofast', '-fopenmp']
38 )

File ~/.conda/envs/openfwi/lib/python3.8/site-packages/torch/utils/cpp_extension.py:1202, in load(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda, is_python_module, is_standalone, keep_intermediates)
1111 def load(name,
1112 sources: Union[str, List[str]],
1113 extra_cflags=None,
(...)
1121 is_standalone=False,
1122 keep_intermediates=True):
1123 r'''
1124 Loads a PyTorch C++ extension just-in-time (JIT).
1125
(...)
1200 verbose=True)
1201 '''
-> 1202 return _jit_compile(
1203 name,
1204 [sources] if isinstance(sources, str) else sources,
1205 extra_cflags,
1206 extra_cuda_cflags,
1207 extra_ldflags,
1208 extra_include_paths,
1209 build_directory or _get_build_directory(name, verbose),
1210 verbose,
1211 with_cuda,
1212 is_python_module,
1213 is_standalone,
1214 keep_intermediates=keep_intermediates)

File ~/.conda/envs/openfwi/lib/python3.8/site-packages/torch/utils/cpp_extension.py:1425, in _jit_compile(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda, is_python_module, is_standalone, keep_intermediates)
1421 hipified_sources.add(hipify_result[s_abs]["hipified_path"] if s_abs in hipify_result else s_abs)
1423 sources = list(hipified_sources)
-> 1425 _write_ninja_file_and_build_library(
1426 name=name,
1427 sources=sources,
1428 extra_cflags=extra_cflags or [],
1429 extra_cuda_cflags=extra_cuda_cflags or [],
1430 extra_ldflags=extra_ldflags or [],
1431 extra_include_paths=extra_include_paths or [],
1432 build_directory=build_directory,
1433 verbose=verbose,
1434 with_cuda=with_cuda,
1435 is_standalone=is_standalone)
1436 finally:
1437 baton.release()

File ~/.conda/envs/openfwi/lib/python3.8/site-packages/torch/utils/cpp_extension.py:1537, in _write_ninja_file_and_build_library(name, sources, extra_cflags, extra_cuda_cflags, extra_ldflags, extra_include_paths, build_directory, verbose, with_cuda, is_standalone)
1535 if verbose:
1536 print(f'Building extension module {name}...')
-> 1537 _run_ninja_build(
1538 build_directory,
1539 verbose,
1540 error_prefix=f"Error building extension '{name}'")

File ~/.conda/envs/openfwi/lib/python3.8/site-packages/torch/utils/cpp_extension.py:1824, in _run_ninja_build(build_directory, verbose, error_prefix)
1822 if hasattr(error, 'output') and error.output: # type: ignore[union-attr]
1823 message += f": {error.output.decode(*SUBPROCESS_DECODE_ARGS)}" # type: ignore[union-attr]
-> 1824 raise RuntimeError(message) from e

RuntimeError: Error building extension 'deepwave': [1/4] /cm/shared/apps/cuda11.4/toolkit/11.4.2/bin/nvcc -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1013" -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/TH -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/THC -isystem /cm/shared/apps/cuda11.4/toolkit/11.4.2/include -isystem /home/naveengupta/.conda/envs/openfwi/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS_ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' --restrict -O3 --use_fast_math -std=c++14 -c /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/deepwave/elastic.cu -o elastic.cuda.o
FAILED: elastic.cuda.o
/cm/shared/apps/cuda11.4/toolkit/11.4.2/bin/nvcc -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1013" -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/TH -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/THC -isystem /cm/shared/apps/cuda11.4/toolkit/11.4.2/include -isystem /home/naveengupta/.conda/envs/openfwi/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS_ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' --restrict -O3 --use_fast_math -std=c++14 -c /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/deepwave/elastic.cu -o elastic.cuda.o
nvcc fatal : Could not open output file '/localscratch/1139367/tmpxft_00001ff5_0000000a'
[2/4] /cm/shared/apps/cuda11.4/toolkit/11.4.2/bin/nvcc -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1013" -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/TH -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/THC -isystem /cm/shared/apps/cuda11.4/toolkit/11.4.2/include -isystem /home/naveengupta/.conda/envs/openfwi/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS_ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' --restrict -O3 --use_fast_math -std=c++14 -c /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/deepwave/scalar_born.cu -o scalar_born.cuda.o
FAILED: scalar_born.cuda.o
/cm/shared/apps/cuda11.4/toolkit/11.4.2/bin/nvcc -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1013" -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/TH -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/THC -isystem /cm/shared/apps/cuda11.4/toolkit/11.4.2/include -isystem /home/naveengupta/.conda/envs/openfwi/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS_ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' --restrict -O3 --use_fast_math -std=c++14 -c /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/deepwave/scalar_born.cu -o scalar_born.cuda.o
nvcc fatal : Could not open output file '/localscratch/1139367/tmpxft_00001ff4_0000000a'
[3/4] /cm/shared/apps/cuda11.4/toolkit/11.4.2/bin/nvcc -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1013" -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/TH -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/THC -isystem /cm/shared/apps/cuda11.4/toolkit/11.4.2/include -isystem /home/naveengupta/.conda/envs/openfwi/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS_ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' --restrict -O3 --use_fast_math -std=c++14 -c /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/deepwave/scalar.cu -o scalar.cuda.o
FAILED: scalar.cuda.o
/cm/shared/apps/cuda11.4/toolkit/11.4.2/bin/nvcc -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1013" -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/torch/csrc/api/include -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/TH -isystem /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/torch/include/THC -isystem /cm/shared/apps/cuda11.4/toolkit/11.4.2/include -isystem /home/naveengupta/.conda/envs/openfwi/include/python3.8 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS_ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_52,code=sm_52 -gencode=arch=compute_60,code=sm_60 -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_70,code=sm_70 -gencode=arch=compute_75,code=sm_75 -gencode=arch=compute_80,code=sm_80 -gencode=arch=compute_86,code=compute_86 -gencode=arch=compute_86,code=sm_86 --compiler-options '-fPIC' --restrict -O3 --use_fast_math -std=c++14 -c /home/naveengupta/.conda/envs/openfwi/lib/python3.8/site-packages/deepwave/scalar.cu -o scalar.cuda.o
nvcc fatal : Could not open output file '/localscratch/1139367/tmpxft_00001ff3_0000000a'
ninja: build stopped: subcommand failed.

Test and add a description of distributed computation

PyTorch allows distributed computation, and this is usually necessary for realistic datasets. It should be tested to ensure that it works with Deepwave, and a description added to the documentation explaining to users how to do it.

Add source inversion capability

At the moment Deepwave only calculates the gradient of the loss with respect
to the model, but for real data the source wavelet is also often not well
known and must be inverted for. I think it should be possible to add this
capability to Deepwave.

deepwave/scalar/scalar.py will need to be modified to allocate memory to store
this gradient, and to pass this memory and the locations of the sources to
backpropagation, possibly with a flag specifying whether the source gradient
should be calculated (which will depend on whether source_amplitudes has
requires_grad set to True), and also to return the calculated gradient as an
output (replacing the appropriate None value in the list of outputs).

deepwave/scalar/scalar.c and scalar.h will need to be modified to accept the
new inputs into the backward function, and to calculate the gradient.

Installation failed on Linux HPC nodes via Slurm and pip

Hi Alan,

I hope to find you well and in the best of health.

I'm experiencing difficulties in installing deepwave on our HPC nodes which operates on Linux. I tried to install via Slurm and normal pip, unfortunately, no success. Could you assist me with this? I pasted the error below.

Thanks!

Building wheels for collected packages: deepwave
Building wheel for deepwave (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /ibex/scratch/izzatum/pytorch_project/env/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4dd_7iq8/deepwave_8660e702ae784fbdb012b4e28101f5f6/setup.py'"'"'; file='"'"'/tmp/pip-install-4dd_7iq8/deepwave_8660e702ae784fbdb012b4e28101f5f6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-ugjf6an2
cwd: /tmp/pip-install-4dd_7iq8/deepwave_8660e702ae784fbdb012b4e28101f5f6/
Complete output (70 lines):
Warning: 'classifiers' should be a list, got type 'tuple'
running bdist_wheel
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/utils/cpp_extension.py:381: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
warnings.warn(msg.format('we could not find ninja.'))
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/deepwave
copying deepwave/init.py -> build/lib.linux-x86_64-3.9/deepwave
copying deepwave/utils.py -> build/lib.linux-x86_64-3.9/deepwave
copying deepwave/wavelets.py -> build/lib.linux-x86_64-3.9/deepwave
creating build/lib.linux-x86_64-3.9/deepwave/base
copying deepwave/base/init.py -> build/lib.linux-x86_64-3.9/deepwave/base
copying deepwave/base/extract.py -> build/lib.linux-x86_64-3.9/deepwave/base
copying deepwave/base/model.py -> build/lib.linux-x86_64-3.9/deepwave/base
copying deepwave/base/pad.py -> build/lib.linux-x86_64-3.9/deepwave/base
copying deepwave/base/propagator.py -> build/lib.linux-x86_64-3.9/deepwave/base
creating build/lib.linux-x86_64-3.9/deepwave/scalar
copying deepwave/scalar/init.py -> build/lib.linux-x86_64-3.9/deepwave/scalar
copying deepwave/scalar/scalar.py -> build/lib.linux-x86_64-3.9/deepwave/scalar
copying deepwave/scalar/scalar_born.py -> build/lib.linux-x86_64-3.9/deepwave/scalar
running build_ext
building 'scalar1d_cpu_iso_4_float' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/deepwave
creating build/temp.linux-x86_64-3.9/deepwave/scalar
/ibex/scratch/izzatum/pytorch_project/env/bin/x86_64-conda-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -I/ibex/scratch/izzatum/pytorch_project/env/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /ibex/scratch/izzatum/pytorch_project/env/include -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/TH -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/THC -I/ibex/scratch/izzatum/pytorch_project/env/include/python3.9 -c deepwave/scalar/scalar.cpp -o build/temp.linux-x86_64-3.9/deepwave/scalar/scalar.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
/ibex/scratch/izzatum/pytorch_project/env/bin/x86_64-conda-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -I/ibex/scratch/izzatum/pytorch_project/env/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /ibex/scratch/izzatum/pytorch_project/env/include -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/TH -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/THC -I/ibex/scratch/izzatum/pytorch_project/env/include/python3.9 -c deepwave/scalar/scalar_cpu.cpp -o build/temp.linux-x86_64-3.9/deepwave/scalar/scalar_cpu.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
/ibex/scratch/izzatum/pytorch_project/env/bin/x86_64-conda-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -I/ibex/scratch/izzatum/pytorch_project/env/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /ibex/scratch/izzatum/pytorch_project/env/include -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/TH -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/THC -I/ibex/scratch/izzatum/pytorch_project/env/include/python3.9 -c deepwave/scalar/scalar_wrapper.cpp -o build/temp.linux-x86_64-3.9/deepwave/scalar/scalar_wrapper.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
: error: expected '>' before numeric constant
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h:34:32: note: in expansion of macro 'DIM'
34 | template
| ^~~
In file included from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeFunctions.h:6,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/TensorIndexing.h:11,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/ATen.h:20,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/all.h:8,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/extension.h:4,
from deepwave/scalar/scalar_wrapper.cpp:1:
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h: In member function 'at::meta::structured_all_dim::precompute_out at::meta::structured_all_dim::precompute_out< >::set_dim(int64_t)':
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h:38:43: error: static assertion failed: dim already set
38 | static_assert(DIM == false, "dim already set");
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h: At global scope:
: error: expected '>' before numeric constant
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h:51:32: note: in expansion of macro 'DIM'
51 | template
| ^~~
In file included from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeFunctions.h:6,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/TensorIndexing.h:11,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/ATen.h:20,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/all.h:8,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/extension.h:4,
from deepwave/scalar/scalar_wrapper.cpp:1:
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h: In member function 'at::meta::structured_any_dim::precompute_out at::meta::structured_any_dim::precompute_out< >::set_dim(int64_t)':
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h:55:43: error: static assertion failed: dim already set
55 | static_assert(DIM == false, "dim already set");
error: command '/ibex/scratch/izzatum/pytorch_project/env/bin/x86_64-conda-linux-gnu-cc' failed with exit code 1

ERROR: Failed building wheel for deepwave
Running setup.py clean for deepwave
Failed to build deepwave
Installing collected packages: deepwave
Running setup.py install for deepwave ... error
ERROR: Command errored out with exit status 1:
command: /ibex/scratch/izzatum/pytorch_project/env/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4dd_7iq8/deepwave_8660e702ae784fbdb012b4e28101f5f6/setup.py'"'"'; file='"'"'/tmp/pip-install-4dd_7iq8/deepwave_8660e702ae784fbdb012b4e28101f5f6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-7wgksrsr/install-record.txt --single-version-externally-managed --compile --install-headers /ibex/scratch/izzatum/pytorch_project/env/include/python3.9/deepwave
cwd: /tmp/pip-install-4dd_7iq8/deepwave_8660e702ae784fbdb012b4e28101f5f6/
Complete output (70 lines):
Warning: 'classifiers' should be a list, got type 'tuple'
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/deepwave
copying deepwave/init.py -> build/lib.linux-x86_64-3.9/deepwave
copying deepwave/utils.py -> build/lib.linux-x86_64-3.9/deepwave
copying deepwave/wavelets.py -> build/lib.linux-x86_64-3.9/deepwave
creating build/lib.linux-x86_64-3.9/deepwave/base
copying deepwave/base/init.py -> build/lib.linux-x86_64-3.9/deepwave/base
copying deepwave/base/extract.py -> build/lib.linux-x86_64-3.9/deepwave/base
copying deepwave/base/model.py -> build/lib.linux-x86_64-3.9/deepwave/base
copying deepwave/base/pad.py -> build/lib.linux-x86_64-3.9/deepwave/base
copying deepwave/base/propagator.py -> build/lib.linux-x86_64-3.9/deepwave/base
creating build/lib.linux-x86_64-3.9/deepwave/scalar
copying deepwave/scalar/init.py -> build/lib.linux-x86_64-3.9/deepwave/scalar
copying deepwave/scalar/scalar.py -> build/lib.linux-x86_64-3.9/deepwave/scalar
copying deepwave/scalar/scalar_born.py -> build/lib.linux-x86_64-3.9/deepwave/scalar
running build_ext
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/utils/cpp_extension.py:381: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
warnings.warn(msg.format('we could not find ninja.'))
building 'scalar1d_cpu_iso_4_float' extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/deepwave
creating build/temp.linux-x86_64-3.9/deepwave/scalar
/ibex/scratch/izzatum/pytorch_project/env/bin/x86_64-conda-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -I/ibex/scratch/izzatum/pytorch_project/env/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /ibex/scratch/izzatum/pytorch_project/env/include -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/TH -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/THC -I/ibex/scratch/izzatum/pytorch_project/env/include/python3.9 -c deepwave/scalar/scalar.cpp -o build/temp.linux-x86_64-3.9/deepwave/scalar/scalar.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
/ibex/scratch/izzatum/pytorch_project/env/bin/x86_64-conda-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -I/ibex/scratch/izzatum/pytorch_project/env/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /ibex/scratch/izzatum/pytorch_project/env/include -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/TH -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/THC -I/ibex/scratch/izzatum/pytorch_project/env/include/python3.9 -c deepwave/scalar/scalar_cpu.cpp -o build/temp.linux-x86_64-3.9/deepwave/scalar/scalar_cpu.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
/ibex/scratch/izzatum/pytorch_project/env/bin/x86_64-conda-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -I/ibex/scratch/izzatum/pytorch_project/env/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /ibex/scratch/izzatum/pytorch_project/env/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /ibex/scratch/izzatum/pytorch_project/env/include -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/TH -I/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/THC -I/ibex/scratch/izzatum/pytorch_project/env/include/python3.9 -c deepwave/scalar/scalar_wrapper.cpp -o build/temp.linux-x86_64-3.9/deepwave/scalar/scalar_wrapper.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
: error: expected '>' before numeric constant
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h:34:32: note: in expansion of macro 'DIM'
34 | template
| ^~~
In file included from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeFunctions.h:6,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/TensorIndexing.h:11,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/ATen.h:20,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/all.h:8,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/extension.h:4,
from deepwave/scalar/scalar_wrapper.cpp:1:
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h: In member function 'at::meta::structured_all_dim::precompute_out at::meta::structured_all_dim::precompute_out< >::set_dim(int64_t)':
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h:38:43: error: static assertion failed: dim already set
38 | static_assert(DIM == false, "dim already set");
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h: At global scope:
: error: expected '>' before numeric constant
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h:51:32: note: in expansion of macro 'DIM'
51 | template
| ^~~
In file included from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeFunctions.h:6,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/TensorIndexing.h:11,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/ATen.h:20,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/csrc/api/include/torch/all.h:8,
from /ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/torch/extension.h:4,
from deepwave/scalar/scalar_wrapper.cpp:1:
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h: In member function 'at::meta::structured_any_dim::precompute_out at::meta::structured_any_dim::precompute_out< >::set_dim(int64_t)':
/ibex/scratch/izzatum/pytorch_project/env/lib/python3.9/site-packages/torch/include/ATen/NativeMetaFunctions.h:55:43: error: static assertion failed: dim already set
55 | static_assert(DIM == false, "dim already set");
error: command '/ibex/scratch/izzatum/pytorch_project/env/bin/x86_64-conda-linux-gnu-cc' failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /ibex/scratch/izzatum/pytorch_project/env/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4dd_7iq8/deepwave_8660e702ae784fbdb012b4e28101f5f6/setup.py'"'"'; file='"'"'/tmp/pip-install-4dd_7iq8/deepwave_8660e702ae784fbdb012b4e28101f5f6/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(file) if os.path.exists(file) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-7wgksrsr/install-record.txt --single-version-externally-managed --compile --install-headers /ibex/scratch/izzatum/pytorch_project/env/include/python3.9/deepwave Check the logs for full command output.

Import Error when calling the propagator

Thanks for writing Deepwave and generously putting it on Github.

Each time I try to use the propagator I have the following import error. I have tried with various versions of pytorch (18 and 17.1), as well as with various examples (the main example and the seam example provided on kolab) and am not sure which direction to go from here. Any pointer would be helpful. Thanks!

Traceback (most recent call last):
File "deepwave_demo.py", line 26, in
receiver_amplitudes = prop(source_amplitudes, x_s, x_r, dt)
File "/home/gu/anaconda3/lib/python3.8/site-packages/torch/nn/modules/module.py", line 722, in _call_impl
result = self.forward(*input, **kwargs)
File "/home/gu/.local/lib/python3.8/site-packages/deepwave/base/propagator.py", line 144, in forward
return self.propfunc.apply(source_amplitudes, source_locations,
File "/home/gu/.local/lib/python3.8/site-packages/deepwave/scalar/scalar.py", line 90, in forward
scalar_wrapper = _select_propagator(model.ndim, vp.dtype, vp.is_cuda)
File "/home/gu/.local/lib/python3.8/site-packages/deepwave/scalar/scalar.py", line 320, in _select_propagator
import scalar2d_cpu_iso_4_float as scalar_wrapper
ImportError: /home/gu/.local/lib/python3.8/site-packages/scalar2d_cpu_iso_4_float.cpython-38-x86_64-linux-gnu.so: undefined symbol: _ZN6caffe28TypeMeta21_typeMetaDataInstanceISt7complexIdEEEPKNS_6detail12TypeMetaDataEv

save time snapshots

Is there a way to store time snapshots of 3D wavefield at given time intervals for visualization?

Installation error

Hi Alan,

Hope all is well and glad to catch up with you on GitHub! I try to install deepwave via a clean conda environment but failed.
My setup is ubuntu=20.04, python=3.9, torch=1.10.1 with gpu. I suspect I need to switch to gcc 10 (current gcc 9) for tigerlake. Could you please shed some lights on how to specify gcc when installing deepwave if possible? The following is the error message I had.

Thank you very much for the help!

Best regards,
Yong

(seis) yma@lambda [~]$ pip install deepwave
Collecting deepwave
  Using cached deepwave-0.0.9.tar.gz (33 kB)
Requirement already satisfied: numpy in ./anaconda3/envs/seis/lib/python3.9/site-packages (from deepwave) (1.21.2)
Requirement already satisfied: scipy in ./anaconda3/envs/seis/lib/python3.9/site-packages (from deepwave) (1.7.3)
Requirement already satisfied: torch>=1.7.1 in ./anaconda3/envs/seis/lib/python3.9/site-packages (from deepwave) (1.10.1)
Requirement already satisfied: typing_extensions in ./anaconda3/envs/seis/lib/python3.9/site-packages (from torch>=1.7.1->deepwave) (3.10.0.2)
Building wheels for collected packages: deepwave
  Building wheel for deepwave (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/yxm906/anaconda3/envs/seis/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mo3c3l_h/deepwave_f6845b09ab8b4b499a587a516d9ff97c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mo3c3l_h/deepwave_f6845b09ab8b4b499a587a516d9ff97c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-hm0_egvy
       cwd: /tmp/pip-install-mo3c3l_h/deepwave_f6845b09ab8b4b499a587a516d9ff97c/
  Complete output (35 lines):
  Warning: 'classifiers' should be a list, got type 'tuple'
  running bdist_wheel
  /home/yxm906/anaconda3/envs/seis/lib/python3.9/site-packages/torch/utils/cpp_extension.py:381: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
    warnings.warn(msg.format('we could not find ninja.'))
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/deepwave
  copying deepwave/wavelets.py -> build/lib.linux-x86_64-3.9/deepwave
  copying deepwave/__init__.py -> build/lib.linux-x86_64-3.9/deepwave
  copying deepwave/utils.py -> build/lib.linux-x86_64-3.9/deepwave
  creating build/lib.linux-x86_64-3.9/deepwave/scalar
  copying deepwave/scalar/scalar.py -> build/lib.linux-x86_64-3.9/deepwave/scalar
  copying deepwave/scalar/scalar_born.py -> build/lib.linux-x86_64-3.9/deepwave/scalar
  copying deepwave/scalar/__init__.py -> build/lib.linux-x86_64-3.9/deepwave/scalar
  creating build/lib.linux-x86_64-3.9/deepwave/base
  copying deepwave/base/pad.py -> build/lib.linux-x86_64-3.9/deepwave/base
  copying deepwave/base/model.py -> build/lib.linux-x86_64-3.9/deepwave/base
  copying deepwave/base/propagator.py -> build/lib.linux-x86_64-3.9/deepwave/base
  copying deepwave/base/extract.py -> build/lib.linux-x86_64-3.9/deepwave/base
  copying deepwave/base/__init__.py -> build/lib.linux-x86_64-3.9/deepwave/base
  running build_ext
  /home/yxm906/anaconda3/envs/seis/lib/python3.9/site-packages/torch/utils/cpp_extension.py:782: UserWarning: The detected CUDA version (11.1) has a minor version mismatch with the version that was used to compile PyTorch (11.3). Most likely this shouldn't be a problem.
    warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
  building 'scalar1d_cpu_iso_4_float' extension
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/deepwave
  creating build/temp.linux-x86_64-3.9/deepwave/scalar
  gcc -pthread -B /home/yxm906/anaconda3/envs/seis/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/yxm906/anaconda3/envs/seis/include -I/home/yxm906/anaconda3/envs/seis/include -fPIC -O2 -isystem /home/yxm906/anaconda3/envs/seis/include -fPIC -DDEEPWAVE_DIM=1 -DDEEPWAVE_TYPE=float -Ideepwave/scalar -I/home/yxm906/anaconda3/envs/seis/lib/python3.9/site-packages/torch/include -I/home/yxm906/anaconda3/envs/seis/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/yxm906/anaconda3/envs/seis/lib/python3.9/site-packages/torch/include/TH -I/home/yxm906/anaconda3/envs/seis/lib/python3.9/site-packages/torch/include/THC -I/home/yxm906/anaconda3/envs/seis/include/python3.9 -c deepwave/scalar/scalar.cpp -o build/temp.linux-x86_64-3.9/deepwave/scalar/scalar.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
  cc1plus: error: bad value (โ€˜tigerlakeโ€™) for โ€˜-march=โ€™ switch
  cc1plus: note: valid arguments to โ€˜-march=โ€™ switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 btver1 btver2 native
  cc1plus: error: bad value (โ€˜tigerlakeโ€™) for โ€˜-mtune=โ€™ switch
  cc1plus: note: valid arguments to โ€˜-mtune=โ€™ switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm intel x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 btver1 btver2 generic native
  error: command '/usr/bin/gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for deepwave
  Running setup.py clean for deepwave
Failed to build deepwave
Installing collected packages: deepwave
    Running setup.py install for deepwave ... error
    ERROR: Command errored out with exit status 1:
     command: /home/yxm906/anaconda3/envs/seis/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mo3c3l_h/deepwave_f6845b09ab8b4b499a587a516d9ff97c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mo3c3l_h/deepwave_f6845b09ab8b4b499a587a516d9ff97c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-c37e8b70/install-record.txt --single-version-externally-managed --compile --install-headers /home/yxm906/anaconda3/envs/seis/include/python3.9/deepwave
         cwd: /tmp/pip-install-mo3c3l_h/deepwave_f6845b09ab8b4b499a587a516d9ff97c/
    Complete output (35 lines):
    Warning: 'classifiers' should be a list, got type 'tuple'
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.9
    creating build/lib.linux-x86_64-3.9/deepwave
    copying deepwave/wavelets.py -> build/lib.linux-x86_64-3.9/deepwave
    copying deepwave/__init__.py -> build/lib.linux-x86_64-3.9/deepwave
    copying deepwave/utils.py -> build/lib.linux-x86_64-3.9/deepwave
    creating build/lib.linux-x86_64-3.9/deepwave/scalar
    copying deepwave/scalar/scalar.py -> build/lib.linux-x86_64-3.9/deepwave/scalar
    copying deepwave/scalar/scalar_born.py -> build/lib.linux-x86_64-3.9/deepwave/scalar
    copying deepwave/scalar/__init__.py -> build/lib.linux-x86_64-3.9/deepwave/scalar
    creating build/lib.linux-x86_64-3.9/deepwave/base
    copying deepwave/base/pad.py -> build/lib.linux-x86_64-3.9/deepwave/base
    copying deepwave/base/model.py -> build/lib.linux-x86_64-3.9/deepwave/base
    copying deepwave/base/propagator.py -> build/lib.linux-x86_64-3.9/deepwave/base
    copying deepwave/base/extract.py -> build/lib.linux-x86_64-3.9/deepwave/base
    copying deepwave/base/__init__.py -> build/lib.linux-x86_64-3.9/deepwave/base
    running build_ext
    /home/yxm906/anaconda3/envs/seis/lib/python3.9/site-packages/torch/utils/cpp_extension.py:381: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
      warnings.warn(msg.format('we could not find ninja.'))
    /home/yxm906/anaconda3/envs/seis/lib/python3.9/site-packages/torch/utils/cpp_extension.py:782: UserWarning: The detected CUDA version (11.1) has a minor version mismatch with the version that was used to compile PyTorch (11.3). Most likely this shouldn't be a problem.
      warnings.warn(CUDA_MISMATCH_WARN.format(cuda_str_version, torch.version.cuda))
    building 'scalar1d_cpu_iso_4_float' extension
    creating build/temp.linux-x86_64-3.9
    creating build/temp.linux-x86_64-3.9/deepwave
    creating build/temp.linux-x86_64-3.9/deepwave/scalar
    gcc -pthread -B /home/yxm906/anaconda3/envs/seis/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -O2 -Wall -fPIC -O2 -isystem /home/yxm906/anaconda3/envs/seis/include -I/home/yxm906/anaconda3/envs/seis/include -fPIC -O2 -isystem /home/yxm906/anaconda3/envs/seis/include -fPIC -DDEEPWAVE_DIM=1 -DDEEPWAVE_TYPE=float -Ideepwave/scalar -I/home/yxm906/anaconda3/envs/seis/lib/python3.9/site-packages/torch/include -I/home/yxm906/anaconda3/envs/seis/lib/python3.9/site-packages/torch/include/torch/csrc/api/include -I/home/yxm906/anaconda3/envs/seis/lib/python3.9/site-packages/torch/include/TH -I/home/yxm906/anaconda3/envs/seis/lib/python3.9/site-packages/torch/include/THC -I/home/yxm906/anaconda3/envs/seis/include/python3.9 -c deepwave/scalar/scalar.cpp -o build/temp.linux-x86_64-3.9/deepwave/scalar/scalar.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="_gcc" -DPYBIND11_STDLIB="_libstdcpp" -DPYBIND11_BUILD_ABI="_cxxabi1011" -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
    cc1plus: error: bad value (โ€˜tigerlakeโ€™) for โ€˜-march=โ€™ switch
    cc1plus: note: valid arguments to โ€˜-march=โ€™ switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 btver1 btver2 native
    cc1plus: error: bad value (โ€˜tigerlakeโ€™) for โ€˜-mtune=โ€™ switch
    cc1plus: note: valid arguments to โ€˜-mtune=โ€™ switch are: nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm intel x86-64 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 btver1 btver2 generic native
    error: command '/usr/bin/gcc' failed with exit code 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /home/yxm906/anaconda3/envs/seis/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-mo3c3l_h/deepwave_f6845b09ab8b4b499a587a516d9ff97c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-mo3c3l_h/deepwave_f6845b09ab8b4b499a587a516d9ff97c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-c37e8b70/install-record.txt --single-version-externally-managed --compile --install-headers /home/yxm906/anaconda3/envs/seis/include/python3.9/deepwave Check the logs for full command output.

Provide conventional FWI convenience function

Although it is not difficult to write a simple FWI script using Deepwave, some casual users may prefer to have a function that they simply call to run FWI for them. It could also eventually include some popular variants of FWI, such as inverting from low to high frequencies, source inversion, phase-only inversion, and commonly-used regularization methods, etc.

The function should probably have as its required arguments the true receiver data amplitudes and locations, source locations, dt, the migration aperture, and perhaps topology. This should be enough to create a sensible initial model and source amplitudes, and begin inversion.

getting error installing deepwave

USed pip install deepwave. Got the error
Collecting deepwave
Using cached deepwave-0.0.8.tar.gz (32 kB)
Requirement already satisfied: numpy in ./.julia/conda/3/lib/python3.7/site-packages (from deepwave) (1.19.1)
Requirement already satisfied: scipy in ./.julia/conda/3/lib/python3.7/site-packages (from deepwave) (1.5.2)
Requirement already satisfied: torch>=1.7.1 in ./.julia/conda/3/lib/python3.7/site-packages (from deepwave) (1.9.0)
Requirement already satisfied: typing-extensions in ./.julia/conda/3/lib/python3.7/site-packages (from torch>=1.7.1->deepwave) (3.10.0.0)
Building wheels for collected packages: deepwave
Building wheel for deepwave (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /home/student/adhara/.julia/conda/3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_i3g067i/deepwave/setup.py'"'"'; file='"'"'/tmp/pip-install-_i3g067i/deepwave/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-fcoxjojq
cwd: /tmp/pip-install-_i3g067i/deepwave/
Complete output (129 lines):
Warning: 'classifiers' should be a list, got type 'tuple'
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/deepwave
copying deepwave/init.py -> build/lib.linux-x86_64-3.7/deepwave
copying deepwave/utils.py -> build/lib.linux-x86_64-3.7/deepwave
copying deepwave/wavelets.py -> build/lib.linux-x86_64-3.7/deepwave
creating build/lib.linux-x86_64-3.7/deepwave/base
copying deepwave/base/init.py -> build/lib.linux-x86_64-3.7/deepwave/base
copying deepwave/base/extract.py -> build/lib.linux-x86_64-3.7/deepwave/base
copying deepwave/base/model.py -> build/lib.linux-x86_64-3.7/deepwave/base
copying deepwave/base/pad.py -> build/lib.linux-x86_64-3.7/deepwave/base
copying deepwave/base/propagator.py -> build/lib.linux-x86_64-3.7/deepwave/base
creating build/lib.linux-x86_64-3.7/deepwave/scalar
copying deepwave/scalar/init.py -> build/lib.linux-x86_64-3.7/deepwave/scalar
copying deepwave/scalar/scalar.py -> build/lib.linux-x86_64-3.7/deepwave/scalar
copying deepwave/scalar/scalar_born.py -> build/lib.linux-x86_64-3.7/deepwave/scalar
running build_ext
/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py:312: UserWarning:

                             !! WARNING !!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your compiler (g++ 4.8.5) may be ABI-incompatible with PyTorch!
Please use a compiler that is ABI-compatible with GCC 5.0 and above.
See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html.

See https://gist.github.com/goldsborough/d466f43e8ffc948ff92de7486c5216d6
for instructions on how to install GCC 5 or higher.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                            !! WARNING !!

warnings.warn(ABI_INCOMPATIBILITY_WARNING.format(compiler))

building 'scalar1d_cpu_iso_4_float' extension
creating /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7
creating /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave
creating /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar
/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py:287: UserWarning:

                             !! WARNING !!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your compiler (c++) is not compatible with the compiler Pytorch was
built with for this platform, which is g++ on linux. Please
use g++ to to compile your extension. Alternatively, you may
compile PyTorch from source using c++, and then you can also use
c++ to compile your extension.

See https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md for help
with compiling PyTorch from source.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                            !! WARNING !!

platform=sys.platform))

Emitting ninja build file /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/3] c++ -MMD -MF /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_cpu.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/TH -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/THC -I/home/student/adhara/.julia/conda/3/include/python3.7m -c -c /tmp/pip-install-_i3g067i/deepwave/deepwave/scalar/scalar_cpu.cpp -o /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_cpu.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
FAILED: /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_cpu.o
c++ -MMD -MF /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_cpu.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/TH -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/THC -I/home/student/adhara/.julia/conda/3/include/python3.7m -c -c /tmp/pip-install-_i3g067i/deepwave/deepwave/scalar/scalar_cpu.cpp -o /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_cpu.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
c++: error: unrecognized command line option \u2018-std=c++14\u2019
[2/3] c++ -MMD -MF /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/TH -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/THC -I/home/student/adhara/.julia/conda/3/include/python3.7m -c -c /tmp/pip-install-_i3g067i/deepwave/deepwave/scalar/scalar.cpp -o /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
FAILED: /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar.o
c++ -MMD -MF /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/TH -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/THC -I/home/student/adhara/.julia/conda/3/include/python3.7m -c -c /tmp/pip-install-_i3g067i/deepwave/deepwave/scalar/scalar.cpp -o /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
c++: error: unrecognized command line option \u2018-std=c++14\u2019
[3/3] c++ -MMD -MF /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_wrapper.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/TH -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/THC -I/home/student/adhara/.julia/conda/3/include/python3.7m -c -c /tmp/pip-install-_i3g067i/deepwave/deepwave/scalar/scalar_wrapper.cpp -o /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_wrapper.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
FAILED: /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_wrapper.o
c++ -MMD -MF /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_wrapper.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/TH -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/THC -I/home/student/adhara/.julia/conda/3/include/python3.7m -c -c /tmp/pip-install-_i3g067i/deepwave/deepwave/scalar/scalar_wrapper.cpp -o /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_wrapper.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
c++: error: unrecognized command line option \u2018-std=c++14\u2019
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1672, in _run_ninja_build
env=env)
File "/home/student/adhara/.julia/conda/3/lib/python3.7/subprocess.py", line 512, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-install-_i3g067i/deepwave/setup.py", line 69, in
cmdclass={'build_ext': BuildExtension}
File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/setuptools/init.py", line 153, in setup
return distutils.core.setup(**attrs)
File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/core.py", line 148, in setup
dist.run_commands()
File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/dist.py", line 966, in run_commands
self.run_command(cmd)
File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/wheel/bdist_wheel.py", line 223, in run
self.run_command('build')
File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/command/build.py", line 135, in run
self.run_command(cmd_name)
File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/dist.py", line 985, in run_command
cmd_obj.run()
File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 79, in run
_build_ext.run(self)
File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/command/build_ext.py", line 340, in run
self.build_extensions()
File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 709, in build_extensions
build_ext.build_extensions(self)
File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
_build_ext.build_extension(self, ext)
File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
depends=ext.depends)
File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 539, in unix_wrap_ninja_compile
with_cuda=with_cuda)
File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1360, in _write_ninja_file_and_compile_objects
error_prefix='Error compiling objects for extension')
File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1682, in _run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension

ERROR: Failed building wheel for deepwave
Running setup.py clean for deepwave
Failed to build deepwave
Installing collected packages: deepwave
Running setup.py install for deepwave ... error
ERROR: Command errored out with exit status 1:
command: /home/student/adhara/.julia/conda/3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_i3g067i/deepwave/setup.py'"'"'; file='"'"'/tmp/pip-install-_i3g067i/deepwave/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-oo1lavtr/install-record.txt --single-version-externally-managed --compile --install-headers /home/student/adhara/.julia/conda/3/include/python3.7m/deepwave
cwd: /tmp/pip-install-_i3g067i/deepwave/
Complete output (131 lines):
Warning: 'classifiers' should be a list, got type 'tuple'
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.7
creating build/lib.linux-x86_64-3.7/deepwave
copying deepwave/init.py -> build/lib.linux-x86_64-3.7/deepwave
copying deepwave/utils.py -> build/lib.linux-x86_64-3.7/deepwave
copying deepwave/wavelets.py -> build/lib.linux-x86_64-3.7/deepwave
creating build/lib.linux-x86_64-3.7/deepwave/base
copying deepwave/base/init.py -> build/lib.linux-x86_64-3.7/deepwave/base
copying deepwave/base/extract.py -> build/lib.linux-x86_64-3.7/deepwave/base
copying deepwave/base/model.py -> build/lib.linux-x86_64-3.7/deepwave/base
copying deepwave/base/pad.py -> build/lib.linux-x86_64-3.7/deepwave/base
copying deepwave/base/propagator.py -> build/lib.linux-x86_64-3.7/deepwave/base
creating build/lib.linux-x86_64-3.7/deepwave/scalar
copying deepwave/scalar/init.py -> build/lib.linux-x86_64-3.7/deepwave/scalar
copying deepwave/scalar/scalar.py -> build/lib.linux-x86_64-3.7/deepwave/scalar
copying deepwave/scalar/scalar_born.py -> build/lib.linux-x86_64-3.7/deepwave/scalar
running build_ext
/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py:312: UserWarning:

                               !! WARNING !!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your compiler (g++ 4.8.5) may be ABI-incompatible with PyTorch!
Please use a compiler that is ABI-compatible with GCC 5.0 and above.
See https://gcc.gnu.org/onlinedocs/libstdc++/manual/abi.html.

See https://gist.github.com/goldsborough/d466f43e8ffc948ff92de7486c5216d6
for instructions on how to install GCC 5 or higher.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                              !! WARNING !!

  warnings.warn(ABI_INCOMPATIBILITY_WARNING.format(compiler))
building 'scalar1d_cpu_iso_4_float' extension
creating /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7
creating /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave
creating /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar
/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py:287: UserWarning:

                               !! WARNING !!

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
Your compiler (c++) is not compatible with the compiler Pytorch was
built with for this platform, which is g++ on linux. Please
use g++ to to compile your extension. Alternatively, you may
compile PyTorch from source using c++, and then you can also use
c++ to compile your extension.

See https://github.com/pytorch/pytorch/blob/master/CONTRIBUTING.md for help
with compiling PyTorch from source.
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                              !! WARNING !!

  platform=sys.platform))
Emitting ninja build file /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/3] c++ -MMD -MF /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_cpu.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/TH -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/THC -I/home/student/adhara/.julia/conda/3/include/python3.7m -c -c /tmp/pip-install-_i3g067i/deepwave/deepwave/scalar/scalar_cpu.cpp -o /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_cpu.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
FAILED: /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_cpu.o
c++ -MMD -MF /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_cpu.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/TH -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/THC -I/home/student/adhara/.julia/conda/3/include/python3.7m -c -c /tmp/pip-install-_i3g067i/deepwave/deepwave/scalar/scalar_cpu.cpp -o /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_cpu.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
c++: error: unrecognized command line option \u2018-std=c++14\u2019
[2/3] c++ -MMD -MF /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_wrapper.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/TH -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/THC -I/home/student/adhara/.julia/conda/3/include/python3.7m -c -c /tmp/pip-install-_i3g067i/deepwave/deepwave/scalar/scalar_wrapper.cpp -o /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_wrapper.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
FAILED: /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_wrapper.o
c++ -MMD -MF /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_wrapper.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/TH -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/THC -I/home/student/adhara/.julia/conda/3/include/python3.7m -c -c /tmp/pip-install-_i3g067i/deepwave/deepwave/scalar/scalar_wrapper.cpp -o /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar_wrapper.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
c++: error: unrecognized command line option \u2018-std=c++14\u2019
[3/3] c++ -MMD -MF /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/TH -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/THC -I/home/student/adhara/.julia/conda/3/include/python3.7m -c -c /tmp/pip-install-_i3g067i/deepwave/deepwave/scalar/scalar.cpp -o /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
FAILED: /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar.o
c++ -MMD -MF /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DDIM=1 -DTYPE=float -Ideepwave/scalar -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/TH -I/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/include/THC -I/home/student/adhara/.julia/conda/3/include/python3.7m -c -c /tmp/pip-install-_i3g067i/deepwave/deepwave/scalar/scalar.cpp -o /tmp/pip-install-_i3g067i/deepwave/build/temp.linux-x86_64-3.7/deepwave/scalar/scalar.o -Ofast -march=native -fopenmp -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=scalar1d_cpu_iso_4_float -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
c++: error: unrecognized command line option \u2018-std=c++14\u2019
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1672, in _run_ninja_build
    env=env)
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-install-_i3g067i/deepwave/setup.py", line 69, in <module>
    cmdclass={'build_ext': BuildExtension}
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/setuptools/__init__.py", line 153, in setup
    return distutils.core.setup(**attrs)
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/dist.py", line 966, in run_commands
    self.run_command(cmd)
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/setuptools/command/install.py", line 61, in run
    return orig.install.run(self)
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/command/install.py", line 545, in run
    self.run_command('build')
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/command/build.py", line 135, in run
    self.run_command(cmd_name)
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/dist.py", line 985, in run_command
    cmd_obj.run()
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 79, in run
    _build_ext.run(self)
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/command/build_ext.py", line 340, in run
    self.build_extensions()
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 709, in build_extensions
    build_ext.build_extensions(self)
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/command/build_ext.py", line 449, in build_extensions
    self._build_extensions_serial()
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/command/build_ext.py", line 474, in _build_extensions_serial
    self.build_extension(ext)
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/setuptools/command/build_ext.py", line 202, in build_extension
    _build_ext.build_extension(self, ext)
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/distutils/command/build_ext.py", line 534, in build_extension
    depends=ext.depends)
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 539, in unix_wrap_ninja_compile
    with_cuda=with_cuda)
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1360, in _write_ninja_file_and_compile_objects
    error_prefix='Error compiling objects for extension')
  File "/home/student/adhara/.julia/conda/3/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1682, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension
----------------------------------------

ERROR: Command errored out with exit status 1: /home/student/adhara/.julia/conda/3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_i3g067i/deepwave/setup.py'"'"'; file='"'"'/tmp/pip-install-_i3g067i/deepwave/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(file);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, file, '"'"'exec'"'"'))' install --record /tmp/pip-record-oo1lavtr/install-record.txt --single-version-externally-managed --compile --install-headers /home/student/adhara/.julia/conda/3/include/python3.7m/deepwave Check the logs for full command output.
(deepwave3) bash-4.2$

Convert zero crossing check into a proper test

The test directory contains a notebook that allows a visual check that the
zero-crossing of the gradient for a 1D step model is in approximately the
right place. This helps to identify timestep misalignment between the
wavefields used in the imaging condition and other off-by-one errors.
It should be converted into a proper automated test. This may involve using
interpolation or root finding from a package such as SciPy.

Suggestion: High-order accuracy forward model for avoiding inverse crime

Hi Alan,

I hope to find you well and in the best of health.

I'm wondering if DeepWave has the functionality to change the order of accuracy of the forward problem. Is such functionality available?

This would be a nice improvement since it could help us avoiding the inverse crime in the inversion.

Thanks! :)

example run issue.

Dear Friends.

I have just executed the example and the kernel is dying at this step.

receiver_amplitudes = prop(source_amplitudes, x_s, x_r, dt)

I am using python 3.6.8 and pytorch 1.0.0
can anyone guide what the issue can be? I am not using any CUDA. Only CPU based cluster.

Greetings.

About the PML

Dear Alan,

I'm sorry to disturb you again. After reading the source code of finite difference wave equation discretization. I have some questions about PML, I don't know why you set the auxiliary wavefield like this. I wonder the paper to support the auxiliary wavefield and the PML. Thank you very much!!

-Keting

Segmentation Fault on Cuda 9.0

Hi Alan,

Trying to get deepwave running on a fresh installed conda environment.
My versions are:

  • python-3.6
  • pytorch-cpu-4.1
  • cuda-9.0
  • cudnn 7.0
  • deepwave installed via pip install deepwave (version 0.0.4)
  • gcc-4.8.5
    Trying to run the example provided in Readme but the example fails on
    receiver_amplitudes = prop(source_amplitudes, x_s, x_r, dt)
    with a Segmentation Fault
    Any hints on what might be causing the seg-fault?
    Many thanks for your help!

Add GPU propagators

Finite difference wave propagation involves a type of computation that GPUs
(graphics processing units) are suitable for. Creating GPU versions of the
propagators could therefore enable speed-ups for users who have appropriate
GPUs. One of the benefits of basing Deepwave on PyTorch is the ease of using
GPUs. There is a PyTorch tutorial that explains how to create a CUDA extension.

Add aperture feature

Deepwave currently propagates a wavefield that covers the entire model, even
if the sources and receivers are confined to a small region of it. It is
typical to avoid this inefficiency by allowing the user to specify a migration
aperture distance.

The definition to use for this aperture will need to be
decided, but it will probably need to be a 4 element Tensor, allowing
the aperture on each side of the y and x dimensions to be specified.
(Seismic applications wouldn't generally require such an aperture
in the z dimension, but perhaps it should be considered to improve
generality.) It will also need to consider the situation when multiple shots
are being propagated simultaneously. All of these shots need to use the
same model (at least that's the way the code currently works),
so the section of the model that is used for propagation will
probably need to be that which includes the min and max over all of the
shots being propagated simultaneously.

Getting error : Segmentation fault (core dumped)

Dear Sir,

I installed deepwave and other modules successfully and then tried running the first wave propagation example.

When I try to do this line:
receiver_amplitudes = prop(source_amplitudes, x_s, x_r, dt)

I get the following error : Segmentation fault (core dumped)

Thanks and Regards,
Arnab

Provide survey setup functions

A somewhat tedious part of using Deepwave is the need to construct Tensors containing the source and receiver locations. It would be more convenient for users if there were functions that created these for common layouts when a few parameters are specified. For example, it could be capable of producing the location Tensors for a simple towed geometry when given the source and receiver spacing, the number of shots and receivers per shot, the distance from the closest receiver to the source, and the initial source location.

There is currently a Ricker wavelet function in the test directory, which is used during the automated tests, but this should probably be brought out into the main package so that users can easily create source amplitude Tensors with typical source wavelets.

function object has no attribute 'Propagator'

Hello,

I am running a simple example of deepwave on google colab, and my test notebook worked until Friday.
Today, when I call:
prop = deepwave.scalar.Propagator({'vp': model_true.to(device)}, dx)
I got:

AttributeError Traceback (most recent call last)
in ()
1 # Create 'true' data
----> 2 prop = deepwave.scalar.Propagator({'vp': model_true.to(device)}, dx)
3 receiver_amplitudes_true = prop(source_amplitudes_true.to(device),
4 x_s.to(device),
5 x_r.to(device), dt).cpu()

AttributeError: 'function' object has no attribute 'Propagator'

I think that something is broken. Unfortunately, I do not have yet a stable version inside a container to check if there is some problem with my code. The notebook starts with "!pip install deepwave", so I am getting the newest version.

Allow user to specify finite difference accuracy

Deepwave currently only provides 4th order accurate finite difference
computations. In some situations users may want higher accuracy, and so it
is desirable to provide the option of other accuracies.

This will require changes to the Python Function side, where the finite
difference coefficients are calculated, and also to the compiled code side
where the finite difference calculations occur. One option for the compiled
code is to use macros to define the calculations for different accuracies
(#ifdef ORDER==4, etc.) similar to the way the dimension is currently used to
chose which calculation to perform. These finite differences occur in the
inner-most loop of the calculation, so it is preferable to avoid function
calls.

The finite difference accuracy also determines the number of cells of padding
that are added around the model, so changing the accuracy should change
the number of padding cells.

Some questions about deepwave

Dear Alan,

I'm very glad to get the so wonderful codes. I try to implement other PML methods some days ago, but the PML method in deepwave have good enough result. So I give up this idea. I have read most codes in the deepwave. I have same questions about it.
question 1,
Is that possible to extend to wave case from acoustic case? I mean using velocity-stress form of the elastodynamic equations to generate seismic data and then we can inverse vp,vs and ฯ using deepwave.
question 2,
Is the deepwave using RNN? I have read the paper that you wrote at 2018 "Seismic Full-Waveform Inversion Using Deep Learning Tools and Techniques". In this paper, you believe conventional seismic FWI can be constructed as a RNN, but I can't found any codes in deepwave about RNN. So, is that true that the forward function of finite difference is the process of RNN?

Add a variable density acoustic propagator

Deepwave currently only contains a constant density acoustic (scalar)
propagator. Creating a new propagator (perhaps called 'acoustic') would
benefit some users. There will probably be significant code overlap with the
scalar propagator, so some restructuring may be necessary to avoid repetition
(probably creating a Propagator base class that both inherit from).

Example not working with torch 0.4.1

Using an anaconda environment with pytorch 0.4.1 I tried to run the example provided on README. On

y = (1 - 2 * math.pi**2 * freq**2 * t**2) * torch.exp(-math.pi**2 * freq**2 * t**2)

I get the error:

RuntimeError: "exp" not implemented for 'torch.LongTensor'

how can I set the setup of a survey?

Greetings,
I have a problem with setting the source and receiver coordinates. I want to 2 receivers (in the start and end) and multiple sources in between. How do we set the position of them? Also, can we set the source to be in depth? Thanks in advance

ModuleNotFoundError: No module named 'deepwave'

Hi Alan,

I am trying to import deepwave in a newly created conda virtual environment. I was able to install it successfully, however, when I try to import it, it says deepwave module not found. I can see that the package is installed inside the lib directory of the python that I am using, but, still it is unable to import it.
Screen Shot 2023-03-15 at 12 28 59 PM

Could you please provide any advise in this situation?

About the results

Greetings, i can't understand the results from the receiver_amplitudes. I get a shape of (250,250,1) and the data shape is (201,301). My code is the following:

`dx = 10 # 10m in each dimension
dt = 0.004 # 4ms --- Sampling Interval
nz = np.shape(data)[0]
ny = np.shape(data)[1]
nt = int(1 / dt) # 1s --- Sampling freq
r_spacing = dx*(ny-1)
s_spacing = dx
ymax = (ny-1)*dx
num_shots = int(np.floor(ymax / s_spacing))
coord_receivers = tr.linspace(0,ymax,2)
num_receivers_per_shot = int(len(coord_receivers))
num_sources_per_shot = 1
num_dims = 2
peak_freq = 4
peak_source_time = 1/peak_freq

model

model = tr.tensor(data)

"""
source and receiver position --- x_s -> Tensor of shape [num_shots, num_sources_per_shot, num_dimensions]
--- x_r -> Tensor of shape [num_shots, num_receivers_per_shot, num_dimensions]
"""

x_r = tr.zeros(num_shots,num_receivers_per_shot,num_dims)
for j in range(num_receivers_per_shot):
x_r[:,j,1] = coord_receivers[j] #receiver potition

x_s = tr.zeros(num_shots, num_sources_per_shot, num_dims)
for j in range(num_sources_per_shot):
x_s[:,0,1] = tr.linspace(ymax/2, ymax, num_shots) #sources potition
x_s[:,0,0] = 100#tr.linspace(0,(nz-1)*dx, len(x_s[:,0,1])) #depth

Ricker Wavelet

source_amplitudes = (dp.wavelets.ricker(peak_freq, nt, dt,
peak_source_time).reshape(-1, 1, 1).repeat(1, num_shots, num_sources_per_shot))

prop = dp.scalar.Propagator({'vp': model}, dx)
receiver_amplitudes = prop(source_amplitudes, x_s, x_r, dt)`

CUDA out of memory when running Reverse-Time Migration of Marmousi example

Hi, Doctor. Sorry to bother you again.

When I tried to run Reverse-Time Migration of Marmousi example using the following code, it shows that CUDA out of memory.

Run optimisation/inversion

n_epochs = 1
n_batch = 60
n_shots_per_batch = (n_shots + n_batch - 1) // n_batch
for epoch in range(n_epochs):
    epoch_loss = 0
    # optimiser.zero_grad()
    for batch in range(n_batch):
        print(batch)
        optimiser.zero_grad()
        batch_start = batch * n_shots_per_batch
        batch_end = min(batch_start + n_shots_per_batch, n_shots)
        if batch_end <= batch_start:
            continue
        s = slice(batch_start, batch_end)

        simulated_data = scalar_born(v_mig.detach(), scatter, dx, dt,
                                     source_amplitudes=source_amplitudes[s].detach(),
                                     source_locations=source_locations[s].detach(),
                                     receiver_locations=receiver_locations[s].detach(),
                                     pml_freq=freq)
        loss = (1e9 * loss_fn(simulated_data[-1] * mask[s], observed_scatter_masked[s]))
        epoch_loss += loss.item()
        loss.backward()
        optimiser.step()
        # del simulated_data
        # torch.cuda.empty_cache()
    print(epoch_loss)

I found that it can be run at the 1st batch, the command "scalar_born" will take about 11002Mb space of GPU, but at the 2nd batch, instead of releasing this 11002Mb space (or let's say using this same space), the command "scalar_born" will take another about 11002Mb of GPU, then at and after the 3rd batch, the situation of taking GPU memory doesn't change anymore.

I am so confuesd about that why at the 2nd batch, it will take another space of GPU, is it normal?

Provide SEG-Y I/O functions

There are excellent Python SEG-Y I/O packages, such as segyio. These tend to provide more flexibility than is needed for the pre-stack cases that Deepwave targets. It may thus be convenient for users if there were wrappers around segyio (or another package) to simplify pre-stack usage. It should be able to save forward modeled receiver amplitudes as a new SEG-Y, and read the true receiver data for use in backpropagation (potentially split over multiple files). Being able to read navigation files (P1 format, etc.) would also be great, as would the ability to operate when distributed across a cluster and to integrate with PyTorch DataLoaders.

import deepwave error

Hi Alan,

I installed the latest version of deepwave, and the installation went smoothly. However, I received an error when I imported the package. Kindly find the error messages below. Thanks! -Muhammad

`Python 3.10.4 (main, Mar 31 2022, 08:41:55) [GCC 7.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import torch
import deepwave

Traceback (most recent call last):
File "/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1740, in _run_ninja_build
subprocess.run(
File "/home/izzatum/anaconda3/envs/metaot/lib/python3.10/subprocess.py", line 524, in run
raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "", line 1, in
File "/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/init.py", line 26, in
torch.utils.cpp_extension.load(
File "/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1144, in load
return _jit_compile(
File "/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1357, in _jit_compile
write_ninja_file_and_build_library(
File "/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1469, in write_ninja_file_and_build_library
run_ninja_build(
File "/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/utils/cpp_extension.py", line 1756, in run_ninja_build
raise RuntimeError(message) from e
RuntimeError: Error building extension 'deepwave': [1/5] c++ -MMD -MF scalar.o.d -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/TH -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/THC -isystem /home/izzatum/anaconda3/envs/metaot/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -march=native -Ofast -fopenmp -c /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar.cpp -o scalar.o
[2/5] c++ -MMD -MF scalar_born.o.d -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/TH -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/THC -isystem /home/izzatum/anaconda3/envs/metaot/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -march=native -Ofast -fopenmp -c /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cpp -o scalar_born.o
[3/5] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/TH -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/THC -isystem /home/izzatum/anaconda3/envs/metaot/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS
-D__CUDA_NO_BFLOAT16_CONVERSIONS
-D__CUDA_NO_HALF2_OPERATORS
--expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 --compiler-options '-fPIC' --restrict -O3 --use_fast_math -std=c++14 -c /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar.cu -o scalar.cuda.o
FAILED: scalar.cuda.o
/usr/bin/nvcc -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/TH -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/THC -isystem /home/izzatum/anaconda3/envs/metaot/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS
-D__CUDA_NO_BFLOAT16_CONVERSIONS
-D__CUDA_NO_HALF2_OPERATORS
--expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 --compiler-options '-fPIC' --restrict -O3 --use_fast_math -std=c++14 -c /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar.cu -o scalar.cuda.o
/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar.cu(522): error: expression must have a constant value
/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar.cu(522): note: attempt to access run-time storage

/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar.cu(522): error: expression must have a constant value
/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar.cu(522): note: attempt to access run-time storage

/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar.cu(676): error: expression must have a constant value
/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar.cu(676): note: attempt to access run-time storage

/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar.cu(676): error: expression must have a constant value
/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar.cu(676): note: attempt to access run-time storage

4 errors detected in the compilation of "/tmp/tmpxft_000a4225_00000000-4_scalar.cpp4.ii".
[4/5] /usr/bin/nvcc -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/TH -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/THC -isystem /home/izzatum/anaconda3/envs/metaot/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS_ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 --compiler-options '-fPIC' --restrict -O3 --use_fast_math -std=c++14 -c /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu -o scalar_born.cuda.o
FAILED: scalar_born.cuda.o
/usr/bin/nvcc -DTORCH_EXTENSION_NAME=deepwave -DTORCH_API_INCLUDE_EXTENSION_H -DPYBIND11_COMPILER_TYPE="gcc" -DPYBIND11_STDLIB="libstdcpp" -DPYBIND11_BUILD_ABI="cxxabi1011" -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/torch/csrc/api/include -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/TH -isystem /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/torch/include/THC -isystem /home/izzatum/anaconda3/envs/metaot/include/python3.10 -D_GLIBCXX_USE_CXX11_ABI=0 -D__CUDA_NO_HALF_OPERATORS -D__CUDA_NO_HALF_CONVERSIONS_ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 -gencode=arch=compute_75,code=compute_75 -gencode=arch=compute_75,code=sm_75 --compiler-options '-fPIC' --restrict -O3 --use_fast_math -std=c++14 -c /home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu -o scalar_born.cuda.o
/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu(867): error: expression must have a constant value
/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu(867): note: attempt to access run-time storage

/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu(867): error: expression must have a constant value
/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu(867): note: attempt to access run-time storage

/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu(1090): error: expression must have a constant value
/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu(1090): note: attempt to access run-time storage

/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu(1090): error: expression must have a constant value
/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu(1090): note: attempt to access run-time storage

/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu(1090): error: expression must have a constant value
/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu(1090): note: attempt to access run-time storage

/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu(1090): error: expression must have a constant value
/home/izzatum/anaconda3/envs/metaot/lib/python3.10/site-packages/deepwave/scalar_born.cu(1090): note: attempt to access run-time storage

6 errors detected in the compilation of "/tmp/tmpxft_000a4226_00000000-4_scalar_born.cpp4.ii".
ninja: build stopped: subcommand failed.
`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.