From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA14722; Mon, 25 Nov 2002 11:18:37 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA14851 for ; Mon, 25 Nov 2002 11:18:36 +0100 (MET) Received: from jerry.kfunigraz.ac.at (GIGAJERRY.kfunigraz.ac.at [143.50.55.161]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id gAPAIZX27392 for ; Mon, 25 Nov 2002 11:18:35 +0100 (MET) Received: from tom.kfunigraz.ac.at (mc_tom [10.10.1.160]) by jerry.kfunigraz.ac.at (8.11.2/8.11.2) with ESMTP id gAPAIZm08942 for ; Mon, 25 Nov 2002 11:18:35 +0100 (MET) Received: from kfunigraz.ac.at (IGAM08AV.kfunigraz.ac.at [143.50.39.35]) by tom.kfunigraz.ac.at (8.11.2/8.11.2) with ESMTP id gAPAIYJ22279; Mon, 25 Nov 2002 11:18:34 +0100 (MET) Message-ID: <3DE204D1.9090901@kfunigraz.ac.at> Date: Mon, 25 Nov 2002 12:09:05 +0100 From: Siegfried Gonzi User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.8) Gecko/20020204 X-Accept-Language: en-us MIME-Version: 1.0 To: Siegfried Gonzi CC: caml-list@inria.fr Subject: Re: [Caml-list] Some clarifications to the language shootout page References: <3DE1E6CD.2020906@kfunigraz.ac.at> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk For the sake of completeness: An update to the Fortran 90/95 version. This version comes close to C and even surpasses it a bit after adding a few lines (the overal matrix matrix multiplication scheme just remains valid, though). The author (thanks to François BÉREUX) gave the okay for posting it here: == Hello, I reply to you privately about the F90 code of the benchmark you mention (because this is only Fortran related and not Caml related, but you can quote my e-mail if you want): there is a primitive in the F90 language called matmul which precisely does dense matrix-matrix multiplication, and which is pretty well optimized. I ran the test on a Sun Solaris Ultra SParc III 600 MHz , with the compiler suite WorkShop 6.2, and I got the following timings : 1) your C version (compiled with the -fast option) : 2.4s/2.02s/0.03s 2) your F90 version (compiled with the -fast option) : 5.2s/4.4s/0.02s 3)a F90 version using matmul (compiled with the -fast option ): 0.8s/0.7s/0.06s I guess a similar conclusion will hold on your platform. Now, if you do not want to use the matmul or dot_product primitives and would like to program in a F77 way, the following code for mmult is better suited than yours: subroutine mmult(m, n, a, b, c) integer, intent(in) :: m,n double precision, dimension(:,:), intent(in) :: a,b double precision, dimension(:,:), intent(out) :: c integer :: i,j,k !! initialize c by 0. do j = 1, n do i = 1, m c(i,j) = 0.0 enddo enddo !! do k = 1, n do j = 1, n do i =1, m c(i,j) = c(i,j) + a(i,k)*b(k,j) enddo enddo enddo !! end subroutine mmult 4)a F90 version with an improved mmult (compiled with the -fast option ): 2.8s/1.8s/0.07s which is faster than the C version. Best regards, F. Béreux PS : please find enclosed the F90 code using matmul: ========== version using matmul ========== program main integer:: size=512 double precision, POINTER,dimension(:,:):: m1, m2, mm call mkmatrix(size,size,m1) call mkmatrix(size,size,m2) call mkmatrix(size,size,mm) mm = matmul(m1,m2) print *, mm(1,1) deallocate(m1) deallocate(m2) deallocate(mm) contains subroutine mkmatrix(rows, cols,m) integer, intent(in):: rows, cols double precision, POINTER, dimension(:,:):: m double precision:: counter integer:: i,j allocate(m(rows,cols)) counter = 1.0 do i=1,cols do j=1,rows counter = counter + 1.0 m(j,i) = counter end do end do end subroutine mkmatrix end program main =============================== S. Gonzi ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners