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.
The fastest way to get everything up and running is to use Portacle.
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.gitFor Quicklisp users
cd ~/quicklisp/local-projects && git clone https://github.com/marcoheisig/Petalisp.gitLaunch 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)Congratulations, you have now access to a highly experimental parallel programming environment! You should now be able to run the examples.
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)))))Coming soon!
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
- In a digital world, free software is a necessary prerequisite for a free society.
- 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.
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.