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

add FFT=DUCC option to makefile #511

Merged
merged 19 commits into from
Aug 6, 2024
Merged

add FFT=DUCC option to makefile #511

merged 19 commits into from
Aug 6, 2024

Conversation

ahbarnett
Copy link
Collaborator

@ahbarnett ahbarnett commented Aug 2, 2024

Implements switchable FFT in gnu makefile.

Still to do:

  • docs to match
  • python test

This also fixes a couple of indep makefile bugs:

  • mat/oct R2008OO directive always used, not just when multithreaded
  • examples threadsafe shoudn't build when OMP=OFF (broke).

Reviewers please could you check:

  • DUCC_CXXFLAGS := -fPIC -std=c++17 -ffast-math I just took from cmake/setupDUCC but I'm not sure if the best default flags, esp, given fastmath bleed-over recent issue.
  • make objclean Windows I did not attempt
  • OSX I haven't checked it works yet.

The full set of test cases really is the Cartesian product:

make all
make all FFT=DUCC
make all OMP=OFF
make all FFT=DUCC OMP=OFF

WOuld be nice to have all tested in CI some day.

makefile Outdated Show resolved Hide resolved
@DiamonDinoia
Copy link
Collaborator

DiamonDinoia commented Aug 2, 2024

the following command fails for me:

make clean && make test FFT=DUCC

error:

include/finufft/fft.h:5:10: fatal error: ducc0/fft/fftnd_impl.h: No such file or directory
    5 | #include "ducc0/fft/fftnd_impl.h"

Doing

make clean && make setup FFT=DUCC && make test FFT=DUCC

works fine. Maybe the COOKIE is not picked up properly?

@DiamonDinoia
Copy link
Collaborator

CI failure seems to a missing openmp flag while compiling.

@ahbarnett
Copy link
Collaborator Author

great catch, and thanks for the fix, Libin.
I forgot about fft.h in defs.h in the spreader... simply needed since defs.h includes the plan object (which may include FFTW plan). Maybe templating whole thing would fix this, so I won't change it.

Meanwhile I've done (and improved) the install docs. Will PR soon.

@DiamonDinoia
Copy link
Collaborator

I have the following issue, if I do

make clean && make setupclean && make test FFT=DUCC -j

then some compile commands are executed before clone finishes and I get the following errors:

Cloning repository https://github.com/xtensor-stack/xsimd.git at tag 13.0.0 into directory deps/xsimd
Cloning repository https://gitlab.mpcdf.mpg.de/mtr/ducc.git at tag ducc0_0_34_0 into directory deps/ducc
make: *** No rule to make target 'deps/ducc/src/ducc0/infra/string_utils.o', needed by 'lib/libfinufft.so'.  Stop.
make: *** Waiting for unfinished jobs....
Cloning into 'deps/ducc'...
Cloning into 'deps/xsimd'...
In file included from src/fft.cpp:2:
include/finufft/fft.h:5:10: fatal error: ducc0/fft/fftnd_impl.h: No such file or directory
    5 | #include "ducc0/fft/fftnd_impl.h"
      |          ^~~~~~~~~~~~~~~~~~~~~~~~

I encountered that issue with xsimd in the past and had to change the dependencies structure for all the files requiring xsimd to depend on the .PHONY setup

@ahbarnett
Copy link
Collaborator Author

ahbarnett commented Aug 5, 2024 via email

@DiamonDinoia
Copy link
Collaborator

DiamonDinoia commented Aug 5, 2024

I tried:

$(DUCC_SRC)/%.cc: $(DUCC_COOKIE)
$(DUCC_SRC)/%.o: $(DUCC_SRC)/%.cc

or

$(DUCC_SRC)/%.cc: setup
$(DUCC_SRC)/%.o: $(DUCC_SRC)/%.cc

but it does not seem to work

@ahbarnett
Copy link
Collaborator Author

ahbarnett commented Aug 5, 2024

Weird. We could just add a note to do make setup without -j, then proceed with -j if they want.

I have other deadlines until about 5pm but can help then. There's probably some remaining doc tweaks, but it should be ready by tomorrow meeting.

@lu1and10
Copy link
Member

lu1and10 commented Aug 5, 2024

Maybe let's make it work first, I made an ugly commit to make makefile work with -j first.

  1. split ducc_setup to fft.h dependency.
  2. expand the following wildcard(not working) explicitly for ducc source, not sure why it's not working with the wildcard though, need to clean up the redundancy to use the correct wildcard.
$(DUCC_SRC)/%.cc: $(DUCC_SETUP)
$(DUCC_SRC)/%.o: $(DUCC_SRC)/%.cc
        $(CXX) -c $(DUCC_CXXFLAGS) $(DUCC_INCL) $< -o $@

@ahbarnett
Copy link
Collaborator Author

Thanks, Libin, for the (ugly) fix and the helpful comments in the makefile.
It works my end. I'm just making a bit of doc tidying then the PR is close...

@ahbarnett
Copy link
Collaborator Author

I'm hoping Marcos' FrpeoLT was a local editing problem - there is no way the file utils.h could have been changed like that!

@ahbarnett ahbarnett mentioned this pull request Aug 6, 2024
6 tasks
@ahbarnett
Copy link
Collaborator Author

ready to go. (except I can't get python to build locally, and can't doc it, indep issue.)

CMakeLists.txt Outdated
Comment on lines 147 to 148
# include(cmake/setupSphinx.cmake) # to be made default off since only for
# devs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be not commented out. Please, merge master

@@ -49,7 +49,9 @@ Developer notes

* The cufinufft Python wheels are generated using Docker based on the manylinux2014 image. For instructions, see ``tools/cufinufft/distribution_helper.sh``. These are binary wheels that are built using CUDA 11 (or optionally CUDA 12, but these are not distributed on PyPI) and bundled with the necessary libraries.

* Testing cufinufft (for FI, mostly)
* CMake compiling on linux at Flatiron Institute (Rusty cluster): We have had a report that if you want to use LLVM, you need to ``module load llvm/16.0.3`` otherwise the default ``llvm/14.0.6`` does not find ``OpenMP_CXX``.
Copy link
Collaborator

@DiamonDinoia DiamonDinoia Aug 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe this is outdated? @blackwer, could you give a review?

makefile Show resolved Hide resolved
makefile Show resolved Hide resolved
@ahbarnett
Copy link
Collaborator Author

trouble since I deleted cmake/ folder and then did new commits, then pushed. Trying to recover it.

@DiamonDinoia
Copy link
Collaborator

DiamonDinoia commented Aug 6, 2024

git checkout master -- cmake should do

@ahbarnett
Copy link
Collaborator Author

It sees them as added files but refuses to push them...

@ahbarnett
Copy link
Collaborator Author

Ok, pushed. I am getting really messed up by this new clang-format hook. (it means I have to commit twice).
Also it has messed up the cmake/setupXSIMD.cmake and cmake/setupCPM.cmake and won't stop reformatting them.. This clang-format is a huge headache for me...

@ahbarnett
Copy link
Collaborator Author

Marco, could you kindly fix those cmake files- it is impossible for me to do it thanks to your clang-format...

@DiamonDinoia
Copy link
Collaborator

I will have a look.

@ahbarnett
Copy link
Collaborator Author

doesn't seem to affect the CI. I know I have to edit .pre-commit-config.yaml
If there's an edit which stops it formatting cmake/* or *.cmake would be great. THanks!

@ahbarnett
Copy link
Collaborator Author

I'm bringing in and fixing post-merge.

@ahbarnett ahbarnett merged commit 353c971 into master Aug 6, 2024
332 checks passed
@lu1and10
Copy link
Member

lu1and10 commented Aug 7, 2024

@ahbarnett wildcard for ducc sources seems to work in the commit 57cd182 let me know if it breaks on your side

@ahbarnett
Copy link
Collaborator Author

ahbarnett commented Aug 7, 2024 via email

@lu1and10
Copy link
Member

lu1and10 commented Aug 7, 2024

Seems to work! Thanks! I don't understand the repeated colons though (two colons on same line? I didn't see that in the make manual...) Cheers, Alex

I learn from this http://makefiletutorial.com/#static-pattern-rules
Seems a popular tutorial, having 4.7k git stars.

@ahbarnett
Copy link
Collaborator Author

ahbarnett commented Aug 7, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants