Skip to content

Commit

Permalink
tidy all make.inc.* to make-platforms/, fix CI and docs to match
Browse files Browse the repository at this point in the history
  • Loading branch information
ahbarnett committed Jan 7, 2025
1 parent c6c4104 commit d0c9c0b
Show file tree
Hide file tree
Showing 20 changed files with 32 additions and 25 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/C++.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Install omp and fftw
run: |
brew install libomp fftw
cp make.inc.macosx_clang make.inc
cp make-platforms/make.inc.macosx_clang make.inc
- name: Compile C++ code
run: |
Expand All @@ -58,7 +58,7 @@ jobs:
- name: Install gcc and fftw
run: |
brew install gcc@12 fftw
cp make.inc.macosx_gcc-12 make.inc
cp make-platforms/make.inc.macosx_gcc-12 make.inc
- name: Compile C++ code
run: |
Expand Down Expand Up @@ -88,5 +88,5 @@ jobs:
fftw:p
- name: Compile C++ code
run: |
cp make.inc.windows_msys make.inc
cp make-platforms/make.inc.windows_msys make.inc
make spreadtestall && make lib && make test
2 changes: 1 addition & 1 deletion .github/workflows/C++_build_win.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ $ErrorActionPreference = "Stop"
Set-Variable -Name MSYSTEM -Value MINGW64

# Setup the make.inc file
Copy-Item -Path make.inc.windows_msys -Destination make.inc
Copy-Item -Path make-platforms\make.inc.windows_msys -Destination make.inc

# call make
Set-Variable repo_root -Value ([IO.Path]::Combine($PSScriptRoot, '..', '..'))
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/mex.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ jobs:
export MW_MINGW64_LOC=/c/msys64/mingw64
pacman -Sy --noconfirm make mingw-w64-x86_64-toolchain mingw-w64-x86_64-fftw
mex -setup:.github/workflows/mex_C++_win64.xml C++
cp make.inc.windows_msys make.inc
cp make-platforms/make.inc.windows_msys make.inc
sed -i '/ LIBSFFT/a \ \ LIBSFFT := `g++ --print-file-name libfftw3.a` `g++ --print-file-name libfftw3f.a` `g++ --print-file-name libfftw3_omp.a` `g++ --print-file-name libfftw3f_omp.a` `g++ --print-file-name libm.a` `g++ --print-file-name libgomp.a`' makefile
/c/msys64/usr/bin/make matlab
shell: C:\msys64\usr\bin\bash.exe {0}
- name: Generate macOS mex file
if: runner.os == 'macOS'
run: |
brew install fftw libomp
sed 's/\/Applications\/MATLAB_R20\*\*.app/\/Users\/runner\/hostedtoolcache\/MATLAB\/2023.2.999\/arm64\/MATLAB.app/' make.inc.macosx_arm64 > make.inc
sed 's/\/Applications\/MATLAB_R20\*\*.app/\/Users\/runner\/hostedtoolcache\/MATLAB\/2023.2.999\/arm64\/MATLAB.app/' make-platforms/make.inc.macosx_arm64 > make.inc
sed -i -e 's/ LIBSFFT.*/\ \ LIBSFFT := \/opt\/homebrew\/opt\/fftw\/lib\/libfftw3\.a \/opt\/homebrew\/opt\/fftw\/lib\/libfftw3f\.a \/opt\/homebrew\/opt\/fftw\/lib\/libfftw3_omp.a \/opt\/homebrew\/opt\/fftw\/lib\/libfftw3f_omp\.a -L\/Users\/runner\/hostedtoolcache\/MATLAB\/2023.2.999\/arm64\/MATLAB.app\/bin\/maca64\/lib -lomp/' makefile
make matlab
- name: Generate Linux mex file
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ If not stated, FINUFFT is assumed (cuFINUFFT <=1.3 is listed separately).

Master, working towards V 2.4.0 (1/7/25)

* classic GNU makefile settings make.inc.* tidied to make-platforms/ (Barnett)
* unified separate-dim arrays (eg X,Y,Z->XYZ), simplifiying core (Reinecke #592)
* exit codes of many-vector tests now insensitive to one-mode randomness
(Barnett)
Expand Down
28 changes: 14 additions & 14 deletions docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Installation
There are two main routes to compile the CPU library from source:
via CMake (the recommended modern way, being more platform-independent, and also the
only way to build the GPU library),
or via a GNU ``makefile`` (which has various settings for linux, OSX, Windows).
or via a GNU ``makefile`` (which has settings for platforms on linux, OSX, Windows).
We currently support both, and detail them in that order in the text below.
The only requirement is a C/C++ compiler supporting OpenMP and the C++17
standard.
Expand Down Expand Up @@ -134,7 +134,7 @@ Here are our CMake build options, showing name, explanatory text, and default va
:end-before: @cmake_opts_end

For convenience we also provide a number of `cmake presets <https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html>`_
for various options and compilers, in ``CMakePresets.json`` (this will grow to replace the old ``make.inc.*`` site files).
for various platforms, options and compilers, in ``CMakePresets.json``.
For example, to configure, build and test the development preset (which builds tests and examples), from ``build`` do:

.. code-block:: bash
Expand Down Expand Up @@ -167,19 +167,19 @@ Classic GNU make based route
----------------------------

Below we deal with the three standard OSes in order: 1) **linux**, 2) **Mac OSX**, 3) **Windows**.
We have some users contributing settings for other OSes, for instance
PowerPC. The general procedure to download, then compile for such a special setup is, illustrating with the PowerPC case::
We have some users contributing settings for other platforms, for instance
PowerPC. The general procedure to download, then compile for a particular platform is, illustrating with the PowerPC case::

git clone https://github.com/flatironinstitute/finufft.git
cd finufft
cp make.inc.powerpc make.inc
cp make-platforms/make.inc.powerpc make.inc
make test -j

Have a look for ``make.inc.*`` to see what is available, and/or edit your ``make.inc`` based on looking in the ``makefile`` and quirks of your local setup. We have continuous integration which tests the default (linux) settings in this ``makefile``, plus those in three OS-specific setup files, currently::
Have a look in ``make-platforms/`` to see what is available, and/or edit your ``make.inc`` based on looking in the ``makefile`` and quirks of your local platform. We have continuous integration which tests the default (linux) settings in this ``makefile``, plus those in three OS-specific settings, currently::

make.inc.macosx_clang
make.inc.macosx_gcc-12
make.inc.windows_msys
make-platforms/make.inc.macosx_clang
make-platforms/make.inc.macosx_gcc-12
make-platforms/make.inc.windows_msys

Thus, those are the recommended files for OSX or Windows users to try as their ``make.inc``.
If there is an error in testing on what you consider a standard set-up,
Expand Down Expand Up @@ -365,11 +365,11 @@ Once you have downloaded FINUFFT from github, go to its top directory.
You now need to decide if you will be wanting to call FINUFFT from
MATLAB (and currently have MATLAB installed). If so, do::

cp make.inc.macosx_clang_matlab make.inc
cp make-platforms/make.inc.macosx_clang_matlab make.inc

Else if you don't have MATLAB, do::

cp make.inc.macosx_clang make.inc
cp make-platforms/make.inc.macosx_clang make.inc

.. note::

Expand Down Expand Up @@ -400,7 +400,7 @@ The GCC route
This is less recommended, unless you need to link from ``gfortran``, when it
appears to be essential. The basic idea is::

cp make.inc.macosx_gcc-12 make.inc
cp make-platforms/make.inc.macosx_gcc-12 make.inc
make test -j
make fortran

Expand Down Expand Up @@ -440,7 +440,7 @@ We have users who have adjusted the makefile to work - at least to some extent -

More generally, please make sure to have a recent version of Mingw at hand, preferably with a 64bit version of gnu-make like the WinLibs standalone build of GCC and MinGW-w64 for Windows. Note that most MinGW-w64 distributions, such as TDM-GCC, do not feature the 64bit gnu-make. Fortunately, this limitation is only relevant to run the tests. To prepare the build of the static and dynamic libraries run::

copy make.inc.windows_mingw make.inc
copy make-platforms/make.inc.windows_mingw make.inc

Subsequently, open this ``make.inc`` file with the text editor of your choice and assign the parent directories of the FFTW header file to ``FFTW_H_DIR``, of the FFTW libraries to ``FFTW_LIB_DIR``, and of the GCC OpenMP library lgomp.dll to ``LGOMP_DIR``. Note that you need the last-mentioned only if you plan to build the MEX-interface for MATLAB. Now, you should be able to run::

Expand All @@ -457,7 +457,7 @@ In a similar fashion, the examples can now be build with ``make examples``. This
For users who work with Windows using MSYS and MinGW compilers, please
try::

cp make.inc.windows_msys make.inc
cp make-platforms/make.inc.windows_msys make.inc
make test -j

Also see https://github.com/flatironinstitute/finufft/issues
Expand Down
7 changes: 7 additions & 0 deletions make-platforms/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
This directory contains platform-specific variable settings for the
GNU makefile. They are used by CI.

Please copy one of these up to ../make.inc and possibly modify for
your needs.

Barnett 1/7/25
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MINGW=ON
# libm not available on Windows? Has to be removed from LIBS to build MATLAB mex file. Does not interfere with library build
LIBS=
LIBS=
# please set these paths
FFTW_H_DIR=
FFTW_LIB_DIR=
Expand Down
File renamed without changes.
7 changes: 3 additions & 4 deletions makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
# FINUFFT and its various language interfaces and examples.
# Users should not need to edit this makefile (doing so would make it hard to
# stay up to date with the repo version). Rather, in order to change
# OS/environment-specific compilers and flags, create the file make.inc, which
# OS/platform-specific compilers and flags, create the file make.inc, which
# overrides the defaults below (which are for an ubuntu linux/GCC system).
# See docs/install.rst, and make.inc.* for examples.
# Read docs/install.rst, and make-platforms/make.inc.* for examples.

# Barnett 2017-2020. Malleo's expansion for guru interface, summer 2019.
# Barnett tidying Feb, May 2020. Libin Lu edits, 2020.
Expand Down Expand Up @@ -80,7 +80,6 @@ DUCC_CXXFLAGS := -fPIC -std=c++17 -ffast-math
FINUFFT = $(dir $(realpath $(firstword $(MAKEFILE_LIST))))

# For your OS, override the above by setting make variables in make.inc ...
# (Please look in make.inc.* for ideas)
-include make.inc

# Now come flags that should be added, whatever user overrode in make.inc.
Expand Down Expand Up @@ -149,7 +148,7 @@ default: usage
all: test perftest lib examples fortran matlab octave python

usage:
@echo "Makefile for FINUFFT library. Please specify your task:"
@echo "Makefile for FINUFFT CPU library. Please specify your task:"
@echo " make lib - build the main library (in lib/ and lib-static/)"
@echo " make examples - compile and run all codes in examples/"
@echo " make test - compile and run quick math validation tests"
Expand Down

0 comments on commit d0c9c0b

Please sign in to comment.