Skip to content

Commit

Permalink
attempt to doc Joakim's pyproject.toml system
Browse files Browse the repository at this point in the history
  • Loading branch information
ahbarnett committed Aug 6, 2024
1 parent 11d8889 commit f497e22
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 24 deletions.
6 changes: 3 additions & 3 deletions docs/devnotes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ Developer notes

* The kernel function in spreadinterp is evaluated via piecewise-polynomial approximation (Horner's rule). The code for this is auto-generated in MATLAB, for all upsampling factors. There are two versions supported:

- 2018--2024 vintage: no explicit SIMD vectorization, C code is generated code for the Horner evaluation loop, by running from MATLAB `gen_all_horner_C_code.m`
- 2018--2024 vintage: no explicit SIMD vectorization, C code is generated code for the Horner evaluation loop, by running from MATLAB ``gen_all_horner_C_code.m``

- post-2024 vintage: explicit SIMD and many other acceleration tricks, and the generated code is a static C++ array of coefficients, and their sizes (`nc` or number of coefficients) for each width `w`. Run from MATLAB `gen_ker_horner_loop_cpp_code.m`
- post-2024 vintage: explicit SIMD and many other acceleration tricks, and the generated code is a static C++ array of coefficients, and their sizes (``nc`` or number of coefficients) for each width ``w``. Run from MATLAB ``gen_ker_horner_loop_cpp_code.m``

See `devel/README` for more details. The ES kernel coefficient and poly approx degree for both of the above are defined in a single location, `devel/get_degree_and_beta.m`, which must match the C++ `setup_spreader()` function.
See ``devel/README`` for more details. The ES kernel coefficient and poly approx degree for both of the above are defined in a single location, ``devel/get_degree_and_beta.m``, which must match the C++ ``setup_spreader()`` function.

* Continuous Integration (CI). See files for this in ``.github/workflows/``. It currently tests the default ``makefile`` settings in linux, and three other ``make.inc.*`` files covering OSX and Windows (MinGW). CI does not test build the variant OMP=OFF. The dev should test these locally. Likewise, the Julia wrapper is separate and thus not tested in CI. We have added ``JenkinsFile`` for the GPU CI via python wrappers.

Expand Down
32 changes: 11 additions & 21 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -467,8 +467,8 @@ Also see https://github.com/flatironinstitute/finufft/issues

.. _install-python:

Building a python interface to a locally compiled library
-----------------------------------------------------------------------
Building a Python interface to a locally compiled library
---------------------------------------------------------

Recall that the basic user may simply ``pip install finufft``,
then check it worked via either (if you have ``pytest`` installed)::
Expand All @@ -482,31 +482,21 @@ or the older-style eyeball check with::
which should report errors around ``1e-6`` and throughputs around 1-10 million points/sec.

However, a user or developer may want to build a python wrapper to their locally
compiled FINUFFT library, perhaps for more speed. We now describe this,
for all OSes.
We assume ``python3`` (hence ``pip3``; make sure you have that installed).
compiled FINUFFT library, perhaps for more speed.
We now describe this, for all OSes.
We assume ``python`` (hence ``pip``; make sure you have that installed), at least version 3.8. We now use the modern ``pyproject.toml`` build system,
which locally compiles (giving you native performance on your CPU).
For this, run::

First, compile the shared C++ library, via, eg ``make lib -j`` (using the old-style ``makefile``),
or via::
pip install -e python/finufft

make -p build
cd build
cmake ..
cmake --build . -j
cd ..

You may then run::

pip3 install -e python/finufft

which builds the ``finufft`` Python module, linking to the ``.so``,
and installs (in editable mode) via pip.
You will see that the ``finufftc.*.so`` shared object appears in the ``python/finufft/finufft/`` directory.
which compiles the library from source then makes the ``finufft`` Python module
and installs (in editable mode). If you see a complaint about missing ``setup.py``, you need a more recent version of pip/python.
You should then run the above tests. You could also run tests and examples via ``make python``.

An additional performance test you could then do is::

python3 python/finufft/test/run_speed_tests.py
python python/finufft/test/run_speed_tests.py

.. note::

Expand Down

0 comments on commit f497e22

Please sign in to comment.