astro-informatics / sopt

Sparse OPTimisation using state-of-the-art convex optimisation algorithms.
http://astro-informatics.github.io/sopt/
GNU General Public License v2.0
9 stars 10 forks source link

[3.0.1] test_credible_region fails on i386 #251

Open olebole opened 5 years ago

olebole commented 5 years ago

Sopt 3.0.1 was accepted a few days ago by our (Debian) ftp-masters and was now attempted to build on all our architectures. There is a failure on the i386 architecture:

16/18 Test #17: test_credible_region .............***Failed   39.36 sec
[2019-09-04 18:01:19.488] [sopt] [info] Confidence interval: %91
[2019-09-04 18:01:19.488] [sopt] [info] γ = 17342.8, g(x_s) = 0

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_credible_region is a Catch v1.12.1 host application.
Run with -? for options

Randomness seeded to: 1567620079

-------------------------------------------------------------------------------
calculating gamma
-------------------------------------------------------------------------------
/<<PKGBUILDDIR>>/cpp/tests/credible_region.cc:15
...............................................................................

/<<PKGBUILDDIR>>/cpp/tests/credible_region.cc:25: FAILED:
  CHECK( gamma == N * (std::sqrt(16 * std::log(3 / (1 - alpha)) / N) + 1) )
with expansion:
  17342.7612390137 == 17342.7612390137
[…]

Full build (and test) log here. Since other 32-bit architectures (ARM, MIPS, X32) build successfully, I would guess that this may be due to the higher precision of the x87 coprocessor. Another issue with i386 is reported in basp-group/sopt#20.

Luke-Pratley commented 5 years ago

@dpshelio I think we can fix this by changing CHECK( gamma == N * (std::sqrt(16 * std::log(3 / (1 - alpha)) / N) + 1) ) to CHECK( gamma == Approx(N * (std::sqrt(16 * std::log(3 / (1 - alpha)) / N) + 1)) ) .

olebole commented 5 years ago

I can confirm that this works well. However, I now get another one on i386:

[2019-09-25 09:57:15.299] [sopt] [critical] Performing Primal Dual

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_primal_dual is a Catch v1.12.1 host application.
Run with -? for options

Randomness seeded to: 1569405435

-------------------------------------------------------------------------------
Primal Dual, testing norm(output - target()) < l2ball_epsilon()
-------------------------------------------------------------------------------
/<<PKGBUILDDIR>>/cpp/tests/primal_dual.cc:24
...............................................................................

/<<PKGBUILDDIR>>/cpp/tests/primal_dual.cc:51: FAILED:
  CHECK( (result.x - target).stableNorm() <= epsilon )
with expansion:
  0.1283016579 <= 0.1283016579

[2019-09-25 09:57:15.320] [sopt] [critical] Performing Primal Dual
[2019-09-25 09:57:15.320] [sopt] [critical] Performing Primal Dual
===============================================================================
test cases:  4 |  3 passed | 1 failed
assertions: 33 | 32 passed | 1 failed

This looks like that the epsilon is too small. I can open another issue for this, but since it is i386 as well, it may stay here?

olebole commented 5 years ago

I have another one -- this time on MIPS (little endian, 32 bit):

 7/18 Test #10: test_proximal ....................***Failed    0.08 sec

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
test_proximal is a Catch v1.12.1 host application.
Run with -? for options

Randomness seeded to: 1569572410

-------------------------------------------------------------------------------
L1 proximal
  General case
  Positivity constraints
-------------------------------------------------------------------------------
/<<PKGBUILDDIR>>/cpp/tests/proximal.cc:277
...............................................................................

/<<PKGBUILDDIR>>/cpp/tests/proximal.cc:249: FAILED:
  CHECK( (l1.objective(input, p_plus, gamma) > mini or rel_var < l1.tolerance() * 10) )
with expansion:
  false

/<<PKGBUILDDIR>>/cpp/tests/proximal.cc:249: FAILED:
  CHECK( (l1.objective(input, p_plus, gamma) > mini or rel_var < l1.tolerance() * 10) )
with expansion:
  false

===============================================================================
test cases:   7 |   6 passed | 1 failed
assertions: 274 | 272 passed | 2 failed
tkoskela commented 2 years ago

Looks related to #270