Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Functional Programming in Java: Does functional programming support SIMD (Vector) computation?

 
Ranch Hand
Posts: 133
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Although Java is my favorite language, I haven't really had a motivation to look at functional programming until recently.   A few weeks ago, I did a project using numpy in Python (numpy is a numerical processing package).  To my surprise, many of the computations using numpy were much faster than equivalent operations in Java. It turned out that the reason for this was that numpy could take advantage of CPU support for SIMD computations when performing vector operations such as matrix multiplications, etc.    I was wondering if the new operators introduced for Java 8 to support functional programming allow Java to exploit on-chip vector calculations.  If so, where should I look to learn more?  Does your book cover this topic?

Thanks.

Gary

 
Author
Posts: 161
31
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gary,

No, my book does not cover this topic. Generally speaking, using specificities of processors has not much to do with functional programming. Functional languages implementers have to translate functional programs into imperative programs that are executable by the processors. Beside this, Java is compiled to bytecode, which means code for a virtual processor (The JVM). So exploiting on chip vector calculation is not something the Java compiler can't do. This is done by the JVM itself. The JVM does use SIMD by default and this can be switched on and of using the -XX:+UseSuperWord parameter.

If you need information about SIMD in Java, I suggest this article: Java and SIMD
 
Gary W. Lucas
Ranch Hand
Posts: 133
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.

From what I've seen of the functional programming syntax, it seemed to me that it might be able to be optimized for SIMD processing more effectively than plain-old loops.   But it was only speculation on my part.  Thanks for the clarification.

I'm actually looking for a good book on functional programming.  So this book promotion comes at a good time.

Gary
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic