https://github.com/marcoheisig/Petalisp Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. {{ message }} marcoheisig / Petalisp Public * Notifications * Fork 12 * Star 366 Elegant High Performance Computing License AGPL-3.0 license 366 stars 12 forks Star Notifications * Code * Issues 1 * Pull requests 0 * Actions * Projects 0 * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Security * Insights marcoheisig/Petalisp This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 2 branches 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/m] Use Git or checkout with SVN using the web URL. [gh repo clone marcoh] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @marcoheisig marcoheisig Export the split-shape function. ... ae42109 Jun 27, 2023 Export the split-shape function. ae42109 Git stats * 1,341 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time code Export the split-shape function. June 27, 2023 17:30 examples Export more multigrid symbols. April 11, 2023 18:16 .gitignore Add an (unfinished) machine learning example. February 12, 2020 15:05 COPYING Petalisp is born May 17, 2016 19:07 README.org Remove obsolete API functions, improve indentation. March 14, 2023 09:04 View code [ ] Petalisp Getting Started Showcases Performance Frequently Asked Questions Is Petalisp similar to NumPy? Do I have to program Lisp to use Petalisp? How can I get Emacs to indent Petalisp code nicely? Why is Petalisp licensed under AGPL? Why is Petalisp written in Common Lisp? README.org 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. If unsure, pick Portacle. 2. Download Petalisp via Quicklisp. 3. Check out some of 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 lazy-transpose (A) (lazy-reshape A (transform m n to n m))) Example 2: matrix-matrix multiplication (defun matrix-multiplication (A B) (lazy-reduce #'+ (lazy #'* (lazy-reshape A (transform m n to n m 1)) (lazy-reshape B (transform n k to n 1 k))))) Example 3: the numerical Jacobi scheme in two dimensions (defun lazy-jacobi-2d (grid iterations) (let ((interior (interior grid))) (if (zerop iterations) grid (lazy-jacobi-2d (lazy-fuse x (lazy #'* 0.25 (lazy #'+ (lazy-reshape x (transform i0 i1 to (+ i0 1) i1) interior) (lazy-reshape x (transform i0 i1 to (- i0 1) i1) interior) (lazy-reshape x (transform i0 i1 to i0 (+ i1 1)) interior) (lazy-reshape x (transform i0 i1 to i0 (- i1 1)) interior)))) (- iterations 1))))) Performance Coming soon! Frequently Asked Questions Is Petalisp similar to NumPy? NumPy is a widely used Python library for scientific computing on arrays. It provides powerful N-dimensional arrays and a variety of functions for working with these arrays. Petalisp works on a more fundamental level. It provides even more powerful N-dimensional arrays, but just a few building blocks for working on them - element-wise function application, reduction, reshaping and array fusion. So Petalisp is not a substitute for NumPy. However, it could be used to write a library that behaves like NumPy, but that is much faster and fully parallelized. In fact, writing such a library is one of my future goals. Do I have to program Lisp to use Petalisp? Not necessarily. Not everyone has the time to learn Common Lisp. That is why I am also working on some convenient Python bindings for Petalisp. But: If you ever have time to learn Lisp, do it! It is an enlightening experience. How can I get Emacs to indent Petalisp code nicely? Put the following code in your initialization file: (put 'lazy 'common-lisp-indent-function '(1 &rest 1)) (put 'lazy-reduce 'common-lisp-indent-function '(1 &rest 1)) (put 'lazy-multireduce 'common-lisp-indent-function '(1 1 &rest 1)) (put 'lazy-multiple-value 'common-lisp-indent-function '(1 1 &rest 1)) (put 'lazy-reshape 'common-lisp-indent-function '(1 &rest 1)) 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 almost every imaginable task. To illustrate why Lisp is particularly well suited for a project like Petalisp, consider the following implementation of a JIT-compiler for mapping a function over a vector of a certain element type: (defun vector-mapper (element-type) (compile nil `(lambda (fn vec) (declare (function fn) (type (simple-array ,element-type (*)) vec) (optimize (speed 3) (safety 0))) (loop for index below (length vec) do (symbol-macrolet ((elt (aref vec index))) (setf elt (funcall fn elt))))))) Not only is this JIT-compiler just 8 lines of code, it is also 20 times faster than invoking GCC or Clang on a roughly equivalent piece of C code. About Elegant High Performance Computing Resources Readme License AGPL-3.0 license Stars 366 stars Watchers 27 watching Forks 12 forks Report repository Releases No releases published Packages 0 No packages published Contributors 2 * @marcoheisig marcoheisig Marco Heisig * @theHamsta theHamsta Stephan Seitz Languages * Common Lisp 100.0% Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time.