===== Single-Assignment C ===== An array programming language for numerically intensive applications and signal processing. \\ [[:docs:main| Documentation]] [[:download:main| Download]] --- Latest Release: NoJS ==== SaC focuses on ==== === Performance === Combining state-of-the-art optimisations with targeted code generation techniques, SaC can make the most out of your system. === Productivity === Effortlessly create programs for scientific workloads, using abstractions in SaC that match closely to the underlying mathematics. Through suitable interfaces, SaC can be integrated into your existing application stack and workflow. === Portability === //Write it once, reuse it everywhere// is a central theme of SaC. Why waste time rethinking your algorithm for the next architecture or new system configuration. Let SaC do that for you! You can read more about SaC's [[:hppp|design principles]] or have a look at our [[:publications|publications]] for details on our optimisations. ==== Familiar, but different ==== SaC looks and feels like C/C++, with some extra functionality on top **without** the headaches and pitfalls of memory management. To give you a little taste and feel of SaC, here are some examples: === Matrix Multiplication === use Array: all; double[.,.] matmul (double[.,.] a, double[.,.] b) { // transpose bt = { [i,j] -> b[j,i] }; // multiplication return { iv -> sum (a[iv[0]] * bt[iv[1]]) | iv < [shape(a)[0],shape(b)[1]] }; } int main() { // create matrices A = reshape ([6,8], tod (iota (48))); B = reshape ([8,2], tod (iota (16))); C = matmul (A, B); StdIO::print (C); return 0; } === Parallel Scan === int [+], int scan (int [+] a) { // TODO TC multiple return not supported yet a, m = { iv -> scan (a[iv ]) | iv < drop ([ -1] , shape (a)) }; m, s = scan (m); a = a ^+ m; return (a, s); } The //all pair N-body problem// can be almost literally transliterated from its mathematical formulation into a valid SaC program: \begin{eqnarray} \overset{\tiny k+1}{p_i} &=& \overset{k}{p_i} + \overset{k}{v_i} dt \\ \overset{k+1}{v_i} &=& \overset{k}{v_i} + \overset{k}{a_i} dt \\ \overset{k+1}{a_i} &=& \sum\limits_{j \neq i}^{n} \dfrac{m_j (\overset{k+1}{p_j} - \overset{k+1}{p_i})} {\left|\overset{k+1}{p_j} - \overset{k+1}{p_i} \right|^3} \end{eqnarray} p = p + v * dt; v = v + a * dt; a = {[i] -> vsum ({[j] -> (i == j ? [0.0, 0.0, 0.0] : m[j] * (p[j] - p[i]) / (l2norm (p[j] - p[i]) ^ 3) }) }; Have a look at the [[:docs:syntax|syntax definition]] for more details. ==== Getting Started ==== You can try out SaC //without// installing it, have look at: [[https://glot.io/new/sac|{{:logos:glot-logo-gray.svg?200|Glot.io}}]] [[https://mybinder.org/v2/gh/SacBase/sac-jupyter-notebook/HEAD|{{:logos:binder-logo.svg?250|MyBinder.io}}]] [[https://jupyter.oi.pe/|{{:logos:jupyter-logo.svg?200|Jupyter}}]] Or you can start your journey by [[:download:main|locally installing SaC]]. ==== Under the hood ==== ==== Get involved ==== SaC is a community effort by developers //like you//, whether you're coming from industry, academia, or are a hobbyist, with your help we can make SaC better! === Contributing === Do you have an idea, some way to improve the SaC experience, or just want to tame dragons with us? Then come join us and help to shape SaC! See our [[:community:contributing|contribution guide]] for details. === Bug Reporting === Have you spotted a bug? Noticed an issue? Who you going to call? Your friendly bug zapping developers! Submit your report on our [[https://gitlab.sac-home.org/sac-group/sac2c/-/issues| issue tracker]]. === Chat with us === Want to pick our brains, or have some question? We're happy to chat! Have a look at our [[:communications|communication guide]] on how to reach us. ~~NOTOC~~