From d0c9c0b183364ddee078db67c59cd58d37a478b7 Mon Sep 17 00:00:00 2001 From: ahbarnett Date: Tue, 7 Jan 2025 16:53:51 -0500 Subject: [PATCH] tidy all make.inc.* to make-platforms/, fix CI and docs to match --- .github/workflows/C++.yml | 6 ++-- .github/workflows/C++_build_win.ps1 | 2 +- .github/workflows/mex.yml | 4 +-- CHANGELOG | 1 + docs/install.rst | 28 +++++++++---------- make-platforms/README | 7 +++++ make.inc.GCC7 => make-platforms/make.inc.GCC7 | 0 .../make.inc.linux_ICC | 0 .../make.inc.macosx_arm64 | 0 .../make.inc.macosx_arm64_matlab2022b_beta | 0 .../make.inc.macosx_clang | 0 .../make.inc.macosx_clang_matlab | 0 .../make.inc.macosx_gcc-10 | 0 .../make.inc.macosx_gcc-12 | 0 .../make.inc.macosx_gcc-8 | 0 .../make.inc.manylinux | 0 .../make.inc.powerpc | 0 .../make.inc.windows_mingw | 2 +- .../make.inc.windows_msys | 0 makefile | 7 ++--- 20 files changed, 32 insertions(+), 25 deletions(-) create mode 100644 make-platforms/README rename make.inc.GCC7 => make-platforms/make.inc.GCC7 (100%) rename make.inc.linux_ICC => make-platforms/make.inc.linux_ICC (100%) rename make.inc.macosx_arm64 => make-platforms/make.inc.macosx_arm64 (100%) rename make.inc.macosx_arm64_matlab2022b_beta => make-platforms/make.inc.macosx_arm64_matlab2022b_beta (100%) rename make.inc.macosx_clang => make-platforms/make.inc.macosx_clang (100%) rename make.inc.macosx_clang_matlab => make-platforms/make.inc.macosx_clang_matlab (100%) rename make.inc.macosx_gcc-10 => make-platforms/make.inc.macosx_gcc-10 (100%) rename make.inc.macosx_gcc-12 => make-platforms/make.inc.macosx_gcc-12 (100%) rename make.inc.macosx_gcc-8 => make-platforms/make.inc.macosx_gcc-8 (100%) rename make.inc.manylinux => make-platforms/make.inc.manylinux (100%) rename make.inc.powerpc => make-platforms/make.inc.powerpc (100%) rename make.inc.windows_mingw => make-platforms/make.inc.windows_mingw (98%) rename make.inc.windows_msys => make-platforms/make.inc.windows_msys (100%) diff --git a/.github/workflows/C++.yml b/.github/workflows/C++.yml index d93ac3720..80d4e9ef6 100644 --- a/.github/workflows/C++.yml +++ b/.github/workflows/C++.yml @@ -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: | @@ -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: | @@ -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 diff --git a/.github/workflows/C++_build_win.ps1 b/.github/workflows/C++_build_win.ps1 index 7936ff48b..45a2ad7f2 100644 --- a/.github/workflows/C++_build_win.ps1 +++ b/.github/workflows/C++_build_win.ps1 @@ -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, '..', '..')) diff --git a/.github/workflows/mex.yml b/.github/workflows/mex.yml index 4502ff560..60177e64d 100644 --- a/.github/workflows/mex.yml +++ b/.github/workflows/mex.yml @@ -24,7 +24,7 @@ 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} @@ -32,7 +32,7 @@ jobs: 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 diff --git a/CHANGELOG b/CHANGELOG index 37c30a102..326c32fc8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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) diff --git a/docs/install.rst b/docs/install.rst index 761450a8b..b0b2f518e 100644 --- a/docs/install.rst +++ b/docs/install.rst @@ -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. @@ -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 `_ -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 @@ -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, @@ -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:: @@ -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 @@ -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:: @@ -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 diff --git a/make-platforms/README b/make-platforms/README new file mode 100644 index 000000000..c5772e006 --- /dev/null +++ b/make-platforms/README @@ -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 diff --git a/make.inc.GCC7 b/make-platforms/make.inc.GCC7 similarity index 100% rename from make.inc.GCC7 rename to make-platforms/make.inc.GCC7 diff --git a/make.inc.linux_ICC b/make-platforms/make.inc.linux_ICC similarity index 100% rename from make.inc.linux_ICC rename to make-platforms/make.inc.linux_ICC diff --git a/make.inc.macosx_arm64 b/make-platforms/make.inc.macosx_arm64 similarity index 100% rename from make.inc.macosx_arm64 rename to make-platforms/make.inc.macosx_arm64 diff --git a/make.inc.macosx_arm64_matlab2022b_beta b/make-platforms/make.inc.macosx_arm64_matlab2022b_beta similarity index 100% rename from make.inc.macosx_arm64_matlab2022b_beta rename to make-platforms/make.inc.macosx_arm64_matlab2022b_beta diff --git a/make.inc.macosx_clang b/make-platforms/make.inc.macosx_clang similarity index 100% rename from make.inc.macosx_clang rename to make-platforms/make.inc.macosx_clang diff --git a/make.inc.macosx_clang_matlab b/make-platforms/make.inc.macosx_clang_matlab similarity index 100% rename from make.inc.macosx_clang_matlab rename to make-platforms/make.inc.macosx_clang_matlab diff --git a/make.inc.macosx_gcc-10 b/make-platforms/make.inc.macosx_gcc-10 similarity index 100% rename from make.inc.macosx_gcc-10 rename to make-platforms/make.inc.macosx_gcc-10 diff --git a/make.inc.macosx_gcc-12 b/make-platforms/make.inc.macosx_gcc-12 similarity index 100% rename from make.inc.macosx_gcc-12 rename to make-platforms/make.inc.macosx_gcc-12 diff --git a/make.inc.macosx_gcc-8 b/make-platforms/make.inc.macosx_gcc-8 similarity index 100% rename from make.inc.macosx_gcc-8 rename to make-platforms/make.inc.macosx_gcc-8 diff --git a/make.inc.manylinux b/make-platforms/make.inc.manylinux similarity index 100% rename from make.inc.manylinux rename to make-platforms/make.inc.manylinux diff --git a/make.inc.powerpc b/make-platforms/make.inc.powerpc similarity index 100% rename from make.inc.powerpc rename to make-platforms/make.inc.powerpc diff --git a/make.inc.windows_mingw b/make-platforms/make.inc.windows_mingw similarity index 98% rename from make.inc.windows_mingw rename to make-platforms/make.inc.windows_mingw index e37a1436b..3f2f34a03 100644 --- a/make.inc.windows_mingw +++ b/make-platforms/make.inc.windows_mingw @@ -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= diff --git a/make.inc.windows_msys b/make-platforms/make.inc.windows_msys similarity index 100% rename from make.inc.windows_msys rename to make-platforms/make.inc.windows_msys diff --git a/makefile b/makefile index c73c9800d..dee06f9b4 100644 --- a/makefile +++ b/makefile @@ -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. @@ -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. @@ -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"