Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace DISABLE_JIT with py_func tests #88

Merged
merged 11 commits into from
Mar 9, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@ language: python
# which follows the `PYTHON=X.Y` var.
matrix:
include:
- python: 3.7 # => 3.7 no JIT; scooby
env: PYTHON=3.7 NUMBA_DISABLE_JIT=1 INST="scooby"
- python: 3.8 # => 3.8 no JIT
env: PYTHON=3.8 NUMBA_DISABLE_JIT=1 INST=""
- python: 3.7 # => 3.7
- python: 3.7 # => 3.7;deplay
env: PYTHON=3.7 DEPLOY_PYPI=true INST=""
- python: 3.8 # => 3.8; scooby
env: PYTHON=3.8 INST="scooby"
- python: 3.7 # just linkcheck
env: PYTHON=3.7 CHCKLNKS=true INST="sphinx numpydoc sphinx_rtd_theme sphinx_numfig"

Expand Down Expand Up @@ -45,7 +43,7 @@ script: # No pytest for linkcheck-run.
fi

after_success:
- if [ "$NUMBA_DISABLE_JIT" == "1" ]; then coveralls; fi
- if [ "$CHCKLNKS" == "" ]; then coveralls; fi

deploy:
provider: pypi
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ Changelog
- ``emg3d.utils.Model``: Possible to create new models by adding or subtracting
existing models, and comparing two models (``+``, ``-``, ``==`` and ``!=``).
New attributes ``shape``, ``size``, and ``copy``.
- Change from ``NUMBA_DISABLE_JIT`` to use ``py_func`` for testing and coverage.
- Bugfix: ``emg3d.njitted.restrict`` did not store the {x;y;z}-field if
``sc_dir`` was {4;5;6}, respectively.


*v0.9.3* : Sphinx gallery
Expand Down
24 changes: 21 additions & 3 deletions emg3d/njitted.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,12 @@ def gauss_seidel_x(ex, ey, ez, sx, sy, sz, eta_x, eta_y, eta_z, zeta, hx, hy,
iym = iy-1
iyp = iy+1

# Reset vectors
middle[:] = 0.
left[:] = 0.
bvec[:] = 0.
amat[:] = 0.

for ixh in range(1, nCx+1):

# Index and minus index
Expand Down Expand Up @@ -879,6 +885,12 @@ def gauss_seidel_y(ex, ey, ez, sx, sy, sz, eta_x, eta_y, eta_z, zeta, hx, hy,
ixm = ix-1
ixp = ix+1

# Reset vectors
middle[:] = 0.
left[:] = 0.
bvec[:] = 0.
amat[:] = 0.

for iyh in range(1, nCy+1):

# Index and minus index
Expand Down Expand Up @@ -1153,6 +1165,12 @@ def gauss_seidel_z(ex, ey, ez, sx, sy, sz, eta_x, eta_y, eta_z, zeta, hx, hy,
ixm = ix-1
ixp = ix+1

# Reset vectors
middle[:] = 0.
left[:] = 0.
bvec[:] = 0.
amat[:] = 0.

for izh in range(1, nCz+1):

# Index and minus index
Expand Down Expand Up @@ -1864,7 +1882,7 @@ def restrict(crx, cry, crz, rx, ry, rz, wx, wy, wz, sc_dir):
elif sc_dir == 4: # Restrict in x-direction

# Sum the terms for x-field.
crx = rx[::2, :, :] + rx[1::2, :, :]
crx[:, :, :] = rx[::2, :, :] + rx[1::2, :, :]

# Loop over coarse x-edges.
for cix in range(cnNx):
Expand All @@ -1885,7 +1903,7 @@ def restrict(crx, cry, crz, rx, ry, rz, wx, wy, wz, sc_dir):
elif sc_dir == 5: # Restrict in y-direction

# Sum the terms for y-field.
cry = ry[:, ::2, :] + ry[:, 1::2, :]
cry[:, :, :] = ry[:, ::2, :] + ry[:, 1::2, :]

# Loop over coarse y-edges.
for ciy in range(cnNy):
Expand All @@ -1906,7 +1924,7 @@ def restrict(crx, cry, crz, rx, ry, rz, wx, wy, wz, sc_dir):
elif sc_dir == 6: # Restrict in z-direction

# Sum the terms for z-field.
crz = rz[:, :, ::2] + rz[:, :, 1::2]
crz[:, :, :] = rz[:, :, ::2] + rz[:, :, 1::2]

# Loop over coarse z-edges.
for ciz in range(cnNz):
Expand Down
7 changes: 0 additions & 7 deletions runtests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ GitHub/Travis-CI; by default for all supported python versions of emg3d.
where:
-h : Show this help text.
-v : Python 3.x version, e.g. '-v 7' for Python 3.7. Default: '7 8'.
-n : Disable numba.
-p : Print output of conda.
-d : Delete environments after tests.
-w : Disable pytest warnings.
Expand All @@ -24,7 +23,6 @@ PCKGS="numpy scipy pytest pytest-cov numba"
PROPS="--flake8"
INST="pytest-flake8 scooby"
WARN=""
DISABLENUMBA=false

# Get Optional Input
while getopts "hv:npdw" opt; do
Expand All @@ -35,8 +33,6 @@ while getopts "hv:npdw" opt; do
;;
v) PYTHON3VERSION=$OPTARG
;;
n) DISABLENUMBA=true
;;
p) PRINT="/dev/tty"
;;
d) DELETE=true
Expand Down Expand Up @@ -81,9 +77,6 @@ for i in ${PYTHON3VERSION[@]}; do

# Activate venv
source activate $NAME
if [ "$DISABLENUMBA" = true ] ; then
export NUMBA_DISABLE_JIT=1
fi

# Install flake8
if [ ! -d "$HOME/anaconda3/envs"+$NAME ]; then
Expand Down
Binary file modified tests/data/regression.npz
Binary file not shown.
Loading