question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] [fftw] Precision options are not mutually exclusive

See original GitHub issue

The FFTW library can be configured to support FFTs with single, double, or long double precision, generating a separate library object for each precision. Applications that wish to support FFTs with multiple floating-point precisions must link to multiple FFTW libraries.

The current fftw/3.3.8 recipe allows specifying precision as an option but doesn’t supply an option to choose multiple precisions.

In my conanfile.txt file, I want to require fftw and specify multiple values for the precision option, e.g.:

[requires]
fftw/3.3.8

[generators]
cmake

[options]
fftw:precision=float,double

Is this possible? If so, would it generate a single cmake target with both libraries or two different cmake targets? If not, is there some other way to achieve this with conan?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jgsogocommented, Aug 6, 2020

I’m not aware of other recipes with the same casuistics, but I think it is perfectly ok to run the build three times and package all the libraries. Something like:

class Recipe(ConanFile):
    def build(self):
        if self.options.precission_double:
            with tools.chdir("build-precission-double"):
                cmake = CMake(self)
                cmake.definitions["PRECISSION_DOUBLE"]  = True
                cmake.configure()
                cmake.build()

        if self.options.precission_float:
            ...

    def package(self):
        self.copy("fftw-double.dll", src=".../build-precission-double", dst="bin")
        ...
        self.copy("fftw-float.dll", src=".../build-precission-float", dst="bin")
        ...

    def package_info(self):
        self.components["fftw-double"].libs = [...]
        ...
        self.components["fftw-float"].libs = [...]
        ...

Maybe @uilianries or @SSE4 , more experienced with recipes, have some other suggestion.

0reactions
jgsogocommented, Aug 6, 2020

Two comments are very interesting here:

link with both binaries (impossible to do it statically due to the ODR violations), probably adding runtime dispatch to load the right binary

When those libraries are mutually exclusive, the global target Conan generates is no longer valid. This is a supporting argument for @fulara 's proposal here: https://github.com/conan-io/conan/issues/7475

okay, this will work in case of two options, but in generic way… probably requires some dedicated development effort in conan client. what if we have an option with value ANY? what if we have bit_depth: range(0…1000)? doesn’t scale well enough.

IMO, this is not a scenario strong enough to justify such development in Conan (it introduces a new paradigm), I want to think that methods can be easily parametrized in the recipe:

def _build(self, precission):
    if get(self.options, "precission_" + precission):
        with tools.chdir("build-precission-" + precission):
            cmake = CMake(self)
            cmake.definitions["PRECISSION_" + precission.upper()]  = True
            cmake.configure()
            cmake.build()

def build(self):
    self._build("double")
    self._build("float")
Read more comments on GitHub >

github_iconTop Results From Across the Web

FFTW Release Notes
Fix bug that would cause 2-way SIMD (notably SSE2 in double precision) to attempt unaligned accesses in certain obscure cases, causing segfaults.
Read more >
[Buildroot] [PATCH 0/3] arch/arm a53 + ARMV8, package/fftw ...
+menu "FFTW precision and options" - http://www.fftw.org - -if BR2_PACKAGE_FFTW +source ... Should those case be mutually exclusive instead?
Read more >
ChangeLog
Sun Jul 12 06:34:46 EDT 2009 athena@fftw.org * Update NEWS, ... are mutually exclusive; thanks to Long To for his comments M ./doc/fftw3.texi...
Read more >
https://accserv.lepp.cornell.edu/svn/packages/fftw...
This code is expected to work but the FFTW maintainers do not have hardware to test it. ... and --enable-threads are mutually exclusive...
Read more >
Building Abinit
If wget is not available, use curl with the -o option to specify the name of ... compiling Fortran applications as libraries such...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found