{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/10157","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/10157/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/10157/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/10157/events","html_url":"https://github.com/JuliaLang/julia/issues/10157","id":57290148,"number":10157,"title":"Why Fortran is slow in the benchmark \"rand_mat_mul\" ?","user":{"login":"nsapy","id":7269267,"avatar_url":"https://avatars.githubusercontent.com/u/7269267?v=3","gravatar_id":"","url":"https://api.github.com/users/nsapy","html_url":"https://github.com/nsapy","followers_url":"https://api.github.com/users/nsapy/followers","following_url":"https://api.github.com/users/nsapy/following{/other_user}","gists_url":"https://api.github.com/users/nsapy/gists{/gist_id}","starred_url":"https://api.github.com/users/nsapy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nsapy/subscriptions","organizations_url":"https://api.github.com/users/nsapy/orgs","repos_url":"https://api.github.com/users/nsapy/repos","events_url":"https://api.github.com/users/nsapy/events{/privacy}","received_events_url":"https://api.github.com/users/nsapy/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2015-02-11T08:54:18Z","updated_at":"2015-03-27T16:17:21Z","closed_at":"2015-02-12T14:25:27Z","body":"Hi,\r\nBenchmark test results on the home page of Julia (http://julialang.org/) shows that Fortran is about 4x slower than Julia/Numpy in the \"rand_mat_mul\" benchmark.\r\n\r\n**I can not understand that why fortran is slower while calling from the same fortran library (BLAS)??**\r\n\r\nI have also performed a simple test for matrix multiplication evolving fortran, julia and numpy and got the similar results:\r\n* Julia\r\n```julia\r\n>> n = 1000; A = rand(n,n); B = rand(n,n);\r\n>> @time C = A*B;\r\n>> elapsed time: 0.069577896 seconds (7 MB allocated)\r\n```\r\n* Numpy in IPython\r\n```python\r\n>> from numpy import *\r\n>> n = 1000; A = random.rand(n,n); B = random.rand(n,n);\r\n>> %time C = dot(A,B);\r\n>> Wall time: 98 ms\r\n```\r\n* Fortran\r\n```fortran\r\nPROGRAM TEST\r\n\r\n\tIMPLICIT NONE\r\n\tINTEGER, PARAMETER :: N = 1000\r\n\tINTEGER :: I,J\r\n\tREAL*8 :: T0,T1\r\n\r\n\tREAL*8 :: A(N,N), B(N,N), C(N,N)\r\n\r\n\tCALL RANDOM_SEED()\r\n\tDO I = 1, N, 1\r\n\t\tDO J = 1, N, 1\r\n\t\t\tCALL RANDOM_NUMBER(A(I,J))\r\n\t\t\tCALL RANDOM_NUMBER(B(I,J))\r\n\t\tEND DO\r\n\tEND DO\r\n\r\n\tcall cpu_time(t0)\r\n\tCALL DGEMM ( \"N\", \"N\", N, N, N, 1.D0, A, N, B, N, 0.D0, C, N )\r\n\tcall cpu_time(t1)\r\n\r\n\twrite(unit=*, fmt=\"(a24,f10.3,a1)\") \"Time for Multiplication:\",t1-t0,\"s\"\r\n\t\r\nEND PROGRAM TEST\r\n```\r\n```dos\r\n>> gfortran test_blas.f90 libopenblas.dll -O3 & a.exe\r\n>> Time for Multiplication:     0.296s\r\n```"},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/86993044","html_url":"https://github.com/JuliaLang/julia/issues/10157#issuecomment-86993044","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/10157","id":86993044,"user":{"login":"PallHaraldsson","id":8005416,"avatar_url":"https://avatars.githubusercontent.com/u/8005416?v=3","gravatar_id":"","url":"https://api.github.com/users/PallHaraldsson","html_url":"https://github.com/PallHaraldsson","followers_url":"https://api.github.com/users/PallHaraldsson/followers","following_url":"https://api.github.com/users/PallHaraldsson/following{/other_user}","gists_url":"https://api.github.com/users/PallHaraldsson/gists{/gist_id}","starred_url":"https://api.github.com/users/PallHaraldsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PallHaraldsson/subscriptions","organizations_url":"https://api.github.com/users/PallHaraldsson/orgs","repos_url":"https://api.github.com/users/PallHaraldsson/repos","events_url":"https://api.github.com/users/PallHaraldsson/events{/privacy}","received_events_url":"https://api.github.com/users/PallHaraldsson/received_events","type":"User","site_admin":false},"created_at":"2015-03-27T16:17:21Z","updated_at":"2015-03-27T16:17:21Z","body":"As this is closed, should Fortran's numbers at julialang.org be updated (with or without a new version of compiler)? I see #10175 was merged and backported to 0.3 (not sure what that means as it is Fortran90 code..). Maybe it's time to update Julia's numbers to a newer version also (I'm not sure you would want to do that and not other languages)?\r\n"}}