Skip to content

Commit

Permalink
Collapsing all .pyx files into a single file.
Browse files Browse the repository at this point in the history
This is to avoid unintended programming errors caused by sharing the
**same** object file across multiple Cython-generated modules. (This is
problematic if the object files **expect** to share some global state,
which was happening with `MAX_CANDIDATES` and `SIMILAR_ULPS`.)

To do this, simply copied the contents of each `.pyx` file in
five sections in `src/bezier/_speedup.pyx`, and moved the imports and
globals to a shared section at the beginning of the module.

Due to name collisions (we lose the nice concept of namespaces, which
is sad) 11 functions were renamed:

- `reset_workspace` -> `reset_curves_workspace`
- `workspace_size` -> `curves_workspace_size`
- `reset_workspaces` -> `reset_surface_workspaces`
- `workspace_sizes` -> `surface_workspace_sizes`
- `_curve_speedup.pyx::subdivide_nodes` -> `subdivide_nodes_curve`
- `_surface_speedup.pyx::subdivide_nodes` -> `subdivide_nodes_surface`
- `_curve_speedup.pyx::newton_refine` -> `newton_refine_curve`
- `_curve_intersection_speedup.pyx::newton_refine` -> `newton_refine_curve_intersect`
- `_surface_intersection_speedup.pyx::newton_refine` -> `newton_refine_surface`
- `_curve_speedup.pyx::locate_point` -> `locate_point_curve`
- `_surface_intersection_speedup.pyx::locate_point` -> `locate_point_surface`

As well as one constant:

- `WORKSPACE` -> `CURVES_WORKSPACE`

Also:

- Updated `remove_cython_files.py` to gracefully handle the "no currently
  generated files" case
- Removing old `.pyx` and `.c` files
- Collapsing all `_HAS_*_SPEEDUP` variables into a single `_HAS_SPEEDUP`
- Updating all usage of `_*_speedup` imports to just come from
  `_speedup` (with appropriate renames for renamed functions)
- Updated build "journals" to reflect the new single module
  • Loading branch information
dhermes committed Jan 23, 2018
1 parent 0dc310e commit 8bcb319
Show file tree
Hide file tree
Showing 30 changed files with 19,371 additions and 111,037 deletions.
165 changes: 6 additions & 159 deletions .circleci/expected_journal.txt
Expand Up @@ -257,184 +257,31 @@ $ gcc \
> -Isrc/bezier/include \
> -I/usr/local/include/python3.6m \
> -c \
> src/bezier/_helpers_speedup.c \
> src/bezier/_speedup.c \
> -o \
> build/temp.linux-x86_64-3.6/src/bezier/_helpers_speedup.o
> build/temp.linux-x86_64-3.6/src/bezier/_speedup.o
----------------------------------------
$ gcc \
> -pthread \
> -shared \
> build/temp.linux-x86_64-3.6/src/bezier/_helpers_speedup.o \
> build/temp.linux-x86_64-3.6/src/bezier/types.o \
> build/temp.linux-x86_64-3.6/src/bezier/helpers.o \
> -L/usr/lib/gcc/x86_64-linux-gnu/5 \
> -L/usr/lib/gcc/x86_64-linux-gnu/5 \
> -L/usr/local/lib \
> -lgfortran \
> -lpython3.6m \
> -o \
> build/lib.linux-x86_64-3.6/bezier/_helpers_speedup.cpython-36m-x86_64-linux-gnu.so
----------------------------------------
$ gcc \
> -pthread \
> -Wno-unused-result \
> -Wsign-compare \
> -DNDEBUG \
> -g \
> -fwrapv \
> -O3 \
> -Wall \
> -Wstrict-prototypes \
> -fPIC \
> -I/var/code/bezier/.nox/journal-circleci/lib/python3.6/site-packages/numpy/core/include \
> -Isrc/bezier/include \
> -I/usr/local/include/python3.6m \
> -c \
> src/bezier/_curve_speedup.c \
> -o \
> build/temp.linux-x86_64-3.6/src/bezier/_curve_speedup.o
----------------------------------------
$ gcc \
> -pthread \
> -shared \
> build/temp.linux-x86_64-3.6/src/bezier/_curve_speedup.o \
> build/temp.linux-x86_64-3.6/src/bezier/types.o \
> build/temp.linux-x86_64-3.6/src/bezier/helpers.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/d1mach.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqelg.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqpsrt.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqk21.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqagse.o \
> build/temp.linux-x86_64-3.6/src/bezier/curve.o \
> -L/usr/lib/gcc/x86_64-linux-gnu/5 \
> -L/usr/lib/gcc/x86_64-linux-gnu/5 \
> -L/usr/local/lib \
> -lgfortran \
> -lpython3.6m \
> -o \
> build/lib.linux-x86_64-3.6/bezier/_curve_speedup.cpython-36m-x86_64-linux-gnu.so
----------------------------------------
$ gcc \
> -pthread \
> -Wno-unused-result \
> -Wsign-compare \
> -DNDEBUG \
> -g \
> -fwrapv \
> -O3 \
> -Wall \
> -Wstrict-prototypes \
> -fPIC \
> -I/var/code/bezier/.nox/journal-circleci/lib/python3.6/site-packages/numpy/core/include \
> -Isrc/bezier/include \
> -I/usr/local/include/python3.6m \
> -c \
> src/bezier/_surface_speedup.c \
> -o \
> build/temp.linux-x86_64-3.6/src/bezier/_surface_speedup.o
----------------------------------------
$ gcc \
> -pthread \
> -shared \
> build/temp.linux-x86_64-3.6/src/bezier/_surface_speedup.o \
> build/temp.linux-x86_64-3.6/src/bezier/types.o \
> build/temp.linux-x86_64-3.6/src/bezier/helpers.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/d1mach.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqelg.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqpsrt.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqk21.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqagse.o \
> build/temp.linux-x86_64-3.6/src/bezier/curve.o \
> build/temp.linux-x86_64-3.6/src/bezier/surface.o \
> -L/usr/lib/gcc/x86_64-linux-gnu/5 \
> -L/usr/lib/gcc/x86_64-linux-gnu/5 \
> -L/usr/local/lib \
> -lgfortran \
> -lpython3.6m \
> -o \
> build/lib.linux-x86_64-3.6/bezier/_surface_speedup.cpython-36m-x86_64-linux-gnu.so
----------------------------------------
$ gcc \
> -pthread \
> -Wno-unused-result \
> -Wsign-compare \
> -DNDEBUG \
> -g \
> -fwrapv \
> -O3 \
> -Wall \
> -Wstrict-prototypes \
> -fPIC \
> -I/var/code/bezier/.nox/journal-circleci/lib/python3.6/site-packages/numpy/core/include \
> -Isrc/bezier/include \
> -I/usr/local/include/python3.6m \
> -c \
> src/bezier/_curve_intersection_speedup.c \
> -o \
> build/temp.linux-x86_64-3.6/src/bezier/_curve_intersection_speedup.o
----------------------------------------
$ gcc \
> -pthread \
> -shared \
> build/temp.linux-x86_64-3.6/src/bezier/_curve_intersection_speedup.o \
> build/temp.linux-x86_64-3.6/src/bezier/_speedup.o \
> build/temp.linux-x86_64-3.6/src/bezier/types.o \
> build/temp.linux-x86_64-3.6/src/bezier/status.o \
> build/temp.linux-x86_64-3.6/src/bezier/helpers.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/d1mach.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqelg.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqpsrt.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqk21.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqagse.o \
> build/temp.linux-x86_64-3.6/src/bezier/curve.o \
> build/temp.linux-x86_64-3.6/src/bezier/surface.o \
> build/temp.linux-x86_64-3.6/src/bezier/curve_intersection.o \
> -L/usr/lib/gcc/x86_64-linux-gnu/5 \
> -L/usr/lib/gcc/x86_64-linux-gnu/5 \
> -L/usr/local/lib \
> -lgfortran \
> -lpython3.6m \
> -o \
> build/lib.linux-x86_64-3.6/bezier/_curve_intersection_speedup.cpython-36m-x86_64-linux-gnu.so
----------------------------------------
$ gcc \
> -pthread \
> -Wno-unused-result \
> -Wsign-compare \
> -DNDEBUG \
> -g \
> -fwrapv \
> -O3 \
> -Wall \
> -Wstrict-prototypes \
> -fPIC \
> -I/var/code/bezier/.nox/journal-circleci/lib/python3.6/site-packages/numpy/core/include \
> -Isrc/bezier/include \
> -I/usr/local/include/python3.6m \
> -c \
> src/bezier/_surface_intersection_speedup.c \
> -o \
> build/temp.linux-x86_64-3.6/src/bezier/_surface_intersection_speedup.o
----------------------------------------
$ gcc \
> -pthread \
> -shared \
> build/temp.linux-x86_64-3.6/src/bezier/_surface_intersection_speedup.o \
> build/temp.linux-x86_64-3.6/src/bezier/types.o \
> build/temp.linux-x86_64-3.6/src/bezier/status.o \
> build/temp.linux-x86_64-3.6/src/bezier/helpers.o \
> build/temp.linux-x86_64-3.6/src/bezier/surface_intersection.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/d1mach.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqelg.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqpsrt.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqk21.o \
> build/temp.linux-x86_64-3.6/src/bezier/quadpack/dqagse.o \
> build/temp.linux-x86_64-3.6/src/bezier/curve.o \
> build/temp.linux-x86_64-3.6/src/bezier/curve_intersection.o \
> build/temp.linux-x86_64-3.6/src/bezier/surface.o \
> build/temp.linux-x86_64-3.6/src/bezier/surface_intersection.o \
> -L/usr/lib/gcc/x86_64-linux-gnu/5 \
> -L/usr/lib/gcc/x86_64-linux-gnu/5 \
> -L/usr/local/lib \
> -lgfortran \
> -lpython3.6m \
> -o \
> build/lib.linux-x86_64-3.6/bezier/_surface_intersection_speedup.cpython-36m-x86_64-linux-gnu.so
> build/lib.linux-x86_64-3.6/bezier/_speedup.cpython-36m-x86_64-linux-gnu.so
----------------------------------------

0 comments on commit 8bcb319

Please sign in to comment.