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

remove parallel omp cython code & parallel CICD matrix items #384

Merged
merged 4 commits into from
Aug 5, 2019
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
20 changes: 0 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,6 @@ matrix:
env:
- PYTHON=3.6.8
- PROJSOURCE=6.1.1
- language: cpp
os: osx
env:
- PYTHON=3.6.8
- PROJSOURCE=6.1.1
- PYPROJ_OMP="-fopenmp"
- python: 3.5
env:
- PROJSOURCE=6.1.1
Expand All @@ -42,10 +36,6 @@ matrix:
- python: 3.6
env:
- PROJSOURCE=6.1.1
- python: 3.6
env:
- PROJSOURCE=6.1.1
- PYPROJ_OMP="-fopenmp"
- python: 3.7
dist: xenial
env:
Expand All @@ -59,16 +49,6 @@ matrix:
- python: "nightly"
env:
- PROJSOURCE=git
- language: cpp
os: osx
env:
- PYTHON=3.6.8
- PROJSOURCE=6.1.1
- PYPROJ_OMP="-fopenmp"
- python: 3.6
env:
- PROJSOURCE=6.1.1
- PYPROJ_OMP="-fopenmp"


before_install:
Expand Down
30 changes: 14 additions & 16 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ environment:
VS_VERSION: Visual Studio 14
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
PROJSOURCE: 6.1.1
- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6"
PYTHON_ARCH: "64"
VS_VERSION: Visual Studio 14
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
PROJSOURCE: 6.1.1
PYPROJ_OMP: "/openmp"
# - PYTHON: "C:\\Python37-x64"
# PYTHON_VERSION: "3.7"
# PYTHON_ARCH: "64"
Expand All @@ -47,15 +40,14 @@ environment:
# VS_VERSION: Visual Studio 14
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
# PROJSOURCE: git
matrix:
allow_failures:
- PYTHON: "C:\\Python36-x64"
PYTHON_VERSION: "3.6"
PYTHON_ARCH: "64"
VS_VERSION: Visual Studio 14
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
PROJSOURCE: 6.1.1
PYPROJ_OMP: "/openmp"
# matrix:
# allow_failures:
# - PYTHON: "C:\\Python36-x64"
# PYTHON_VERSION: "3.6"
# PYTHON_ARCH: "64"
# VS_VERSION: Visual Studio 14
# APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
# PROJSOURCE: git

shallow_clone: true

Expand Down Expand Up @@ -131,6 +123,12 @@ install:

# install wheel, caching
- "%CMD_IN_ENV% pip install wheel"
# update vcpkg
- cmd: |
cd "C:\Tools\vcpkg"
git pull
.\bootstrap-vcpkg.bat
cd %APPVEYOR_BUILD_FOLDER%

test_script:
# Run the project tests
Expand Down
23 changes: 0 additions & 23 deletions docs/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,29 +81,6 @@ The order of preference for the data directory is:
3. The directory in PROJ_LIB (if exists & valid)
4. The directory on the PATH (if exists & valid)

Optional: Enable OpenMP
~~~~~~~~~~~~~~~~~~~~~~~

You will need to have OpenMP installed beforehand for this to work.

.. versionadded:: 2.3
OpenMP parallel experimental support with Cython for subset of code.


.. warning:: Enabling OpenMP has been unstable in some circumstances.


Then, depending on your compiler, you will need to set the openmp flag
before installing pyproj.

gcc compiler::

export PYPROJ_OMP="-fopenmp"

Microsoft Visual C++ compiler::

set PYPROJ_OMP='/openmp'


Install pyproj
~~~~~~~~~~~~~~
Expand Down
12 changes: 6 additions & 6 deletions pyproj/_geod.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ cdef extern from "geodesic.h":
pass
struct geod_geodesicline:
pass
void geod_init(geod_geodesic* g, double a, double f) nogil
void geod_init(geod_geodesic* g, double a, double f)
void geod_direct(geod_geodesic* g,
double lat1, double lon1, double azi1, double s12,
double* plat2, double* plon2, double* pazi2) nogil
double* plat2, double* plon2, double* pazi2)
void geod_inverse(geod_geodesic* g,
double lat1, double lon1, double lat2, double lon2,
double* ps12, double* pazi1, double* pazi2) nogil
double* ps12, double* pazi1, double* pazi2)
void geod_lineinit(geod_geodesicline* l,
geod_geodesic* g,
double lat1, double lon1, double azi1, unsigned caps) nogil
double lat1, double lon1, double azi1, unsigned caps)
void geod_position(geod_geodesicline* l, double s12,
double* plat2, double* plon2, double* pazi2) nogil
double* plat2, double* plon2, double* pazi2)
void geod_polygonarea(geod_geodesic* g,
double lats[], double lons[], int n,
double* pA, double* pP) nogil
double* pA, double* pP)

cdef enum:
GEODESIC_VERSION_MAJOR
Expand Down
9 changes: 4 additions & 5 deletions pyproj/_geod.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
include "base.pxi"

cimport cython
from cython.parallel import prange

from pyproj.compat import cstrencode, pystrdecode
from pyproj.exceptions import GeodError
Expand Down Expand Up @@ -67,7 +66,7 @@ cdef class Geod:
latsdata = <double *>latdata
azdata = <double *>azdat
distdata = <double *>distdat
for iii in prange(ndim, nogil=True):
for iii in range(ndim):
if not radians:
lon1 = lonsdata[iii]
lat1 = latsdata[iii]
Expand Down Expand Up @@ -130,7 +129,7 @@ cdef class Geod:
latsdata = <double *>latdata
azdata = <double *>azdat
distdata = <double *>distdat
for iii in prange(ndim, nogil=True):
for iii in range(ndim):
if radians:
lon1 = _RAD2DG * lonsdata[iii]
lat1 = _RAD2DG * latsdata[iii]
Expand Down Expand Up @@ -244,7 +243,7 @@ cdef class Geod:
lonsdata[0] = 0
return 0.0

for iii in prange(ndim - 1, nogil=True):
for iii in range(ndim - 1):
if radians:
lon1 = _RAD2DG * lonsdata[iii]
lat1 = _RAD2DG * latsdata[iii]
Expand Down Expand Up @@ -312,7 +311,7 @@ cdef class Geod:
lonsdata = <double *>londata
latsdata = <double *>latdata
if radians:
for iii in prange(ndim, nogil=True):
for iii in range(ndim):
lonsdata[iii] *= _RAD2DG
latsdata[iii] *= _RAD2DG

Expand Down
23 changes: 8 additions & 15 deletions pyproj/_proj.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ include "base.pxi"
import warnings

cimport cython
from cython.parallel import prange

from pyproj.compat import cstrencode, pystrdecode
from pyproj._datadir cimport PROJ_CONTEXT
Expand Down Expand Up @@ -76,13 +75,12 @@ cdef class Proj:
ndim = buflenx//_DOUBLESIZE
lonsdata = <double *>londata
latsdata = <double *>latdata
for iii in prange(ndim, nogil=True):
for iii in range(ndim):
# if inputs are nan's, return big number.
if lonsdata[iii] != lonsdata[iii] or latsdata[iii] != latsdata[iii]:
lonsdata[iii]=1.e30; latsdata[iii]=1.e30
if errcheck:
with gil:
raise ProjError("projection_undefined")
raise ProjError("projection_undefined")
continue
if proj_angular_input(self.projpj, PJ_FWD):
projlonlatin.uv.u = _DG2RAD * lonsdata[iii]
Expand All @@ -94,8 +92,7 @@ cdef class Proj:
if errcheck:
err = proj_errno(self.projpj)
if err != 0:
with gil:
raise ProjError(pystrdecode(proj_errno_string(err)))
raise ProjError(pystrdecode(proj_errno_string(err)))
# since HUGE_VAL can be 'inf',
# change it to a real (but very large) number.
# also check for NaNs.
Expand All @@ -104,8 +101,7 @@ cdef class Proj:
projxyout.xy.y == HUGE_VAL or\
projxyout.xy.x != projxyout.xy.x:
if errcheck:
with gil:
raise ProjError("projection_undefined")
raise ProjError("projection_undefined")
lonsdata[iii] = 1.e30
latsdata[iii] = 1.e30
elif proj_angular_output(self.projpj, PJ_FWD):
Expand Down Expand Up @@ -149,13 +145,12 @@ cdef class Proj:
ndim = buflenx//_DOUBLESIZE
xdatab = <double *>xdata
ydatab = <double *>ydata
for iii in prange(ndim, nogil=True):
for iii in range(ndim):
# if inputs are nan's, return big number.
if xdatab[iii] != xdatab[iii] or ydatab[iii] != ydatab[iii]:
xdatab[iii]=1.e30; ydatab[iii]=1.e30
if errcheck:
with gil:
raise ProjError("projection_undefined")
raise ProjError("projection_undefined")
continue
if proj_angular_input(self.projpj, PJ_INV):
projxyin.uv.u = _DG2RAD * xdatab[iii]
Expand All @@ -167,8 +162,7 @@ cdef class Proj:
if errcheck:
err = proj_errno(self.projpj)
if err != 0:
with gil:
raise ProjError(pystrdecode(proj_errno_string(err)))
raise ProjError(pystrdecode(proj_errno_string(err)))
# since HUGE_VAL can be 'inf',
# change it to a real (but very large) number.
# also check for NaNs.
Expand All @@ -177,8 +171,7 @@ cdef class Proj:
projlonlatout.uv.v == HUGE_VAL or \
projlonlatout.uv.v != projlonlatout.uv.v:
if errcheck:
with gil:
raise ProjError("projection_undefined")
raise ProjError("projection_undefined")
xdatab[iii] = 1.e30
ydatab[iii] = 1.e30
elif proj_angular_output(self.projpj, PJ_INV):
Expand Down
17 changes: 8 additions & 9 deletions pyproj/_transformer.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
include "base.pxi"

cimport cython
from cython.parallel import prange

from pyproj._crs cimport Base, _CRS, CoordinateOperation
from pyproj._datadir cimport PROJ_CONTEXT
Expand Down Expand Up @@ -277,14 +276,14 @@ cdef class _Transformer(Base):
# degrees to radians
if not self.is_pipeline and not radians\
and self._input_radians[pj_direction]:
for iii in prange(npts, nogil=True):
for iii in range(npts):
xx[iii] = xx[iii]*_DG2RAD
yy[iii] = yy[iii]*_DG2RAD
# radians to degrees
elif not self.is_pipeline and radians\
and not self._input_radians[pj_direction]\
and self.input_geographic:
for iii in prange(npts, nogil=True):
for iii in range(npts):
xx[iii] = xx[iii]*_RAD2DG
yy[iii] = yy[iii]*_RAD2DG

Expand All @@ -308,14 +307,14 @@ cdef class _Transformer(Base):
# radians to degrees
if not self.is_pipeline and not radians\
and self._output_radians[pj_direction]:
for iii in prange(npts, nogil=True):
for iii in range(npts):
xx[iii] = xx[iii]*_RAD2DG
yy[iii] = yy[iii]*_RAD2DG
# degrees to radians
elif not self.is_pipeline and radians\
and not self._output_radians[pj_direction]\
and self.output_geographic:
for iii in prange(npts, nogil=True):
for iii in range(npts):
xx[iii] = xx[iii]*_DG2RAD
yy[iii] = yy[iii]*_DG2RAD

Expand Down Expand Up @@ -351,15 +350,15 @@ cdef class _Transformer(Base):
# degrees to radians
if not self.is_pipeline and not radians\
and self._input_radians[pj_direction]:
for iii in prange(npts, nogil=True):
for iii in range(npts):
jjj = stride * iii
coords[jjj] *= _DG2RAD
coords[jjj + 1] *= _DG2RAD
# radians to degrees
elif not self.is_pipeline and radians\
and not self._input_radians[pj_direction]\
and self.input_geographic:
for iii in prange(npts, nogil=True):
for iii in range(npts):
jjj = stride * iii
coords[jjj] *= _RAD2DG
coords[jjj + 1] *= _RAD2DG
Expand Down Expand Up @@ -405,15 +404,15 @@ cdef class _Transformer(Base):
# radians to degrees
if not self.is_pipeline and not radians\
and self._output_radians[pj_direction]:
for iii in prange(npts, nogil=True):
for iii in range(npts):
jjj = stride * iii
coords[jjj] *= _RAD2DG
coords[jjj + 1] *= _RAD2DG
# degrees to radians
elif not self.is_pipeline and radians\
and not self._output_radians[pj_direction]\
and self.output_geographic:
for iii in prange(npts, nogil=True):
for iii in range(npts):
jjj = stride * iii
coords[jjj] *= _DG2RAD
coords[jjj + 1] *= _DG2RAD
Loading