Using Java for Scientific Computing. Mark Bul EPCC, University of Edinburgh

Similar documents
Java Performance Analysis for Scientific Computing

Business and Scientific Applications of the Java Programming Language

Performance Tools for Technical Computing

GUI framework communication via the WWW

Chapter 3 Parallel Software

Special Topics: Programming Languages

Distributed Systems Theory 4. Remote Procedure Call. October 17, 2008

Compaq Interview Questions And Answers

Towards OpenMP for Java

Java Internals. Frank Yellin Tim Lindholm JavaSoft

The Impact of a Real-Time JVM on Middleware Performance: Lessons Learned from Implementing DDS on IBM s J9

Chapter 1 INTRODUCTION SYS-ED/ COMPUTER EDUCATION TECHNIQUES, INC.

A Comparison of Unified Parallel C, Titanium and Co-Array Fortran. The purpose of this paper is to compare Unified Parallel C, Titanium and Co-

Learning objectives. The Java Environment. Java timeline (cont d) Java timeline. Understand the basic features of Java

A Test Suite for High-Performance Parallel Java

Proposal To Include Java. As A Language For The IOI.

Introduction to Java Programming

Programming. Syntax and Semantics

Chapter 8 :: Composite Types

Outline. Introduction to Java. What Is Java? History. Java 2 Platform. Java 2 Platform Standard Edition. Introduction Java 2 Platform

Chapter 2 First Java Programs

Java for Programmers Course (equivalent to SL 275) 36 Contact Hours

History Introduction to Java Characteristics of Java Data types

CHAPTER 1. Introduction to JAVA Programming

Numerical Methods in Scientific Computation

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++ Performance, memory

Distributed Systems. The main method of distributed object communication is with remote method invocation

Programming with MPI

Edinburgh Research Explorer

Software Development & Education Center. Java Platform, Standard Edition 7 (JSE 7)

Full file at

Shared Memory Programming With OpenMP Computer Lab Exercises

JOVE. An Optimizing Compiler for Java. Allen Wirfs-Brock Instantiations Inc.

Java On Steroids: Sun s High-Performance Java Implementation. History

Improving Geographical Locality of Data for Shared Memory Implementations of PDE Solvers

Fiji VM Safety Critical Java

CONTENTS: Array Usage Multi-Dimensional Arrays Reference Types. COMP-202 Unit 6: Arrays

Abstract 1. Introduction

Computer Caches. Lab 1. Caching

Chapter 1 GETTING STARTED. SYS-ED/ Computer Education Techniques, Inc.

30 Nov Dec Advanced School in High Performance and GRID Computing Concepts and Applications, ICTP, Trieste, Italy

High-Level Language VMs

Oracle Developer Studio 12.6

! Broaden your language horizons! Different programming languages! Different language features and tradeoffs. ! Study how languages are implemented

Non-blocking Java Communications Support on Clusters

MPI Optimisation. Advanced Parallel Programming. David Henty, Iain Bethune, Dan Holmes EPCC, University of Edinburgh

Overview. Rationale Division of labour between script and C++ Choice of language(s) Interfacing to C++

High Performance Java Remote Method Invocation for Parallel Computing on Clusters

Languages and Compilers

Chapter 1. Preliminaries

A Report on RMI and RPC Submitted by Sudharshan Reddy B

Concepts of Programming Languages

Is Functional Programming (FP) for me? ACCU Conference 2008 Hubert Matthews

Future of JRockit & Tools

Lesson 2: First Java Programs

Distributed Objects and Remote Invocation. Programming Models for Distributed Applications

Introduction to Java. Lecture 1 COP 3252 Summer May 16, 2017

Chapter 4 Communication

Chapter 24a More Numerics and Parallelism

Dynamic Cuda with F# HPC GPU & F# Meetup. March 19. San Jose, California

Point-to-Point Synchronisation on Shared Memory Architectures

Chapter 1 Preliminaries

5 Distributed Objects: The Java Approach

Middleware. Adapted from Alonso, Casati, Kuno, Machiraju Web Services Springer 2004

metaxa and the Future of Reflection

Chapter 14 Operating Systems

Computer Systems A Programmer s Perspective 1 (Beta Draft)

Chapter 14 Operating Systems

Debugging at Scale Lindon Locks

Swing Based Remote GUI Emulation

SINGLE-SIDED PGAS COMMUNICATIONS LIBRARIES. Basic usage of OpenSHMEM

Compiler Technology for Problem Solving on Computational Grids

Outline. When we last saw our heros. Language Issues. Announcements: Selecting a Language FORTRAN C MATLAB Java

Dynamic Selection of Auto-tuned Kernels to the Numerical Libraries in the DOE ACTS Collection

Addressing the Increasing Challenges of Debugging on Accelerated HPC Systems. Ed Hinkel Senior Sales Engineer

Programming with MPI

Identity-based Access Control

Untyped Memory in the Java Virtual Machine

The Sun s Java Certification and its Possible Role in the Joint Teaching Material

CAS 703 Software Design

pc++/streams: a Library for I/O on Complex Distributed Data-Structures

Sample Copy. Not for Distribution.

Shared Memory Programming With OpenMP Exercise Instructions

Allinea Unified Environment

Grid Programming Models: Current Tools, Issues and Directions. Computer Systems Research Department The Aerospace Corporation, P.O.

CMSC 714 Lecture 6 MPI vs. OpenMP and OpenACC. Guest Lecturer: Sukhyun Song (original slides by Alan Sussman)

Active Server Pages Architecture

Programming Languages FILS Andrei Vasilateanu

Shared Memory Parallel Programming. Shared Memory Systems Introduction to OpenMP

Review of previous examinations TMA4280 Introduction to Supercomputing

ava with Object-Oriented Generic Programming+ Java Java with Object-Oriented + Generic Programming by Paul S. Wang sofpower.com

Introduction to Java Programming CPIT 202. WEWwwbvxnvbxmnhsgfkdjfcn

Protection. Thierry Sans

Detection and Analysis of Iterative Behavior in Parallel Applications

Distributed OS and Algorithms

Interaction of JVM with x86, Sparc and MIPS

The Overall SHRIMP Project. Related Work (from last section) Paper Goals. Bill Kramer April 17, 2002

Parallel Programming Environments. Presented By: Anand Saoji Yogesh Patel

Contents. Figures. Tables. Examples. Foreword. Preface. 1 Basics of Java Programming 1. xix. xxi. xxiii. xxvii. xxix

The PAPI Cross-Platform Interface to Hardware Performance Counters

Transcription:

Using Java for Scientific Computing Mark Bul EPCC, University of Edinburgh markb@epcc.ed.ac.uk

Java and Scientific Computing? Benefits of Java for Scientific Computing Portability Network centricity Software engineering Security GUI development Trained programmers Availability and cost Problems Performance Numerical problems Parallel programming models

Portability Java is platform neutral Compiler generates byte-code for the Java Virtual Machine (JVM) Byte-code is platform independent - runs on any platform with a JVM Language Specification No platform dependent aspects of the language specification e.g. size of primitive data types is specified, not platform dependent Hence both Java source and byte-code is extremely portable

Why Portability? Rapidly changing technology Applications codes typically have a longer lifetime than hardware (3-5 years) Much effort spent on porting codes between systems Fortran and C only portable with care and expert knowledge Publishing applications great way to share applications via the WWW no problem of conditional compilation, nasty configure scripts don t need to publish source code (just publish byte code) Heterogeneous Grid computing The user has a single meta-resource for solving their problem How to compile if target hardware unknown at job submission time? Java is a natural language choice for the Grid

Network Centricity Java has considerable built-in support for distributed computing e.g. remote method invocation (RMI) - allows Java to invoke methods of remote Java objects as if they were local Also stream based connections via sockets Dynamic class loading facilities allow a JVM to download and run code from across the internet Important for remote visualisation, computational steering Natural candidate at least for the gluing applications together, if not programming the computational kernels themselves

Software Engineering Java is an Object-Oriented Language well establish programming paradigm Encapsulation and polymorphism facilitates code re-use reduced development time Some scientific applications don t fit the O-O model nicely, but you don t need to use it can write Java codes in a procedural manner Simpler and cleaner than C++

Software Engineering Java has many nice features No pointers Garbage collection Type checking Array and string bounds checking Exception handling Standard debugger with JDK Extensive standard class libraries Faster development times Rapid prototyping Less buggy code

Security Java has a number of security features Essential for a distributed language No direct access to memory Cannot forge pointers to memory, overflow arrays, read memory outside array bounds Byte verification process Performed on any untrusted code Ensure code is well formed - prevents corrupted byte code Sandbox Untrusted code runs within a sandbox Has restrictions on what it can do. e.g. no access to local file system Digital Signatures Can be attached to Java code - trusted code can run without sandbox restrictions

Other Benefits Java provides a portable and easy to use GUI library Advantage over C/C++ which has platform specific libraries Allows GUIs / applets to be developed for scientific applications Easier to view and share results Trained Programmers Java is rapidly becoming the language of choice in undergraduate courses Students / teenagers interested in Java - creating applets for their web pages. Will become easier to recruit good Java programmers, Fortran programmers (even C programmers?) will become rare.

Availability 1 Java is available on almost every platform PC (Windows and Linux), Sun, SGI, HP, IBM, Hitachi,. Cheap Java technology is free for almost all platforms Reliable A decent Java implementation is seen as important by most vendors

Issues 1 Performance is Java performance unacceptable compared to traditional languages (e.g. C and Fortran)? Numerics number of concerns relating to complex numbers, floating point arithmetic, multidimensional arrays.. Parallel programming models does Java support any standard parallel programming models?

Performance 1 Java has a bad name for performance early implementations were interpreters Java based GUIs can be very poor Much effort has been expended on just-in-time compilers. Performance is dependent on how code is written Standard class libraries often much worse than user-written code Heavy OO design can be costly in performance In best case Within a factor of 2 of highly optimising Fortran and C compilers Competitive with gcc

Java Grande Benchmarks 1 See www.epcc.ed.ac.uk/javagrande/ for details SOR 100 iterations of successive over-relaxation on an NxN grid Sparse matrix vector multiplication using an unstructured sparse matrix stored in compressed-row format with a prescribed sparsity structure MolDyn a simple O(N 2 ) N-body code modelling particles interacting under a Lennard- Jones potential in a cubic spatial volume with periodic boundary conditions Euler solves the time-independent Euler equation for flow in a channel with a bump on one of the walls

Pentium III PC 1 35 30 25 Sun JDK 1.4.1 (client) Sun JDK 1.4.1.(server) gcc 2.95.3-5 g77 2.95.3-5 Time (seconds) 20 15 10 5 0 SOR Sparse Euler MolDyn

Sun Ultrasparc III 1 30 25 20 Sun JDK 1.4.1 (client) Sun JDK 1.4.1.(server) Sun WS 6 cc 5.3 Sun WS 6 f90 6.2 Time (seconds) 15 10 5 0 SOR Sparse Euler MolDyn

IBM Power4 1 18 16 14 12 IBM J2RE 1.3.0 XL Fortran 7.01 C for AIX 6.0 Time (seconds) 10 8 6 4 2 0 SOR Sparse Euler MolDyn

Numerics Issues 1 Java was not primarily designed for numerically intensive computation. Some of the early design decisions in the language reflect this, and now seem cast in stone...

Support for IEEE 754 1 Java s floating point arithmetic mostly follows IEEE 754 However: Java only supports Round-to-nearest Java cannot trap IEEE floating point exceptions Java only defines one bit pattern for NaNs For most applications this is OK, but some users really do care about this!

Complex Numbers 1 Lack of efficient support in Java Currently need a Complex class, objects contain e.g. two doubles rather complicated method calls behave differently from primitive types performance hit involved compared to primitive types Technically, there are a number of possible solutions, but none seem likely to be adopted.

Multidimensional Arrays 2 In Java multidimensional arrays are arrays of one dimensional arrays optimisation problems different row lengths, multiple bounds checking at run-time, not contiguous in memory To improve performance requires true rectangular arrays (all rows the same length) A multi-dimensional array package is available, but the interface is not very pleasant...

Libraries 2 Java is a young language Fewer standardised numerical libraries available than traditional HPC languages Java Native Interface (JNI) provides Java codes with access to native code (e.g. MPI and LAPACK) Less than ideal loss of security, portability, reproducibility, robustness run-time overhead in invoking a native method Libraries written in Java Java Numerical Library (JNL), Visual Numerics JAMA, Mathworks + NIST see: http://math.nist.gov/javanumerics

Parallel programming 2 Java has some built in parallel programming paradigms: Java Threads shared memory paradigm tolerable efficiency on moderate size SMP systems utility should be improved by addition of Concurrency package in Java 1.5 RMI (Remote Method Invocation) invoke methods on objects in another JVM high latency very different paradigm from message passing BSD Sockets high latency more suitable for client/server style

MPI and OpenMP 2 No standardised equivalents in Java some research grade projects, but nothing of industrial strength Possible to use JNI to access native MPI libraries mpijava, MPJ define interfaces not portable solution serialization of objects is a bottleneck Possible to have a pure Java implementation so far performance is disappointing Can implement a pure Java OpenMP-like interface on top of Java threads see www.epcc.ed.ac.uk/research/jomp

Summary 2 Java has some very attractive features as a programming language It was never designed for scientific computing, so there are some inherent disadvantages don t expect them to be fixed any time soon... In the end, it depends on your priorities for your application.