Bug 2088123 - cppad is missing quiet_NaN/infinite traits/funcs to work with latest Eigen
Summary: cppad is missing quiet_NaN/infinite traits/funcs to work with latest Eigen
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: cppad
Version: 36
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Brad Bell
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2022-05-18 18:33 UTC by Ben Webb
Modified: 2022-06-03 02:58 UTC (History)
1 user (show)

Fixed In Version: cppad-20220000.4-1.fc36 cppad-20220000.4-1.fc35 cppad-20220000.4-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-06-02 01:32:24 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
cppad.patch (3.64 KB, patch)
2022-05-18 18:33 UTC, Ben Webb
no flags Details | Diff

Description Ben Webb 2022-05-18 18:33:56 UTC
Created attachment 1881031 [details]
cppad.patch

Description of problem:
The version of cppad (20220000) included in F36 does not correctly
interoperate with the included version of Eigen (3.4.0). (It does work
with Eigen 3.3, as in F35.)

This is because cppad does not define the infinity() or quiet_NaN() methods
on NumTraits<RealScalar> which Eigen relies on, or specialize std::isnan,
std::isinf or std::isfinite for AD types, as described at
https://github.com/coin-or/CppAD/issues/139


Version-Release number of selected component (if applicable):
cppad-devel-20220000.1-1.fc36.x86_64
eigen3-devel-3.4.0-5.fc36.noarch


How reproducible:
Always

Steps to Reproduce:
1. $ cat test.cpp
#include <cppad/example/cppad_eigen.hpp>
#include <cppad/cppad.hpp>
#include <Eigen/Eigenvalues>
#include <Eigen/Core>
#include <unsupported/Eigen/MatrixFunctions>

typedef CppAD::AD<double> ADFloat;
typedef Eigen::Matrix<ADFloat, Eigen::Dynamic, Eigen::Dynamic> ADMatrix;
typedef Eigen::SelfAdjointEigenSolver<ADMatrix::PlainObject> EigenSolver;

int main() {
  ADMatrix x(3, 3);
  EigenSolver solver;
  solver.compute(x);
  ADMatrix y = x.sqrt();
  return 0;
}

2. $ g++ -Wall test.cpp -I/usr/include/eigen3

Actual results:
Compilation fails with
...
/usr/include/eigen3/Eigen/src/Core/MathFunctionsImpl.h:84:43: error: ‘infinity’ is not a member of ‘Eigen::NumTraits<CppAD::AD<double> >’
   84 |     return NumTraits<RealScalar>::infinity();
      |            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~


Expected results:
Compilation succeeds.


Additional info:
This has been fixed upstream in https://github.com/coin-or/CppAD/pull/140 and
https://github.com/coin-or/CppAD/pull/142 so can be fixed by updating the
cppad package. Alternatively, the attached patch fixes the issue for me.

Comment 1 Brad Bell 2022-05-19 00:55:47 UTC
Fixing this will require two steps.

1. Back port this fix for the new version of eigen to stable/cppad-2022000 and create a new release; see
https://github.com/coin-or/CppAD/tree/stable/20220000

2. Upload sources for the new release to Fedora and create a new Fedora release.

3. The rawhide version will take effect right away but the Fedora 36 version will take a week or so to go through the testing phase.

As I understand, if we change the stable/cppad-2022000 version of include/cppad/example/cppad_eigen.hpp to be the same as the master, this will fix the problem there.
Do you agree ?

Comment 2 Ben Webb 2022-05-19 03:33:29 UTC
Agreed! (Although stable/cppad-2022000 would also need the minor changes to base_limits.hpp and numeric_limits.hpp.)

Comment 3 Brad Bell 2022-05-19 11:38:58 UTC
There is an issue with this request. The user API for this stable version is fixed at 20220000.doc on
https://github.com/coin-or/CppAD/tags


I am not going to change the documentation because it is supposed to stay fixed and correspond to all the 20220000 releases
(no new features should be added to a stable version, only bug fixes).

Does this seem OK to you; i.e., stable/20220000 will have features that you are depending on but are not in its documentation ?

Comment 4 Ben Webb 2022-05-19 16:01:03 UTC
I think that would be OK.

Comment 5 Brad Bell 2022-05-20 15:36:54 UTC
I am delayed slightly due to a recent bug fix in stable/20220000; see
https://github.com/coin-or/CppAD/commit/9c3b168dc15976b6b00d29cc745d52bebf8398e1

Comment 6 Brad Bell 2022-05-21 13:18:58 UTC
I think the following release will work
https://github.com/coin-or/CppAD/releases/tag/20220000.4

Do you agree ?

Comment 7 Ben Webb 2022-05-23 17:38:53 UTC
I tested this release with both the little test.cpp (above) and my full code, and everything compiles successfully - looks good to me.

Comment 8 Brad Bell 2022-05-24 00:38:34 UTC
The new version built successfully for f37; see
https://koji.fedoraproject.org/koji/buildinfo?buildID=1969280


Also for f36; see
https://koji.fedoraproject.org/koji/buildinfo?buildID=1969284

The f36 version has to go through the testing phase; see
https://fedoraproject.org/wiki/QA:Updates_Testing

In the update request I set

# Bug numbers: 1234,9876
bugs=2088123

# A boolean to require that all of the bugs in your update have been confirmed by testers.
require_bugs=True


1. Are you able to use the testing repository to test the change to the f36 version ?
2. Do you know how to confirm that the bug has been fixed ?

Comment 9 Fedora Update System 2022-05-24 00:41:25 UTC
FEDORA-2022-f810b98ea6 has been submitted as an update to Fedora 36. https://bodhi.fedoraproject.org/updates/FEDORA-2022-f810b98ea6

Comment 10 Fedora Update System 2022-05-24 02:17:04 UTC
FEDORA-2022-2f0cc07a89 has been submitted as an update to Fedora 35. https://bodhi.fedoraproject.org/updates/FEDORA-2022-2f0cc07a89

Comment 11 Ben Webb 2022-05-24 17:57:29 UTC
I added feedback to bodhi.

Comment 12 Fedora Update System 2022-05-25 02:37:54 UTC
FEDORA-2022-f810b98ea6 has been pushed to the Fedora 36 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-f810b98ea6`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-f810b98ea6

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2022-05-25 02:57:33 UTC
FEDORA-2022-2f0cc07a89 has been pushed to the Fedora 35 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2022-2f0cc07a89`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2022-2f0cc07a89

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2022-05-25 11:56:10 UTC
FEDORA-EPEL-2022-a617cb6348 has been submitted as an update to Fedora EPEL 9. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-a617cb6348

Comment 15 Fedora Update System 2022-05-26 01:45:35 UTC
FEDORA-EPEL-2022-a617cb6348 has been pushed to the Fedora EPEL 9 testing repository.

You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2022-a617cb6348

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 16 Fedora Update System 2022-06-02 01:32:24 UTC
FEDORA-2022-f810b98ea6 has been pushed to the Fedora 36 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 17 Fedora Update System 2022-06-02 02:23:20 UTC
FEDORA-2022-2f0cc07a89 has been pushed to the Fedora 35 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 18 Fedora Update System 2022-06-03 02:58:35 UTC
FEDORA-EPEL-2022-a617cb6348 has been pushed to the Fedora EPEL 9 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.