Presented by pp11 group
Download
1 / 42

Parallel Ruby - PowerPoint PPT Presentation


  • 166 Views
  • Uploaded on

Presented by pp11 group Mezhibovsky Ilya Yampolsky Michael Reznikov Genady. Parallel Ruby. Ruby. Ruby is a powerful and dynamic open source, object-oriented programming language. creator of Ruby. Yukihiro Matsumoto ("Matz"), the creator of Ruby, is a professional

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about ' Parallel Ruby' - whitney


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

Presented by pp11 group

Mezhibovsky Ilya

Yampolsky Michael

Reznikov Genady

Parallel Ruby

Parallel Ruby - pp11


Ruby

Ruby is a powerful and dynamic

open source, object-oriented

programming language.

Parallel Ruby - pp11


creator of Ruby

Yukihiro Matsumoto ("Matz"), the

creator of Ruby, is a professional

programmer who worked for the

Japanese open source company,

netlab.jp. Matz is also known as one of

the open source evangelists in Japan.

[email protected]

Parallel Ruby - pp11


perl

ruby

History

birthday of ruby - 23 february 1993

Parallel Ruby - pp11


History

1995

First release

1999

Overtakes Python in Japan

2000

• Comp.lang.ruby (newsgroup)

• First English-language Ruby book

• IBM, Inform IT,Brave GNU World ,Sun World Feature

Ruby on web

Parallel Ruby - pp11


Perl

Smalltalk

Lisp

Python

CLU

Sather

Ada

Eiffel

Introducing

Parallel Ruby - pp11


Introducing

Ruby is developed under Linux, and is written in

fairly straightforward C.

It runs under

UNIX, DOS, Windows 95/98/NT/2000,

Mac OS X, BeOS, Amiga,

Acorn Risc OS, and OS/2.

Parallel Ruby - pp11


Introducing

Ruby's primary focus is productivity of program development, and users will find that programming in Ruby is productive and even fun. Ruby is well suited for the problem domains such as these:

Text processing— Ruby's File, String, and Regexp classes help you process text data quickly and cleanly.

Network programming — Network programming can be fun with Ruby's well-designed socket classes.

Parallel Ruby - pp11


Introducing

CGI programming— Ruby has everything you need to do CGI programming, including text-handling classes, a CGI library, database interface, and even eRuby (embedded Ruby) and mod_ruby for Apache.

GUI programming— GUI tool kit interfaces such as Ruby/Tk and Ruby/Gtk are available

Parallel Ruby - pp11


Introducing

XML programming— Text-handling features and the UTF-8-aware regular expression engine make XML programming handy in Ruby. The interface to the expat XML parser library is also available.

Prototyping— With its high productivity, Ruby is often used to make prototypes. Prototypes sometimes become production systems by replacing the bottlenecks with C written extensions.

Parallel Ruby - pp11


Introducing - editors

  • emacs/xemacs

    • www.gnu.org/software/emacs/emacs.html or http://www.xemacs.org/name="XEmacs": ruby-mode.el is supplied in the Ruby distribution. With some versions of XEmacs, you may need to add (load "font-lock") to your .emacs file to allow ruby-mode.el to detect the syntax highlighting package you’re using.

  • Jedit

    • jedit.sourceforge.net :A portable editor written in Java, comes with support for Ruby.

Parallel Ruby - pp11


Introducing - editors

  • Vim

    • http://www.vim.org/ :Vim 5.7 and later have Ruby syntax files as standard in the runtime package. For prior versions, a syntax file for Ruby is available atwww.xs4all.nl/~hipster/lib/ruby/ruby.vim.

  • Jed

    • space.mit.edu/~davis/jed.html: An s-lang file supporting Ruby is available atwww.kondara.org/~g/slang/ruby.sl .

Parallel Ruby - pp11


Introducing - editors

  • Nedit

  • http://www.nedit.org : Eric Santonacci has written Ruby support for Nedit, available fromftp.talc.fr/pub/ruby/ruby.nedit-0.1.tar.gz

  • TextPad

  • Barry Shultz has written a Ruby definition file for TextPad, available at

  • www.textpad.com/add-ons/ntsyn.html

Parallel Ruby - pp11


For me, the purpose of life is, at least partly, to have joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to make programmers happy. I consider a programming language as a user interface, so it should follow the principles of user interface.

Design Policy of Ruby by Matz

Parallel Ruby - pp11


Principle of Conciseness joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

I want computers to be my servants, not my masters. Thus, I'd like to give them orders quickly. A good servant should do a lot of work with a short order.

Design Policy of Ruby by Matz

Parallel Ruby - pp11


  • Principle of Consistency joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

  • As with uniform object treatment, as stated before, a small set of rules covers the whole Ruby language. Ruby is a relatively simple language, but it's not too simple. I've tried to follow the principle of "least surprise." Ruby is not too unique, so a programmer with basic knowledge of programming languages can learn it very quickly.

Design Policy of Ruby by Matz

Parallel Ruby - pp11


Design Policy of Ruby by Matz joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

Principle of Flexibility

Because languages are meant to express thought, a language should not restrict human thought, but should help it. Ruby consists of an unchangeable small core (that is, syntax) and arbitrary extensible class libraries. Because most things are done in libraries, you can treat user-defined classes and objects just as you treat built-in ones.

Programming is incredibly less stressful in Ruby because of these principles.

Parallel Ruby - pp11


Eiffel joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

Return

Example of ruby code

def fact(n)

if n == 0

1

else

n * fact(n-1)

end

end

Parallel Ruby - pp11


Ruby features joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

  • Ruby has simple syntax, partially inspired by

Eiffel and Ada.

 • Ruby has exception handling features, like Java or

Python, to make it easy to handle errors.

 • Ruby's operatorsare syntax sugar for the methods.

You can redefine them easily.

Parallel Ruby - pp11


Ruby features joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

  • Ruby is a complete, full, pure object oriented

language: OOL. This means all data in Ruby is

an object, not in the sense of Python or Perl, but in the

sense of Smalltalk: no exceptions.

  • Ruby features true closures. Not just unnamed

function, but with present variable bindings.

Parallel Ruby - pp11


Ruby features joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

  • Ruby's OOis carefully designed to be both

complete and open for improvements.

Example:

Ruby has the ability to add methods to a class,or even

to an instance during runtime.

So, if needed, an instance of one class *can* behave

differently from other instances of the same class

Parallel Ruby - pp11


Ruby features joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

  • Ruby features a true mark-and-sweep garbage

collector. It works with all Ruby objects.

You don't have to care about maintaining reference

counts in extension libraries

  • Writing C extensions in Ruby is easier than in Perl

or Python, due partly to the garbage collector,

and partly to the fine extension API.

Parallel Ruby - pp11


Ruby features joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

  • Ruby needs no variable declarations. It uses

simple naming conventions to denote the scope

of variables.

Examples:

simple 'var' = local variable,

'@var' = instance variable,

'$var' = global variable.

Parallel Ruby - pp11


Ruby features joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

  • Ruby can load extension libraries

dynamically if an OS allows.

  • Ruby features OSindependent threading.

Thus, for all platforms on which Ruby runs,

you also have multithreading, regardless of

if the OS supports it or not,even on MS-DOS!

Parallel Ruby - pp11


Parallel Ruby - pp11 joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to


MPI Ruby is a Ruby binding of MPI. joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

The primary goal in making this binding was to make

the power of MPI available to Ruby users in a way

that fits into the language's object oriented model.

In order to do this, the buffer and datatype management

necessary in the C, C++, and Fortran bindings

have been removed.

Parallel Ruby - pp11


  What this means is that MPI Ruby allows you to treat joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

objects as messages.

MPI Ruby also aims to be a complete binding to MPI,

in that it offers access to nearly all functionality of MPI

Parallel Ruby - pp11


. joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to Output values are returned

Ruby only has pass by value

Multiple values passed back by arrays

Errors are returned by exceptions

User-defined operations specified by Proc Objects

Blocks

Methods

Using MPI Ruby

Parallel Ruby - pp11


Using MPI Ruby joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

  • ·         All classes are contained in Module MPI

  • MPI::Comm

  • MPI::Group

  • MPI::Op

  • MPI::Keyval

  • MPI::Request

  • MPI::Status

  • MPI::Exception

Parallel Ruby - pp11


comm joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

Methods - Constructors

  • MPI::Comm#dup()

    • Duplicates the communicator and returns a new communicator

    • C equivalent: MPI_Comm_dup()

  • MPI::Comm.create(grp)

    • Creates a new communicator from the grp (of type MPI::Group)

    • C equivalent: MPI_Comm_create()

Parallel Ruby - pp11


comm joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

Methods - Topology Constructors

  • MPI::Comm#graph_create(index, edges, reorder)

    • Creates a new communicator to which graph topology information is attached. index is an array in which the i-th entry is the the total number of neighbors of the first i nodes. edges is a flattened array of the edge lists for nodes 0, 1, ...index.length reorder is a logical value indicating whether the processes may be reordered in the new topology

    • C equivalent: MPI_Graph_create()

Parallel Ruby - pp11


comm joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

Methods

  • Attributes

  • Informational Methods

  • Topology Specific Information Methods

  • Point-to-Point Communications

  • Non-blocking Point-to-Point Communications

  • Persistent Communications

  • Buffering Methods

  • Collective Operations

  • Probing

  • Comparison

  • Abortive Methods

  • Constants

Parallel Ruby - pp11


Group joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

Methods

  • Constructors

  • Informational Methods

  • MPI::Group#size()

    • Returns the size of the group

    • C equivalent: MPI_Group_size()

  • MPI::Group#|(grp)

    • Returns the union of the receiver group and grp.

    • C equivalent: MPI_Group_union()

Parallel Ruby - pp11


Op joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

Methods

  • Constructors

  • MPI::Op.create(proc, commute)

    • Returns a new MPI::Op based on the Proc object proc. proc must accept two arguments. If commute is true, proc is considered to be commutative.

    • C equivalent: MPI_Op_create()

Parallel Ruby - pp11


Keyval joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

Methods

  • Constructors

  • MPI::Keyval.create(uniq)

    • Returns a new MPI::Keyval. If uniq is true, then the attribute associated with a keyval will be deleted from the original communicator to which it was attached when that communicator is duplicated. If uniq is false, then the attribute will simply be copied to the new communicator.

    • C equivalent: MPI_Keyval_create()

Parallel Ruby - pp11


Request joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

Methods

  • Informational Methods

  • MPI::Request#null?()

    • Returns true if the request is null.

    • C equivalent: request == MPI_REQUEST_NULL

    • Wait Methods

    • Test Methods

    • Initiation and Cancellation

    • Accessors

Parallel Ruby - pp11


Status joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

Methods

  • Informational Methods

  • MPI::Status#source()

    • Returns the source of the message to which the status

    • object refers.

    • C equivalent: status.MPI_STATUS

Parallel Ruby - pp11


exception joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

exception class

  • An exception class used for passing back MPI errors

Parallel Ruby - pp11


Project joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

  • Parallel computation (with MPI) of PI in two languages

    • 1. C.

    • 2. Ruby.

    • Comparison between two programs.

Parallel Ruby - pp11


Ruby Books joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

Parallel Ruby - pp11


Ruby on WEB joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

Parallel Ruby - pp11


Ruby on WEB joy. Programmers often feel joy when they can concentrate on the creative side of programming, so Ruby is designed to

  • http://www.ruby-lang.org/en/

  • http://www.ruby-lang.org/en/hotlinks.html

  • http://www-unix.mcs.anl.gov/mpi/mpi_ruby/

  • http://www.ddj.com/articles/2002/0209/

  • http://www.rubygarden.org/ruby

  • http://www.rubycentral.com/

  • [email protected]

  • [email protected] - Emil Ong

Parallel Ruby - pp11


ad