devitocodes / devito

DSL and compiler framework for automated finite-differences and stencil computation
http://www.devitoproject.org
MIT License
557 stars 226 forks source link

The `unknown` compiler isn't available on this system #796

Closed BosungLim closed 5 years ago

BosungLim commented 5 years ago

Hi everyone!

Trying to run FDM on Devito but get a message as following. "The unknown compiler isn't available on this system"

The code is running good on the other machine.

I am using Ubuntu 18.3 with Python3.6. In fact I had exactly the same errors on Windows 10 and have just moved to Ubuntu.

Anyone knows what to do?

CavalcanteLucas commented 5 years ago

how did you install devito ?

BosungLim commented 5 years ago

how did you install devito ?

As the instruction says, I did conda+pip and just pip, but not docker yet.

CavalcanteLucas commented 5 years ago

have you installed all dependencies with pip install -e . and activated the environment with source activate devito?

BosungLim commented 5 years ago

have you installed all dependencies with pip install -e . and activated the environment with source activate devito?

Yep!

CavalcanteLucas commented 5 years ago

can you paste the piece of code you're trying to run, please

BosungLim commented 5 years ago

can you paste the piece of code you're trying to run, please

I was wondering if it can generate data with and without multiples by putting air layers on top if absorbing BC is applied all 4 boundaries. To do so, I have modified example code as following:

BosungLim commented 5 years ago

import numpy as np import matplotlib.pyplot as plt import skimage.transform as trans from scipy.misc import imresize from scipy import signal from devito import TimeFunction from devito import Eq, solve from devito import Operator from examples.seismic import Model, plot_velocity from examples.seismic import Receiver from examples.seismic import RickerSource from examples.seismic import TimeAxis from examples.seismic import plot_shotrecord

##############################################

---------Velocity Modeling Define---------

##############################################

Define a physical size

Vel = np.load('/home/bslim/Documents/Machine_Learning_BSLim/UNet/2D_Modeling/Marmousi2_Vp.npy')/1000 Vp = np.zeros((int(len(Vel[:, 0])/10), int(len(Vel[0, :])/10)), dtype=float) shape = np.shape(Vp)

Model Resampling

model_resample = 10 for i in range(0, shape[0]): for j in range(0, shape[1]): Vp[i, j] = Vel[imodel_resample, jmodel_resample]

Air Layer to Generate Multiple

Vp[:, :2] = 0.35

grid_size = 5. spacing = (grid_size, grid_size) origin = (0., 0.)

We also define the size of the absorbing layer as 10 grid points

model = Model(vp=Vp, origin=origin, shape=shape, spacing=spacing, space_order=2, nbpml=10)

plot_velocity(model)

##############################################

-------------Equation to FDM--------------

##############################################

Define the wavefield with the size of the model and the time dimension

u = TimeFunction(name="u", grid=model.grid, time_order=2, space_order=2)

We can now write the PDE

pde = model.m u.dt2 - u.laplace + model.damp u.dt

##############################################

----------Acquisition Geometry------------

############################################## t0 = 0. # Simulation starts a t=0 tn = 1500. # Simulation last 1 second (1000 ms) dt = model.critical_dt # Time step from model grid spacing

time_range = TimeAxis(start=t0, stop=tn, step=dt)

##############################################

--------Source Wavelet & Geometry---------

############################################## f0 = 0.007 src = RickerSource(name='src', grid=model.grid, f0=f0, npoint=1, time_range=time_range)

##############################################

---------------S/R Geometry---------------

############################################## No_Rec = 601 Rec_Scale = 1

No_Shot = shape[0]-int(No_Rec/Rec_Scale)-1

No_Shot = 200

No_Shot = 2

Offset = No_Rec * (grid_size/Rec_Scale)

shot_gather = np.zeros((No_Shot, int(np.ceil(tn/dt)+1), No_Rec), dtype=float) for i in range(No_Shot): print(i)

Source Location

src.coordinates.data[0, :] = (np.array(model.domain_size) .5) + (i10)

source_location = i*grid_size
src.coordinates.data[0, :] = source_location
src.coordinates.data[0, -1] = 40.

# Receiver Location
rec = Receiver(name='rec', grid=model.grid, npoint=No_Rec, time_range=time_range)

rec.coordinates.data[:, 0] = np.linspace(0, model.domain_size[0], num=No_Rec)

rec.coordinates.data[:, 0] = np.linspace(source_location+grid_size, (source_location+grid_size)+Offset, num=No_Rec)
rec.coordinates.data[:, 1] = 40.

tmp = model.domain_size[0]

tmp2 = np.linspace(0, model.domain_size[0], num=No_Rec)

tmp3 = (np.array(model.domain_size) .5) + (i10)

# FDM Solving
stencil = Eq(u.forward, solve(pde, u.forward))

# Finally we define the source injection and receiver read function to generate the corresponding code
src_term = src.inject(field=u.forward, expr=src * dt**2 / model.m)

# Create interpolation expression for receivers
rec_term = rec.interpolate(expr=u.forward)

op = Operator([stencil] + src_term + rec_term, subs=model.spacing_map)

#NBVAL_IGNORE_OUTPUT
op(time=time_range.num-1, dt=model.critical_dt)
shot_gather[i, :, :] = rec.data

src.show()

plot_velocity(model, source=src.coordinates.data, receiver=rec.coordinates.data[::4, :])

plot_shotrecord(shot_gather[0, :, :], model, t0, tn) np.save('/home/bslim/Documents/Machine_Learning_BSLim/UNet/2D_Modeling/shot_gather_with_multiple_small.npy', shot_gather)

assert np.isclose(np.linalg.norm(rec.data), 450, rtol=10)

for i in range(len(shot_gather[1, :, 1])): for j in range(len(shot_gather[1, 1, :])): r = np.sqrt(((igrid_size)(igrid_size)) + ((jgrid_size)(jgrid_size)))

r = ((igrid_size)(igrid_size)) + ((jgrid_size)(jgrid_size))

    shot_gather[1, i, j] = shot_gather[1, i, j]*r

tmp = shot_gather[1, 1000:1512, :512]

tmp = trans.resize(tmp, [256, 256])

tmp = imresize(tmp, (256, 256))

plt.imshow(tmp) plt.show()

CavalcanteLucas commented 5 years ago

can you please paste the error prompt you're getting?

BosungLim commented 5 years ago

can you please paste the error prompt you're getting?

The unknown compiler isn't available on this system ERROR:Devito:The unknown compiler isn't available on this system An exception has occurred, use %tb to see the full traceback.

SystemExit: 1

/home/bslim/anaconda3/envs/devito/lib/python3.6/site-packages/IPython/core/interactiveshell.py:3304: UserWarning: To exit: use 'exit', 'quit', or Ctrl-D. warn("To exit: use 'exit', 'quit', or Ctrl-D.", stacklevel=1)

CavalcanteLucas commented 5 years ago

can you please paste full traceback

are you syncd with latest master? (try git checkout master then git pull from devito's installation path)

BosungLim commented 5 years ago

Already on 'master' Your branch is up to date with 'origin/master'.

Already up to date.

CavalcanteLucas commented 5 years ago

are you trying to run in from within a jupyter-notebook?

BosungLim commented 5 years ago

I did on both anaconda spyder and just terminal.

CavalcanteLucas commented 5 years ago

i'm trying to run it here. can you share the file Marmousi2_Vp.npy or a sample of it?

BosungLim commented 5 years ago

i'm trying to run it here. can you share the file Marmousi2_Vp.npy or a sample of it?

How can I share it? I am not familiar with git yet and do not know how to put an attachment. Anyway, following is how I created the '*.npy" file.

import numpy as np import matplotlib.pyplot as plt from obspy.io.segy.segy import _read_segy

SEG-Y Header Information

No_Trace = 13601 No_Sample = 2801 DT_Sample = 1250

Data Loading

stream = _read_segy('/home/bslim/Documents/Machine_Learning_BSLim/Marmousi2_Model/MODEL_P-WAVE_VELOCITY_1.25m.segy', headonly=True) Vp = np.zeros((No_Trace, No_Sample), dtype=np.float32)

for i in range(No_Trace): Vp[i, :] = stream.traces[i].data

Vp[:, :800] = 1500

np.save('/home/bslim/Documents/Machine_Learning_BSLim/UNet/2D_Modeling/Marmousi2_Vp.npy', Vp)

Vel = np.load('/home/bslim/Documents/Machine_Learning_BSLim/UNet/2D_Modeling/Marmousi2_Vp.npy') Vel = Vel.transpose()

plt.imshow(Vel) plt.show

BosungLim commented 5 years ago

i'm trying to run it here. can you share the file Marmousi2_Vp.npy or a sample of it?

If you do not mind, I will send an email with code and input.

CavalcanteLucas commented 5 years ago

find the text Attach files by dragging & dropping, selecting or pasting them. on the response field

anyway, you could join slack and share it through there. please get yourself an invitation link at https://opesci-slackin.now.sh/ we may use the #questions channels

BosungLim commented 5 years ago

I am in!

FabioLuporini commented 5 years ago

it should have now been fixed via #797 . Closing this issue but feel free to reopen if I'm wrong