Function multi_normal_log causing intel compiler issues again


I recently updated my Intel C++ compiler from 2018.1.156 to 2018.2.185.

Following the update I started getting the following error message whenever I tried using the multi_normal_log function from the Stan Math library.

$HOME/stan-dev/math/stan/math/prim/mat/fun/promote_common.hpp(23): error: more than one partial specialization matches the template argument list of class
            " stan::math::promote_elements<Eigen::Matrix<double, -1, 1, 0, -1, 1>, Eigen::Matrix<double, -1, 1, 0, -1, 1>>"
            " stan::math::promote_elements<Eigen::Matrix<T, R, C, <expression>, R, C>, Eigen::Matrix<S, R, C, <expression>, R, C>>"
            " stan::math::promote_elements<Eigen::Matrix<T, R, C, <expression>, R, C>, Eigen::Matrix<T, R, C, <expression>, R, C>>"
    return promote_elements<typename common_type<T1, T2>::type, F>::promote(u);
          detected during:
            instantiation of "stan::math::common_type<T1, T2>::type stan::math::promote_common<T1,T2,F>... at                                                                 line 30 of "$HOME/stan-dev/math/stan/math/prim/mat/fun/mdivide_left_ldlt.hpp"
            instantiation of "Eigen::Matrix<boost::math::tools::promote_args<T1, T2, float, ...> stan::math::mdivide_left_ldlt(...) at                                        line 29 of "$HOME/stan-dev/math/stan/math/prim/mat/fun/trace_inv_quad_form_ldlt.hpp"
            instantiation of "boost::enable_if_c<<expression>, boost::math::tools::promote_args<T1, T2, float, ...>::type>::type stan::math::trace_inv_quad_form_ldlt(...) at line 107 of "$HOME/stan-dev/math/stan/math/prim/mat/prob/multi_normal_lpdf.hpp"
            instantiation of "stan::return_type<T_y, T_loc, T_covar, double, ...>::type stan::math::multi_normal_lpdf<propto,T_y,T_loc,T_covar>(...)" at                      line 117 of "$HOME/stan-dev/math/stan/math/prim/mat/prob/multi_normal_lpdf.hpp"
            instantiation of "stan::return_type<T_y, T_loc, T_covar, double, ...>::type stan::math::multi_normal_lpdf(...) at                                                 line 25 of "$HOME/stan-dev/math/stan/math/prim/mat/prob/multi_normal_log.hpp"
            instantiation of "stan::return_type<T_y, T_loc, T_covar, double, ...>::type stan::math::multi_normal_log(...) at                                                  line 112 of "../oo-npm-inference/include/mh-sm-mala.hpp"

Here is my call to the compiler

icl -MD -Qstd=c++11 -EHsc -W3 -nologo -Qdiag-disable:1786,cpu-dispatch -debug:full -Zi -Od -traceback -c -I$HOME/stan-dev/math/lib/eigen_3.3.3 -I$HOME/fftw-3.3.5 -I$HOME/stan-dev/math  -I$HOME/stan-dev/math/lib/boost_1.65.1                                  -I$HOME/stan-dev/math/lib/cvodes_2.9.0/include   ../npm-inference/tests/stan-multi_normal_log-test.cpp -FoBUILD_npm-inference_cygwin_ifort_64_DEBUG1/tests/OBJECTS/stan-multi_normal_log-test.obj

And here is a simple example that triggers the error,

#include <stan/math.hpp>
#include <iostream>

int main() {
  Eigen::Matrix<double, Eigen::Dynamic, 1> y(3, 1);
  y << 2.0, -2.0, 11.0;
  Eigen::Matrix<double, Eigen::Dynamic, 1> mu(3, 1);
  mu << 1.0, -1.0, 3.0;
  Eigen::Matrix<double, Eigen::Dynamic, Eigen::Dynamic> Sigma(3, 3);
  Sigma << 9.0, -3.0, 0.0, -3.0, 4.0, 0.0, 0.0, 0.0, 5.0;

  std::cout << stan::math::multi_normal_lpdf(y, mu, Sigma);

  return 0;

This all works fine when I use the older version of the compiler.


@phillipm, really sorry to say, but this sounds like a compiler bug.

Can you check for open Intel C++ compiler bugs? Or point us to where that bug tracker is? I don’t even know where to start on this one.



Thanks for posting that to their forums. Please let us know if you get any traction there.