Thanks to visit codestin.com
Credit goes to github.com

Skip to content

silky/Petalisp

 
 

Repository files navigation

Petalisp

Petalisp is an attempt to generate high performance code for parallel computers by JIT-compiling array definitions. It is not a full blown programming language, but rather a carefully crafted extension of Common Lisp that allows for extreme optimization and parallelization.

Getting Started

1. Install Lisp and a suitable IDE.

The fastest way to get everything up and running is to use Portacle.

2. Download Petalisp.

In order to be able to load Petalisp, you may have to place it in the appropriate project directory.

For Portacle users

cd ~/portacle/projects && git clone https://github.com/marcoheisig/Petalisp.git

For Quicklisp users

cd ~/quicklisp/local-projects && git clone https://github.com/marcoheisig/Petalisp.git

3. Load Petalisp

Launch your Lisp IDE and evaluate the following commands:

(ql:quickload :petalisp)
(ql:quickload :petalisp-test-suite)
(ql:quickload :petalisp-benchmarks)

You may also want to run the Petalisp test suite.

(asdf:test-system :petalisp)

4. Done!

Congratulations, you have now access to a highly experimental parallel programming environment! You should now be able to run the examples.

Showcases

Petalisp is still under development, so the following examples may still change slightly. Nevertheless they give a good glimpse on what programming with Petalisp will be like.

Example 1: transposing a matrix

(defun transpose (A)
  (-> A (τ (m n) (n m))))

Example 2: matrix-matrix multiplication

(defun matrix-multiplication (A B)
  (β #'+#'*
        (-> A (τ (m n) (m 1 n)))
        (-> B (τ (n k) (1 k n))))))

Example 3: the numerical Jacobi scheme in two dimensions

(defun jacobi-2d (grid iterations)
  (let ((interior (subspace grid (σ ((+ start 1) step (- end 1))
                                    ((+ start 1) step (- end 1))))))
    (if (zerop iterations) grid
        (jacobi-2d
         (fuse x
               (α #'* 0.25#'+
                     (-> x (τ (i0 i1) ((+ i0 1) i1)) interior)
                     (-> x (τ (i0 i1) ((- i0 1) i1)) interior)
                     (-> x (τ (i0 i1) (i0 (+ i1 1))) interior)
                     (-> x (τ (i0 i1) (i0 (- i1 1))) interior))))
         (- iterations 1)))))

Performance

Coming soon!

Frequently Asked Questions

Why is Petalisp licensed under AGPL?

I am aware that this license prevents some people from using or contributing to this piece of software, which is a shame. But unfortunately the majority of software developers have not yet understood that

  1. In a digital world, free software is a necessary prerequisite for a free society.
  2. When developing software, open collaboration is way more efficient than competition.

So as long as distribution of non-free software is socially accepted, copyleft licenses like the AGPL seem to be the lesser evil.

That being said, I am willing to discuss relicensing on an individual basis.

Why is Petalisp written in Common Lisp?

I couldn’t wish for a better tool for the job. Common Lisp is extremely rich in features, standardized, fast, safe and mature. The Lisp community is amazing and there are excellent libraries for every imaginable task.

About

Elegant High Performance Computing

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Common Lisp 100.0%