Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^3: Multi-core and the future

by swampyankee (Parson)
on Aug 31, 2008 at 22:26 UTC ( [id://708081]=note: print w/replies, xml ) Need Help??


in reply to Re^2: Multi-core and the future
in thread Multi-core and the future

Parallelism is one of the reasons why F90 introduced array operations, e.g., something like Perl's @a = @b or grep; implementation of these would be an obvious part a parallel version of Perl (∀Perl?). In F90, there is no special syntax akin to @a = @b »+« @c needed; it's not distinguished from a regular addition.


Information about American English usage here and here. Floating point issues? Please read this before posting. — emc

Replies are listed 'Best First'.
Re^4: Multi-core and the future
by John M. Dlugosz (Monsignor) on Sep 01, 2008 at 18:37 UTC
    Consider multiplication. @a »*« @b is explicitly element-wise looping over the operator. @a * @b is not built-in, and could be defined, for example, between two Matrix objects if you like, to do matrix multiplication. You could also define infix:<+> between two lists to simply call the hyperoperator. Also, the syntax generalizes more than the implicit way of Fortran: apply a method call to each element, rather than to the container itself.

      Usually (F90 permits overloading), F90's array operations apply the same operation to each element of an array, and cannot process arrays which aren't conformal (same organization), so F90's array operation A = B * C would be the equivalent to

      real,dimension(2,3,4) :: A, B, C integer j, k, m do j = 1, 2 do k = 1, 3 do m = 1, 4 A(j,k,m) = B(j,k,m) * C(j,k,m) enddo enddo enddo

      Of course, Fortran programmers like typing no more than any other type of programmer1, so A = B * C would be preferred ;-).

      I'm not saying that the F90 way is optimal; it's just that the philosophy behind the F90 standard is to make parallelization transparent to the application programmer, which means that having a different syntax for parallel operations would be frowned upon. Certainly, some of Perl's existing syntax (grep, many list operations) could be parallelized without any visible changes to the language.


      1 Well, maybe COBOL programmers like typing, but I wouldn't want to stereotype them.


      Information about American English usage here and here. Floating point issues? Please read this before posting. — emc

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://708081]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-24 08:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found