{"action":"created","issue":{"url":"https://api.github.com/repos/numpy/numpy/issues/6669","repository_url":"https://api.github.com/repos/numpy/numpy","labels_url":"https://api.github.com/repos/numpy/numpy/issues/6669/labels{/name}","comments_url":"https://api.github.com/repos/numpy/numpy/issues/6669/comments","events_url":"https://api.github.com/repos/numpy/numpy/issues/6669/events","html_url":"https://github.com/numpy/numpy/issues/6669","id":116451370,"number":6669,"title":"Problems with Intel MKL","user":{"login":"rmalouf","id":657077,"avatar_url":"https://avatars.githubusercontent.com/u/657077?v=3","gravatar_id":"","url":"https://api.github.com/users/rmalouf","html_url":"https://github.com/rmalouf","followers_url":"https://api.github.com/users/rmalouf/followers","following_url":"https://api.github.com/users/rmalouf/following{/other_user}","gists_url":"https://api.github.com/users/rmalouf/gists{/gist_id}","starred_url":"https://api.github.com/users/rmalouf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmalouf/subscriptions","organizations_url":"https://api.github.com/users/rmalouf/orgs","repos_url":"https://api.github.com/users/rmalouf/repos","events_url":"https://api.github.com/users/rmalouf/events{/privacy}","received_events_url":"https://api.github.com/users/rmalouf/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/numpy/numpy/labels/component:%20build","name":"component: build","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":23,"created_at":"2015-11-12T00:16:40Z","updated_at":"2016-02-11T23:01:35Z","closed_at":null,"body":"I've been trying to get numpy working with Intel's MKL math library without much success.  \r\n\r\nThe first problem was convincing numpy's build process to use MKL even though I have openblas installed on my system  The problem is in `distutils/system_info.py` checks for the existence of openblas before checking whether MKL is configured.  Checking MKL first resolved that issue (I can submit a patch if you're interested).\r\n\r\nThat leads to the second problem.  When linked with MKL, numpy fails several of it's tests.  Specifically:\r\n\r\n````\r\n======================================================================\r\nERROR: test_umath.TestComplexFunctions.test_loss_of_precision(<class 'numpy.complex64'>,)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/nose/case.py\", line 198, in runTest\r\n    self.test(*self.arg)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/core/tests/test_umath.py\", line 1634, in check_loss_of_precision\r\n    check(x_series, 2.1*eps)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/core/tests/test_umath.py\", line 1603, in check\r\n    d = np.absolute(np.arcsinh(x)/np.arcsinh(z).real - 1)\r\nRuntimeWarning: divide by zero encountered in true_divide\r\n\r\n======================================================================\r\nERROR: test_umath.TestComplexFunctions.test_loss_of_precision(<class 'numpy.complex128'>,)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/nose/case.py\", line 198, in runTest\r\n    self.test(*self.arg)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/core/tests/test_umath.py\", line 1634, in check_loss_of_precision\r\n    check(x_series, 2.1*eps)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/core/tests/test_umath.py\", line 1603, in check\r\n    d = np.absolute(np.arcsinh(x)/np.arcsinh(z).real - 1)\r\nRuntimeWarning: divide by zero encountered in true_divide\r\n\r\n======================================================================\r\nERROR: test_umath.TestComplexFunctions.test_loss_of_precision_longcomplex\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/nose/case.py\", line 198, in runTest\r\n    self.test(*self.arg)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/testing/decorators.py\", line 216, in knownfailer\r\n    return f(*args, **kwargs)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/core/tests/test_umath.py\", line 1681, in test_loss_of_precision_longcomplex\r\n    self.check_loss_of_precision(np.longcomplex)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/core/tests/test_umath.py\", line 1632, in check_loss_of_precision\r\n    check(x_series, 50*eps)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/core/tests/test_umath.py\", line 1603, in check\r\n    d = np.absolute(np.arcsinh(x)/np.arcsinh(z).real - 1)\r\nRuntimeWarning: divide by zero encountered in true_divide\r\n\r\n======================================================================\r\nERROR: test_scripts.test_f2py\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/nose/case.py\", line 198, in runTest\r\n    self.test(*self.arg)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/testing/decorators.py\", line 146, in skipper_func\r\n    return f(*args, **kwargs)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/tests/test_scripts.py\", line 68, in test_f2py\r\n    code, stdout, stderr = run_command([f2py_cmd, '-v'])\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/tests/test_scripts.py\", line 48, in run_command\r\n    proc = Popen(cmd, stdout=PIPE, stderr=PIPE)\r\n  File \"/home/malouf/python/lib/python3.5/subprocess.py\", line 950, in __init__\r\n    restore_signals, start_new_session)\r\n  File \"/home/malouf/python/lib/python3.5/subprocess.py\", line 1540, in _execute_child\r\n    raise child_exception_type(errno_num, err_msg)\r\nFileNotFoundError: [Errno 2] No such file or directory: 'f2py3.5'\r\n\r\n======================================================================\r\nFAIL: test_accelerate_framework_sgemv_fix (test_multiarray.TestDot)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/core/tests/test_multiarray.py\", line 4275, in test_accelerate_framework_sgemv_fix\r\n    assert_dot_close(A_f, X_f, desired)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/core/tests/test_multiarray.py\", line 4260, in assert_dot_close\r\n    assert_allclose(np.dot(A, X), desired, rtol=1e-5, atol=1e-7)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/testing/utils.py\", line 1347, in assert_allclose\r\n    verbose=verbose, header=header)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/testing/utils.py\", line 708, in assert_array_compare\r\n    raise AssertionError(msg)\r\nAssertionError: \r\nNot equal to tolerance rtol=1e-05, atol=1e-07\r\n\r\n(mismatch 62.68%)\r\n x: array([ 163.433014,  144.792694,  145.528854, ...,  103.144707,\r\n         94.63633 ,   98.819527], dtype=float32)\r\n y: array([  54.477672,   48.264233,   48.50962 , ...,  103.144708,\r\n         94.636337,  148.229279])\r\n\r\n======================================================================\r\nFAIL: test_dot_3args (test_multiarray.TestDot)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/core/tests/test_multiarray.py\", line 4171, in test_dot_3args\r\n    assert_array_equal(r2, r)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/testing/utils.py\", line 782, in assert_array_equal\r\n    verbose=verbose, header='Arrays are not equal')\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/testing/utils.py\", line 708, in assert_array_compare\r\n    raise AssertionError(msg)\r\nAssertionError: \r\nArrays are not equal\r\n\r\n(mismatch 39.74609375%)\r\n x: array([  7.675112,  11.017172,   5.982513, ...,  14.025107,  14.226657,\r\n        20.369611])\r\n y: array([ 11.512668,  16.525758,   8.973769, ...,  14.025107,  14.226657,\r\n        20.369611])\r\n\r\n======================================================================\r\nFAIL: test_polyfit_build (test_regression.TestRegression)\r\n----------------------------------------------------------------------\r\nTraceback (most recent call last):\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/lib/tests/test_regression.py\", line 111, in test_polyfit_build\r\n    assert_array_almost_equal(ref, tested)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/testing/utils.py\", line 886, in assert_array_almost_equal\r\n    precision=decimal)\r\n  File \"/home/malouf/python/lib/python3.5/site-packages/numpy/testing/utils.py\", line 708, in assert_array_compare\r\n    raise AssertionError(msg)\r\nAssertionError: \r\nArrays are not almost equal to 6 decimals\r\n\r\n(mismatch 100.0%)\r\n x: array([ -1.061238e-06,   5.708869e-04,  -1.138220e-01,   9.953682e+00,\r\n        -3.145265e+02])\r\n y: array([ 0.003459, -0.012066,  0.046189, -0.349192,  0.086812])\r\n````\r\n\r\nI don't even know where to begin to isolate the problem.  Has anyone reported this before?  What other information would be helpful?  I'm using numpy 1.10.1, python 3.5.0, gcc 4.8.3, MKL 11.3."},"comment":{"url":"https://api.github.com/repos/numpy/numpy/issues/comments/183093448","html_url":"https://github.com/numpy/numpy/issues/6669#issuecomment-183093448","issue_url":"https://api.github.com/repos/numpy/numpy/issues/6669","id":183093448,"user":{"login":"rmalouf","id":657077,"avatar_url":"https://avatars.githubusercontent.com/u/657077?v=3","gravatar_id":"","url":"https://api.github.com/users/rmalouf","html_url":"https://github.com/rmalouf","followers_url":"https://api.github.com/users/rmalouf/followers","following_url":"https://api.github.com/users/rmalouf/following{/other_user}","gists_url":"https://api.github.com/users/rmalouf/gists{/gist_id}","starred_url":"https://api.github.com/users/rmalouf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmalouf/subscriptions","organizations_url":"https://api.github.com/users/rmalouf/orgs","repos_url":"https://api.github.com/users/rmalouf/repos","events_url":"https://api.github.com/users/rmalouf/events{/privacy}","received_events_url":"https://api.github.com/users/rmalouf/received_events","type":"User","site_admin":false},"created_at":"2016-02-11T23:01:35Z","updated_at":"2016-02-11T23:01:35Z","body":"The issue with building numpy+mkl comes up if you've also got openblas installed in a place where distutils can find it.  Since it checks for openblas first, it'll use it even if you've specified mkl in site.cfg.  I just submitted at PR (#7232) to correct that."}}