Skip to content

Commit 6f09b2b

Browse files
authored
Merge pull request #12 from mrava87/master
PBS backend and float32 default for Marchenko class
2 parents 1e60d7f + 209127b commit 6f09b2b

File tree

10 files changed

+48
-20
lines changed

10 files changed

+48
-20
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ script:
1212
deploy:
1313
provider: pypi
1414
user: mrava87
15-
distributions: "bdist_wheel"
15+
distributions: bdist_wheel
1616
skip_existing: true
1717
skip_upload_docs: true
1818
skip_cleanup: true
1919
on:
2020
tags: true
2121
password:
22-
secure: BhGrKUGz72ruUgoO08vnhaeaOFifln1qbgICR0F4uP9Zu6EVLKgJWxGRsr9Cn/O7bCHlhh/xNULqt7Al3sPeMy8SptxQw/fx5BoiEKqvETbs1zIxQ7JiyCF3Bc5ljl8DUa0TSsqtRXlc2w7lhei7cS9GFZTzrVYJo9yrA3ywkq79LZzgehtsir2oNgya4ONFuKIZ0ebiRlgOA+WXwgaNO77mdZv7+u4dl0V/OGXhJGd1Crn8BW8dT1v4XHrBOzrLXU7uwpSTU47Sn1989fE0xqzo2DNXSh90rKz9xHeC+j/yxw1y4QzTLa/BxsjfS3M/dm1D/9XZp0i8E+/JfYJ/KaxGum8W4ASrnk1x6vdPWS+xe140YEdB8l/cKwRbhqpYFxaXjJNKqHvY5aKInVJLa5zJsdQeicO76XUkG9Gc/nTG7jqkPxWBZqd4ukXN69iwGechpi5DOULUN0Z2Fut9ZzF+nF1aUzEl104uZmRzb682+bhC+dUFPjg7Gi8C+ZRO89gEp1tA/2sA+3svOfxjaBUZDtjSlbg0pj+9llHx6H0tjpsQBIuy6TZshh7qnKVYE3LDAHm08mhAwpDaG7TFkRBkcAJObK73IZ6pam3cw30/51uNvu8k8UwV7noieaejKfCMImGrV3T3UJX/kxFgbH5gHZ3A+280P5yoduwSbkY=
22+
secure: jodHKQNsz5te21LhUNtf633qX0v+ni/nWU25vLnq5P1F2S5dfYLDibmtiFGfTY7Ac12OuU2/Fhm01ghcXVWCvvsDoFW2JfClQcbm0gPWKDJHb8QMLkBlgSPxCi+OiMZMlG0OZ0tDeZUftZaRkLq2hK44r1jzfCwMGr0/wB6y7FhNQvEr4oZwhTFfA4Nrs2eyJuXajht2YxGwwvF07IlWQKfnr1OkXU1PWtUsuubb6mrnq2FY0f2pXBZ+BqpqwCF5CMScYK8ucLCMPDHe7k+3Ef+DEJqKRrT1qwK0G+H4gdRfD4ysE8VePqWqJHlexAamKdSsQx/wrxXWdn3QnpkUQ6A037qJTDlPJGzpPJco3N8DSr9nTHZcHfW9gDafQwMnfl06+QIsgXk9RGpe2eOYO7/vLC/5GbDHruJaOdNT+YVvH1mfOK9z0tLL/zc9Pi3htrc40NzeRqohNJy6NOu4AKcS03wkDtvdODtJxN3mYyIfjARzWHWm6SIm9+ASUatlhu2MzBxzJQPxGVSLjVx72+fIkySiWJJcqYhsRzHnwhokDHA6oNTz5NEm5w48Ads1n0K0os3w0nqZNL9Xbcxh84Xf+LyY47UAjqaExJdTSk3bF4Vx2nmJxWfVkXDZZwkJhNgt/SGETtorp46VpXRpakmND05ZIs8IY1XVTGoj7l8=

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![PyPI version](https://badge.fury.io/py/pylops-distributed.svg)](https://badge.fury.io/py/pylops-distributed)
44
[![Build Status](https://travis-ci.org/equinor/pylops-distributed.svg?branch=master)](https://travis-ci.org/equinor/pylops-distributed)
5-
[![AzureDevOps Status](https://dev.azure.com/MRAVA/PyLops/_apis/build/status/equinor.pylops-distributed?branchName=master)](https://dev.azure.com/MRAVA/PyLops/_build/latest?definitionId=3&branchName=master)
5+
[![AzureDevOps Status](https://dev.azure.com/matteoravasi/PyLops/_apis/build/status/equinor.pylops-distributed?branchName=master)](https://dev.azure.com/matteoravasi/PyLops/_build/latest?definitionId=4&branchName=master)
66
[![Documentation Status](https://readthedocs.org/projects/pylops-distributed/badge/?version=latest)](https://pylops-distributed.readthedocs.io/en/latest/?badge=latest)
77
[![OS-support](https://img.shields.io/badge/OS-linux,osx-850A8B.svg)](https://github.com/equinor/pylops)
88
[![Slack Status](https://img.shields.io/badge/chat-slack-green.svg)](https://pylops.slack.com)

environment-dev.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ dependencies:
1616
- numba
1717
- icc_rt
1818
- dask>=2.0.0
19+
- dask-jobqueue
1920
- zarr
2021
- pylops
2122
- pip:

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ dependencies:
1010
- numba
1111
- icc_rt
1212
- dask>=2.0.0
13+
- dask-jobqueue
1314
- pylops

pylops_distributed/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,8 @@
2828
try:
2929
from .version import version as __version__
3030
except ImportError:
31-
__version__ = '0.0.0'
31+
# If it was not installed, then we don't know the version. We could throw a
32+
# warning here, but this case *should* be rare. pylops should be installed
33+
# properly!
34+
from datetime import datetime
35+
__version__ = 'unknown-'+datetime.today().strftime('%Y%m%d')
Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
from dask.distributed import Client, LocalCluster
22

33

4+
try:
5+
from dask_jobqueue import PBSCluster
6+
jobqueue = True
7+
except:
8+
jobqueue = False
9+
10+
411
def dask(hardware='single', client=None, processes=False, n_workers=1,
5-
threads_per_worker=1):
12+
threads_per_worker=1, **kwargscluster):
613
r"""Dask backend initialization.
714
815
Create connection to drive computations using Dask distributed.
@@ -11,30 +18,45 @@ def dask(hardware='single', client=None, processes=False, n_workers=1,
1118
----------
1219
hardware : :obj:`str`, optional
1320
Hardware used to run Dask distributed. Currently available options
14-
are ``single`` for single-machine distribution.
21+
are ``single`` for single-machine distribution, ``ssh`` for
22+
SSH-bases multi-machine distribution and ``pbs`` for
23+
PBS-bases multi-machine distribution
1524
client : :obj:`str`, optional
16-
Name of scheduler (use ``None`` for ``hardware=single``)n.
25+
Name of scheduler (use ``None`` for ``hardware=single``).
1726
processes : :obj:`str`, optional
1827
Whether to use processes (``True``) or threads (``False``).
1928
n_workers : :obj:`int`, optional
2029
Number of workers
2130
threads_per_worker : :obj:`int`, optional
2231
Number of threads per each worker
32+
kwargscluster:
33+
Additional parameters to be passed to the cluster creation routine
2334
2435
Returns
2536
-------
2637
client : :obj:`dask.distributed.client.Client`
38+
Client
39+
cluster :
40+
Cluster
2741
2842
Raises
2943
------
30-
ValueError
31-
If ``hardware`` is not ``single``
44+
NotImplementedError
45+
If ``hardware`` is not ``single``, ``ssh``, or ``pbs``
3246
3347
"""
3448
if hardware == 'single':
3549
cluster = LocalCluster(processes=processes, n_workers=n_workers,
3650
threads_per_worker=threads_per_worker)
37-
else:
51+
elif hardware == 'ssh':
3852
cluster = client
53+
elif hardware == 'pbs':
54+
if jobqueue == False:
55+
raise ModuleNotFoundError('dask-jobqueue not installed. ' \
56+
'Run "pip install dask-jobqueue".')
57+
cluster = PBSCluster(**kwargscluster)
58+
cluster.scale(jobs=n_workers)
59+
else:
60+
raise NotImplementedError('hardware must be single, ssh, or pbs')
3961
client = Client(cluster)
40-
return client
62+
return client, cluster

pylops_distributed/waveeqprocessing/marchenko.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ class Marchenko():
7979
8080
"""
8181
def __init__(self, R, nt, dt=0.004, dr=1., wav=None, toff=0.0,
82-
nsmooth=10, saveRt=True, prescaled=False, dtype='float64'):
82+
nsmooth=10, saveRt=True, prescaled=False, dtype='float32'):
8383
# Save inputs into class
8484
self.nt = nt
8585
self.dt = dt
@@ -179,8 +179,8 @@ def apply_onepoint(self, trav, dist=None, G0=None, nfft=None,
179179
Rollop = Roll(self.nt2 * self.ns,
180180
dims=(self.nt2, self.ns),
181181
dir=0, shift=-1, dtype=self.dtype)
182-
Wop = Diagonal(da.from_array(w.T.flatten()))
183-
Iop = Identity(self.nr * self.nt2)
182+
Wop = Diagonal(da.from_array(w.T.flatten()), dtype=self.dtype)
183+
Iop = Identity(self.nr * self.nt2, dtype=self.dtype)
184184
Mop = Block([[Iop, -1 * Wop * Rop],
185185
[-1 * Wop * Rollop * R1op, Iop]]) * BlockDiag([Wop, Wop])
186186
Gop = Block([[Iop, -1 * Rop],
@@ -233,8 +233,7 @@ def apply_onepoint(self, trav, dist=None, G0=None, nfft=None,
233233
f1_inv = cgls(Mop, d.flatten(), **kwargs_cgls)[0]
234234
f1_inv = f1_inv.reshape(2 * self.nt2, self.nr)
235235
f1_inv_tot = f1_inv + da.concatenate((da.zeros((self.nt2, self.nr),
236-
dtype=self.dtype),
237-
fd_plus))
236+
dtype=self.dtype), fd_plus))
238237
# Create Green's functions
239238
if greens:
240239
g_inv = Gop * f1_inv_tot.flatten()
@@ -351,8 +350,9 @@ def apply_multiplepoints(self, trav, dist=None, G0=None, nfft=None,
351350
Rollop = Roll(self.ns * nvs * self.nt2,
352351
dims=(self.nt2, self.ns, nvs),
353352
dir=0, shift=-1, dtype=self.dtype)
354-
Wop = Diagonal(da.from_array(w.transpose(2, 0, 1).flatten()))
355-
Iop = Identity(self.nr * nvs * self.nt2)
353+
Wop = Diagonal(da.from_array(w.transpose(2, 0, 1).flatten()),
354+
dtype=self.dtype)
355+
Iop = Identity(self.nr * nvs * self.nt2, dtype=self.dtype)
356356
Mop = Block([[Iop, -1 * Wop * Rop],
357357
[-1 * Wop * Rollop * R1op, Iop]]) * BlockDiag([Wop, Wop])
358358
Gop = Block([[Iop, -1 * Rop],

pylops_distributed/waveeqprocessing/mdd.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,6 @@ def MDC(G, nt, nv, dt=1., dr=1., twosided=True,
3434
twosided : :obj:`bool`, optional
3535
MDC operator has both negative and positive time (``True``) or
3636
only positive (``False``)
37-
dtype : :obj:`str`, optional
38-
*Deprecated*, will be removed in v2.0.0
3937
saveGt : :obj:`bool`, optional
4038
Save ``G`` and ``G^H`` to speed up the computation of adjoint of
4139
:class:`pylops_distributed.signalprocessing.Fredholm1` (``True``) or create

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ numpy>=1.15.0
22
scipy>=1.1.0
33
numba
44
dask[complete]>=2.0.0
5+
dask-jobqueue
56
zarr
67
pylops[advanced]
78
matplotlib

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@ numpy>=1.15.0
22
scipy>=1.1.0
33
numba
44
dask[complete]>=2.0.0
5+
dask-jobqueue
56
pylops

0 commit comments

Comments
 (0)