(8966,17728,'2016-06-23 14:54:29','2016-06-23 18:54:29','<div id=\"outline-container-sec-1\" class=\"outline-2\">\r\n<h4 id=\"sec-1\">Introduction</h4>\r\n<div class=\"outline-text-2\" id=\"text-1\">\r\n<p>\r\nA couple of months ago, I began investigating GPU passthrough on my workstation to test ArrayFire on different operating systems. Around the same time, we at ArrayFire found ourselves with a few surplus GPUs.\r\n</p>\r\n\r\n<p>\r\nHaving had great success with my virtualization efforts, we decided to build a Virtualized GPU Server to utilize these GPUs. Building a Virtualized GPU Server alleviated one of the pain points at our company: We no longer need to swap GPUs or Hard Disks to test a new environment.\r\n</p>\r\n\r\n<p>\r\nTo maximize the number of GPUs we can put in a machine, we ended up getting a <a href=\"http://exxactcorp.com/index.php/solution/solu_detail/207\">Quantum TXR430-0768R</a> from Exxact Computing which comes in a 4U form factor and supports upto 8x double width GPUs.\r\n</p>\r\n\r\n<table border=\"0\">\r\n<td>\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/06/server_front.jpg\"><img src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/06/server_front-300x225.jpg\" alt=\"server_front\" width=\"300\" height=\"225\" class=\"aligncenter size-medium wp-image-8959\" /></a>\r\n</td>\r\n\r\n<td>\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/06/server_7_gpus_top-1.jpg\"><img src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/06/server_7_gpus_top-1-300x225.jpg\" alt=\"server_7_gpus_top\" width=\"300\" height=\"225\" class=\"aligncenter size-medium wp-image-8955\" /></a>\r\n</td>\r\n</table>\r\n\r\n<p>\r\nThe GPUs used for this build include:\r\n</p>\r\n\r\n<ul class=\"org-ul\">\r\n<li><a href=\"http://www.amd.com/en-us/products/graphics/workstation/firepro-remote-graphics/s9150\">AMD Firepro S9150</a> x3\r\n</li>\r\n<li><a href=\"http://www.amd.com/en-us/products/graphics/server/s7150\">AMD Firepro S7150</a>\r\n</li>\r\n<li><a href=\"http://www.nvidia.com/object/tesla-k80.html\">NVIDIA Tesla K80</a>\r\n</li>\r\n<li><a href=\"http://www.nvidia.com/object/tesla-workstations.html\">NVIDIA Tesla K40</a>\r\n</li>\r\n<li><a href=\"http://www.nvidia.com/content/tesla/pdf/tesla-kseries-overview-lr.pdf\">NVIDIA Tesla K10</a> (PDF)\r\n</li>\r\n</ul>\r\n\r\n<p>\r\n<b>Special Thanks</b> to AMD and NVIDIA for providing us with the GPUs used in this build.\r\n</p>\r\n\r\n<p>\r\n<b>Note:</b> If you are planning to purchase hardware for PCI passthrough, ensure both your motherboard and the processor support IOMMU. A short (but by no means comprehensive) list <a href=\"https://en.wikipedia.org/wiki/List_of_IOMMU-supporting_hardware\">can be found here</a>.\r\n</p>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-2\" class=\"outline-2\">\r\n<h4 id=\"sec-2\">Setting up PCI passthrough</h4>\r\n<div class=\"outline-text-2\" id=\"text-2\">\r\n<p>\r\nThis section describes how to setup PCI passthrough on Ubuntu 16.04. This\r\nis based on <a href=\"https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF\">this arch wiki article</a> about the same topic.\r\n</p>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-2-1\" class=\"outline-3\">\r\n<h5 id=\"sec-2-1\">Setup machine for virtualization</h5>\r\n<div class=\"outline-text-3\" id=\"text-2-1\">\r\n<ul class=\"org-ul\">\r\n<li>Add <code>intel_iommu=on</code> to the kernel parameter in grub\r\n</li>\r\n<li>Edit <code>/etc/default/grub</code> and add <code>intel_iommu=on</code> (or <code>amd_iommu=on</code>, if you have AMD) to the <code>GRUB_CMDLINE_LINUX_DEFAULT</code> line.\r\n</li>\r\n<li>Make sure you create the new <code>grub.cfg</code> file by running the following command\r\n</li>\r\n</ul>\r\n\r\n<div class=\"org-src-container\">\r\n\r\n<pre class=\"src src-sh\">sudo grub-mkconfig -o /boot/grub/grub.cfg\r\n</pre>\r\n</div>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Blacklist <code>nouveau</code>, <code>radeon</code>, <code>amdgpu</code>\r\n</li>\r\n<li>create a file called <code>/etc/modprobe.d/blacklist-gpu.conf</code> and add the following lines\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nblacklist nouveau\r\nblacklist radeon\r\nblacklist amdgpu\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>This step may break GUI login on your server machine. Make sure you have an SSH or VNC login to your server.\r\n</li>\r\n\r\n<li>Reboot\r\n</li>\r\n</ul>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-2-2\" class=\"outline-3\">\r\n<h5 id=\"sec-2-2\">Adding Devices for PCI passthrough</h5>\r\n<div class=\"outline-text-3\" id=\"text-2-2\">\r\n<ul class=\"org-ul\">\r\n<li>Run the following command to get the list of IOMMU groups\r\n</li>\r\n</ul>\r\n\r\n<div class=\"org-src-container\">\r\n\r\n<pre class=\"src src-sh\">for iommu_group in $(find /sys/kernel/iommu_groups/ -maxdepth 1 -mindepth 1 -type d); do echo \"IOMMU group $(basename \"$iommu_group\")\"; for device in $(ls -1 \"$iommu_group\"/devices/); do echo -n $\'\\t\'; lspci -nns \"$device\"; done; done\r\n</pre>\r\n</div>\r\n\r\n<ul class=\"org-ul\">\r\n<li>The PCI IDs are of the form <code>[abcd:xyzw]</code>\r\n</li>\r\n\r\n<li>Add the PCI ids you want to pass through to <code>/etc/modprobe.d/vfio.conf</code>. Create the file if it does not exist.\r\n</li>\r\n\r\n<li>A sample configuration is given below.\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\noptions vfio-pci ids=10de:1024,10de:102d\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Add the following vfio modules to <code>/etc/initramfs-tools/modules</code>\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nvfio\r\nvfio_iommu_type1\r\nvfio_pci\r\nvfio_virqfd\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Run <code>sudo update-initramfs -u</code> to generate the new initrd image.\r\n</li>\r\n\r\n<li>Reboot\r\n</li>\r\n</ul>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-2-3\" class=\"outline-3\">\r\n<h5 id=\"sec-2-3\">Setting up QEMU + KVM + libvirt for PCI passthrough</h5>\r\n<div class=\"outline-text-3\" id=\"text-2-3\">\r\n<ul class=\"org-ul\">\r\n<li>Install the required virtualization packages\r\n</li>\r\n</ul>\r\n\r\n<div class=\"org-src-container\">\r\n\r\n<pre class=\"src src-sh\">sudo apt-get install qemu-kvm ovmf bridge-utils uml-utilities libvirt-bin virt-manager\r\n</pre>\r\n</div>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Add the user to the <code>kvm</code> and <code>libvirtd</code> groups\r\n</li>\r\n</ul>\r\n\r\n<div class=\"org-src-container\">\r\n\r\n<pre class=\"src src-sh\">sudo usermod -a -G kvm userid\r\nsudo usermod -a -G libvirtd userid\r\n</pre>\r\n</div>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Edit <code>/etc/libvirt/qemu.conf</code> and add (or uncomment) the following line if not already present\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nnvram = [    \"/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd\"\r\n]\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>restart libvrit-bin service\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nsudo systemctl restart libvirt-bin\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>You are now ready to pass through the GPU!\r\n</li>\r\n</ul>\r\n</div>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3\" class=\"outline-2\">\r\n<h4 id=\"sec-3\">Setting up the virtual machines</h4>\r\n<div class=\"outline-text-2\" id=\"text-3\">\r\n<p>\r\nThis section describes how to set up and maintain VMs using <code>libvirt</code> in the frontend and <code>qemu+kvm</code> in the backend. This can be achieved by either using the command line (<code>virsh</code>) and GUI (<code>virt-manager</code>).\r\n</p>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3-1\" class=\"outline-3\">\r\n<h5 id=\"sec-3-1\">Creating a storage pool</h5>\r\n<div class=\"outline-text-3\" id=\"text-3-1\">\r\n<p>\r\nIf you plan on using the default pool, skip this section.\r\n</p>\r\n\r\n<ul class=\"org-ul\">\r\n<li>For creating a pool from command line using <code>virsh</code>, <a href=\"https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Administration_Guide/ch13s03s03.html\">follow these instructions</a>.\r\n</li>\r\n<li>For creating a pool using <code>virt-manager</code>, <a href=\"https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Administration_Guide/sect-Virtualization-Storage_Pools-Creating-Local_Directories.html#idp13442168\">follow these instructions</a>.\r\n</li>\r\n</ul>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3-2\" class=\"outline-3\">\r\n<h5 id=\"sec-3-2\">Creating a volume</h5>\r\n<div class=\"outline-text-3\" id=\"text-3-2\">\r\n<ul class=\"org-ul\">\r\n<li>For creating a volume from the command line using <code>virsh</code>, use the following commands\r\n</li>\r\n</ul>\r\n\r\n<div class=\"org-src-container\">\r\n\r\n<pre class=\"src src-sh\">virsh vol-create-as --pool my-storage-pool --name disk-01.qcow2 --capacity 80G --format qcow2\r\n</pre>\r\n</div>\r\n\r\n<ul class=\"org-ul\">\r\n<li>For creating a volume using <code>virt-manager</code>, double click on your connection,\r\n</li>\r\n</ul>\r\n<p>\r\nnavigate to storage, choose your pool, press <code>+</code> and follow the instructions.\r\n</p>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3-3\" class=\"outline-3\">\r\n<h5 id=\"sec-3-3\">Networking</h5>\r\n<div class=\"outline-text-3\" id=\"text-3-3\">\r\n<p>\r\n<code>libvirt</code> defaults to creating a NAT interface for networking. If you want to use networking through a NAT interface, you can skip this section.\r\n</p>\r\n\r\n<p>\r\nThe rest of the section deals with creating a bridge interface which can later be used by the VMs.\r\n</p>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Edit <code>/etc/network/interfaces</code>\r\n</li>\r\n<li>Add the following lines towards the end. Use the appropriate network interface instead of <code>eth1</code>\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nauto br0\r\niface br0 inet dhcp\r\n    bridge_ports eth1\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Restart the network\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nsystemctl restart networking network-manager\r\n</pre>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3-4\" class=\"outline-3\">\r\n<h5 id=\"sec-3-4\">Installing an OS</h5>\r\n<div class=\"outline-text-3\" id=\"text-3-4\">\r\n<p>\r\n<b>Installing an OS from command line</b>\r\n</p>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Run a command similar to the following\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nvirt-install --name test-vm-01 --memory 8192\\\r\n--vcpus 4 --disk /my/storage/location/disk-01.qcow2\\\r\n--graphics vnc,password=foobar,listen=0.0.0.0\\\r\n--cdrom /path/to/os-install.iso\\\r\n--network bridge=br0\\\r\n--host-device=pci_abcd_vw_xy_z\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Note the pci id passed to <code>host-device</code> is in a slightly different format than the output from <code>lspci</code>\r\n</li>\r\n<li>The <code>vw_xy_z</code> format is extracted from the output of <code>lspci</code> which returns the ids in <code>vw:xy.z</code> format.\r\n</li>\r\n<li>You can now run the following command to get the appropriate pci id for <code>virsh</code>\r\n</li>\r\n</ul>\r\n<pre class=\"example\">\r\nvirsh nodedev-list | grep vw_xy_z\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Note, <code>listen=0.0.0.0</code> makes the vm visible to everyone. Mask it to the required subnets appropriately.\r\n</li>\r\n<li>change the password to be something more appropriate.\r\n</li>\r\n\r\n<li>Once the command is run, you can queiry the <code>vncdisplay</code> using the following command:\r\n</li>\r\n</ul>\r\n<pre class=\"example\">\r\nvirsh vncdisplay test-vm-01\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>You can then use this information to connect to the server using a vnc client of choice\r\n</li>\r\n</ul>\r\n\r\n<p>\r\n<b>Installing an OS using <code>virt-manager</code></b>\r\n</p>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Click on create new virtual machine (top left icon)\r\n</li>\r\n<li><code>Local install media</code>. Browse and choose install media\r\n</li>\r\n<li>Optional: Set OS type and version appropriately\r\n</li>\r\n<li>Choose the desired amount of RAM and CPU cores\r\n</li>\r\n<li>Expand <code>Network selection</code> and make sure the Bridge <code>br0</code> is selected\r\n</li>\r\n<li><code>Select or create custom storage</code>. Browse to the storage disk created earlier\r\n</li>\r\n<li>Check the box that says <b>Customize configuration before install</b>\r\n</li>\r\n<li>Click on <code>Add Hardware</code>\r\n</li>\r\n<li>Choose <code>PCI Host Device</code> and select the device you want to pass through\r\n</li>\r\n<li>Click <code>Begin Installation</code> on top left corner.\r\n</li>\r\n</ul>\r\n\r\n<p>\r\n<i>If the GPU being pass through has audio support, you need to add it to the VM as well.</i>\r\n</p>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3-5\" class=\"outline-3\">\r\n<h5 id=\"sec-3-5\">Accessing the VMs</h5>\r\n<div class=\"outline-text-3\" id=\"text-3-5\">\r\n<ul class=\"org-ul\">\r\n<li>If you setup the VM to use bridge networking, it can be accessed directly via the ip within the LAN.\r\n</li>\r\n<li>If you setup the VM to use VNC, you can access the VM using any VNC client software.\r\n</li>\r\n<li>If you are on Linux, you can install <code>virt-manager</code> and connect to the remote server and all of it\'s VMs.\r\n</li>\r\n</ul>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3-6\" class=\"outline-3\">\r\n<h5 id=\"sec-3-6\">Cloning the VMs</h5>\r\n<div class=\"outline-text-3\" id=\"text-3-6\">\r\n<ul class=\"org-ul\">\r\n<li>From command line run the following command\r\n</li>\r\n</ul>\r\n<pre class=\"example\">\r\nvirt-clone --original original-vm-name --name new-vm-name --file /path/to/new/disk.qcow2\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Alternatively, from <code>virt-manager</code> simply right click on the vm and choose clone.\r\n</li>\r\n</ul>\r\n</div>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-4\" class=\"outline-2\">\r\n<h4 id=\"sec-4\">Conclusion</h4>\r\n<div class=\"outline-text-2\" id=\"text-4\">\r\n<p>\r\nAlthough time consuming, this build has been very fruitful for us. It allows us to seamlessly snapshot, clone, restore, and switch between various configurations. We plan on doing interesting things with this setup including integrating it with our <a href=\"http://ci.arrayfire.org/\">continuous integration</a> system.\r\n</p>\r\n\r\n<p>\r\nWe also have other interesting ideas brewing internally to leverage this infrastructure. Follow this blog for updates in this regard!\r\n</p>\r\n</div>\r\n</div>\r\n</div>','Using GPUs in KVM Virtual Machines','','inherit','closed','closed','','8927-revision-v1','','','2016-06-23 14:54:29','2016-06-23 18:54:29','',8927,'http://sandbox.arrayfire.com/8927-revision-v1/',0,'revision','',0),(8967,17728,'2016-06-23 14:56:12','2016-06-23 18:56:12','<div id=\"outline-container-sec-1\" class=\"outline-2\">\r\n<h4 id=\"sec-1\">Introduction</h4>\r\n<div class=\"outline-text-2\" id=\"text-1\">\r\n<p>\r\nA couple of months ago, I began investigating GPU passthrough on my workstation to test ArrayFire on different operating systems. Around the same time, we at ArrayFire found ourselves with a few surplus GPUs.\r\n</p>\r\n\r\n<p>\r\nHaving had great success with my virtualization efforts, we decided to build a Virtualized GPU Server to utilize these GPUs. Building a Virtualized GPU Server alleviated one of the pain points at our company: We no longer need to swap GPUs or Hard Disks to test a new environment.\r\n</p>\r\n\r\n<p>\r\nTo maximize the number of GPUs we can put in a machine, we ended up getting a <a href=\"http://exxactcorp.com/index.php/solution/solu_detail/207\">Quantum TXR430-0768R</a> from Exxact Computing which comes in a 4U form factor and supports upto 8x double width GPUs.\r\n</p>\r\n\r\n<table border=\"0\">\r\n<td>\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/06/server_front.jpg\"><img src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/06/server_front-300x225.jpg\" alt=\"server_front\" width=\"300\" height=\"225\" class=\"aligncenter size-medium wp-image-8959\" /></a>\r\n</td>\r\n\r\n<td>\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/06/server_7_gpus_top-1.jpg\"><img src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/06/server_7_gpus_top-1-300x225.jpg\" alt=\"server_7_gpus_top\" width=\"300\" height=\"225\" class=\"aligncenter size-medium wp-image-8955\" /></a>\r\n</td>\r\n</table>\r\n\r\n<p>\r\nThe GPUs used for this build include:\r\n</p>\r\n\r\n<ul class=\"org-ul\">\r\n<li><a href=\"http://www.amd.com/en-us/products/graphics/workstation/firepro-remote-graphics/s9150\">AMD Firepro S9150</a> x3\r\n</li>\r\n<li><a href=\"http://www.amd.com/en-us/products/graphics/server/s7150\">AMD Firepro S7150</a>\r\n</li>\r\n<li><a href=\"http://www.nvidia.com/object/tesla-k80.html\">NVIDIA Tesla K80</a>\r\n</li>\r\n<li><a href=\"http://www.nvidia.com/object/tesla-workstations.html\">NVIDIA Tesla K40</a>\r\n</li>\r\n<li><a href=\"http://www.nvidia.com/content/tesla/pdf/tesla-kseries-overview-lr.pdf\">NVIDIA Tesla K10</a> (PDF)\r\n</li>\r\n</ul>\r\n\r\n<p>\r\n<b>Special Thanks</b> to AMD and NVIDIA for providing us with the GPUs used in this build.\r\n</p>\r\n\r\n<p>\r\n<b>Note:</b> If you are planning to purchase hardware for PCI passthrough, ensure both your motherboard and the processor support IOMMU. A short (but by no means comprehensive) list <a href=\"https://en.wikipedia.org/wiki/List_of_IOMMU-supporting_hardware\">can be found here</a>.\r\n</p>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-2\" class=\"outline-2\">\r\n<h4 id=\"sec-2\">Setting up PCI passthrough</h4>\r\n<div class=\"outline-text-2\" id=\"text-2\">\r\n<p>\r\nThis section describes how to setup PCI passthrough on Ubuntu 16.04. This\r\nis based on <a href=\"https://wiki.archlinux.org/index.php/PCI_passthrough_via_OVMF\">this arch wiki article</a> about the same topic.\r\n</p>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-2-1\" class=\"outline-3\">\r\n<h5 id=\"sec-2-1\">Setup machine for virtualization</h5>\r\n<div class=\"outline-text-3\" id=\"text-2-1\">\r\n<ul class=\"org-ul\">\r\n<li>Add <code>intel_iommu=on</code> to the kernel parameter in grub\r\n</li>\r\n<li>Edit <code>/etc/default/grub</code> and add <code>intel_iommu=on</code> (or <code>amd_iommu=on</code>, if you have AMD) to the <code>GRUB_CMDLINE_LINUX_DEFAULT</code> line.\r\n</li>\r\n<li>Make sure you create the new <code>grub.cfg</code> file by running the following command\r\n</li>\r\n</ul>\r\n\r\n<div class=\"org-src-container\">\r\n\r\n<pre class=\"src src-sh\">sudo grub-mkconfig -o /boot/grub/grub.cfg\r\n</pre>\r\n</div>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Blacklist <code>nouveau</code>, <code>radeon</code>, <code>amdgpu</code>\r\n</li>\r\n<li>create a file called <code>/etc/modprobe.d/blacklist-gpu.conf</code> and add the following lines\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nblacklist nouveau\r\nblacklist radeon\r\nblacklist amdgpu\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>This step may break GUI login on your server machine. Make sure you have an SSH or VNC login to your server.\r\n</li>\r\n\r\n<li>Reboot\r\n</li>\r\n</ul>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-2-2\" class=\"outline-3\">\r\n<h5 id=\"sec-2-2\">Adding Devices for PCI passthrough</h5>\r\n<div class=\"outline-text-3\" id=\"text-2-2\">\r\n<ul class=\"org-ul\">\r\n<li>Run the following command to get the list of IOMMU groups\r\n</li>\r\n</ul>\r\n\r\n<div class=\"org-src-container\">\r\n\r\n<pre class=\"src src-sh\">for iommu_group in $(find /sys/kernel/iommu_groups/ -maxdepth 1 -mindepth 1 -type d); do echo \"IOMMU group $(basename \"$iommu_group\")\"; for device in $(ls -1 \"$iommu_group\"/devices/); do echo -n $\'\\t\'; lspci -nns \"$device\"; done; done\r\n</pre>\r\n</div>\r\n\r\n<ul class=\"org-ul\">\r\n<li>The PCI IDs are of the form <code>[abcd:xyzw]</code>\r\n</li>\r\n\r\n<li>Add the PCI ids you want to pass through to <code>/etc/modprobe.d/vfio.conf</code>. Create the file if it does not exist.\r\n</li>\r\n\r\n<li>A sample configuration is given below.\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\noptions vfio-pci ids=10de:1024,10de:102d\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Add the following vfio modules to <code>/etc/initramfs-tools/modules</code>\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nvfio\r\nvfio_iommu_type1\r\nvfio_pci\r\nvfio_virqfd\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Run <code>sudo update-initramfs -u</code> to generate the new initrd image.\r\n</li>\r\n\r\n<li>Reboot\r\n</li>\r\n</ul>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-2-3\" class=\"outline-3\">\r\n<h5 id=\"sec-2-3\">Setting up QEMU + KVM + libvirt for PCI passthrough</h5>\r\n<div class=\"outline-text-3\" id=\"text-2-3\">\r\n<ul class=\"org-ul\">\r\n<li>Install the required virtualization packages\r\n</li>\r\n</ul>\r\n\r\n<div class=\"org-src-container\">\r\n\r\n<pre class=\"src src-sh\">sudo apt-get install qemu-kvm ovmf bridge-utils uml-utilities libvirt-bin virt-manager\r\n</pre>\r\n</div>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Add the user to the <code>kvm</code> and <code>libvirtd</code> groups\r\n</li>\r\n</ul>\r\n\r\n<div class=\"org-src-container\">\r\n\r\n<pre class=\"src src-sh\">sudo usermod -a -G kvm userid\r\nsudo usermod -a -G libvirtd userid\r\n</pre>\r\n</div>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Edit <code>/etc/libvirt/qemu.conf</code> and add (or uncomment) the following line if not already present\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nnvram = [    \"/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd\"\r\n]\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>restart libvrit-bin service\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nsudo systemctl restart libvirt-bin\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>You are now ready to pass through the GPU!\r\n</li>\r\n</ul>\r\n</div>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3\" class=\"outline-2\">\r\n<h4 id=\"sec-3\">Setting up the virtual machines</h4>\r\n<div class=\"outline-text-2\" id=\"text-3\">\r\n<p>\r\nThis section describes how to set up and maintain VMs using <code>libvirt</code> in the frontend and <code>qemu+kvm</code> in the backend. This can be achieved by either using the command line (<code>virsh</code>) and GUI (<code>virt-manager</code>).\r\n</p>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3-1\" class=\"outline-3\">\r\n<h5 id=\"sec-3-1\">Creating a storage pool</h5>\r\n<div class=\"outline-text-3\" id=\"text-3-1\">\r\n<p>\r\nIf you plan on using the default pool, skip this section.\r\n</p>\r\n\r\n<ul class=\"org-ul\">\r\n<li>For creating a pool from command line using <code>virsh</code>, <a href=\"https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Administration_Guide/ch13s03s03.html\">follow these instructions</a>.\r\n</li>\r\n<li>For creating a pool using <code>virt-manager</code>, <a href=\"https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Virtualization_Administration_Guide/sect-Virtualization-Storage_Pools-Creating-Local_Directories.html#idp13442168\">follow these instructions</a>.\r\n</li>\r\n</ul>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3-2\" class=\"outline-3\">\r\n<h5 id=\"sec-3-2\">Creating a volume</h5>\r\n<div class=\"outline-text-3\" id=\"text-3-2\">\r\n<ul class=\"org-ul\">\r\n<li>For creating a volume from the command line using <code>virsh</code>, use the following commands\r\n</li>\r\n</ul>\r\n\r\n<div class=\"org-src-container\">\r\n\r\n<pre class=\"src src-sh\">virsh vol-create-as --pool my-storage-pool --name disk-01.qcow2 --capacity 80G --format qcow2\r\n</pre>\r\n</div>\r\n\r\n<ul class=\"org-ul\">\r\n<li>For creating a volume using <code>virt-manager</code>, double click on your connection,\r\n</li>\r\n</ul>\r\n<p>\r\nnavigate to storage, choose your pool, press <code>+</code> and follow the instructions.\r\n</p>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3-3\" class=\"outline-3\">\r\n<h5 id=\"sec-3-3\">Networking</h5>\r\n<div class=\"outline-text-3\" id=\"text-3-3\">\r\n<p>\r\n<code>libvirt</code> defaults to creating a NAT interface for networking. If you want to use networking through a NAT interface, you can skip this section.\r\n</p>\r\n\r\n<p>\r\nThe rest of the section deals with creating a bridge interface which can later be used by the VMs.\r\n</p>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Edit <code>/etc/network/interfaces</code>\r\n</li>\r\n<li>Add the following lines towards the end. Use the appropriate network interface instead of <code>eth1</code>\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nauto br0\r\niface br0 inet dhcp\r\n    bridge_ports eth1\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Restart the network\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nsystemctl restart networking network-manager\r\n</pre>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3-4\" class=\"outline-3\">\r\n<h5 id=\"sec-3-4\">Installing an OS</h5>\r\n<div class=\"outline-text-3\" id=\"text-3-4\">\r\n<p>\r\n<b>Installing an OS from command line</b>\r\n</p>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Run a command similar to the following\r\n</li>\r\n</ul>\r\n\r\n<pre class=\"example\">\r\nvirt-install --name test-vm-01 --memory 8192\\\r\n--vcpus 4 --disk /my/storage/location/disk-01.qcow2\\\r\n--graphics vnc,password=foobar,listen=0.0.0.0\\\r\n--cdrom /path/to/os-install.iso\\\r\n--network bridge=br0\\\r\n--host-device=pci_abcd_vw_xy_z\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Note the pci id passed to <code>host-device</code> is in a slightly different format than the output from <code>lspci</code>\r\n</li>\r\n<li>The <code>vw_xy_z</code> format is extracted from the output of <code>lspci</code> which returns the ids in <code>vw:xy.z</code> format.\r\n</li>\r\n<li>You can now run the following command to get the appropriate pci id for <code>virsh</code>\r\n</li>\r\n</ul>\r\n<pre class=\"example\">\r\nvirsh nodedev-list | grep vw_xy_z\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Note, <code>listen=0.0.0.0</code> makes the vm visible to everyone. Mask it to the required subnets appropriately.\r\n</li>\r\n<li>change the password to be something more appropriate.\r\n</li>\r\n\r\n<li>Once the command is run, you can queiry the <code>vncdisplay</code> using the following command:\r\n</li>\r\n</ul>\r\n<pre class=\"example\">\r\nvirsh vncdisplay test-vm-01\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>You can then use this information to connect to the server using a vnc client of choice\r\n</li>\r\n</ul>\r\n\r\n<p>\r\n<b>Installing an OS using <code>virt-manager</code></b>\r\n</p>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Click on create new virtual machine (top left icon)\r\n</li>\r\n<li><code>Local install media</code>. Browse and choose install media\r\n</li>\r\n<li>Optional: Set OS type and version appropriately\r\n</li>\r\n<li>Choose the desired amount of RAM and CPU cores\r\n</li>\r\n<li>Expand <code>Network selection</code> and make sure the Bridge <code>br0</code> is selected\r\n</li>\r\n<li><code>Select or create custom storage</code>. Browse to the storage disk created earlier\r\n</li>\r\n<li>Check the box that says <b>Customize configuration before install</b>\r\n</li>\r\n<li>Click on <code>Add Hardware</code>\r\n</li>\r\n<li>Choose <code>PCI Host Device</code> and select the device you want to pass through\r\n</li>\r\n<li>Click <code>Begin Installation</code> on top left corner.\r\n</li>\r\n</ul>\r\n\r\n<p>\r\n<i>If the GPU being passed through has audio support, you need to add it to the VM as well.</i>\r\n</p>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3-5\" class=\"outline-3\">\r\n<h5 id=\"sec-3-5\">Accessing the VMs</h5>\r\n<div class=\"outline-text-3\" id=\"text-3-5\">\r\n<ul class=\"org-ul\">\r\n<li>If you setup the VM to use bridge networking, it can be accessed directly via the ip within the LAN.\r\n</li>\r\n<li>If you setup the VM to use VNC, you can access the VM using any VNC client software.\r\n</li>\r\n<li>If you are on Linux, you can install <code>virt-manager</code> and connect to the remote server and all of it\'s VMs.\r\n</li>\r\n</ul>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-3-6\" class=\"outline-3\">\r\n<h5 id=\"sec-3-6\">Cloning the VMs</h5>\r\n<div class=\"outline-text-3\" id=\"text-3-6\">\r\n<ul class=\"org-ul\">\r\n<li>From command line run the following command\r\n</li>\r\n</ul>\r\n<pre class=\"example\">\r\nvirt-clone --original original-vm-name --name new-vm-name --file /path/to/new/disk.qcow2\r\n</pre>\r\n\r\n<ul class=\"org-ul\">\r\n<li>Alternatively, from <code>virt-manager</code> simply right click on the vm and choose clone.\r\n</li>\r\n</ul>\r\n</div>\r\n</div>\r\n</div>\r\n\r\n<div id=\"outline-container-sec-4\" class=\"outline-2\">\r\n<h4 id=\"sec-4\">Conclusion</h4>\r\n<div class=\"outline-text-2\" id=\"text-4\">\r\n<p>\r\nAlthough time consuming, this build has been very fruitful for us. It allows us to seamlessly snapshot, clone, restore, and switch between various configurations. We plan on doing interesting things with this setup including integrating it with our <a href=\"http://ci.arrayfire.org/\">continuous integration</a> system.\r\n</p>\r\n\r\n<p>\r\nWe also have other interesting ideas brewing internally to leverage this infrastructure. Follow this blog for updates in this regard!\r\n</p>\r\n</div>\r\n</div>\r\n</div>','Using GPUs in KVM Virtual Machines','','inherit','closed','closed','','8927-revision-v1','','','2016-06-23 14:56:12','2016-06-23 18:56:12','',8927,'http://sandbox.arrayfire.com/8927-revision-v1/',0,'revision','',0),(8971,18673,'2016-07-04 13:19:21','2016-07-04 17:19:21','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n 	<li>position</li>\r\n 	<li>velocity</li>\r\n 	<li>acceleration</li>\r\n 	<li>lifespan</li>\r\n 	<li>color</li>\r\n 	<li>size</li>\r\n 	<li>rotation</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n 	<li>position of the particle system center of mass</li>\r\n 	<li>total # of particles</li>\r\n 	<li>type of particle system</li>\r\n 	<li>image to draw</li>\r\n 	<li># of active particles</li>\r\n 	<li>particle system bounding box</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n 	<li>adding particle systems</li>\r\n 	<li>(automatically) removing particle systems</li>\r\n 	<li>updating particle systems</li>\r\n 	<li>rendering particle systems</li>\r\n</ul>\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">class particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\nSo far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array. This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true\">//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the <span class=\"lang:default decode:true crayon-inline \">is_active</span>  array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true\">particle_system(int num_particles_) {\r\n    num_particles = num_particles_;\r\n    system_pos[0] = 0; system_pos[1] = 0; system_pos[2] = 0;\r\n\r\n    for(int dim=0; dim&lt;dims; ++dim) {\r\n        pos.push_back(af::constant(0, num_particles));\r\n        vel.push_back(af::constant(0, num_particles));\r\n        accel.push_back(af::constant(0, num_particles));\r\n    }\r\n    lifetime = af::constant(0, num_particles);\r\n    is_active = af::constant(0, num_particles);\r\n}\r\n //offsets the whole particle system\r\nvoid move_system(float x, float y) {\r\n    system_pos[0] += x;\r\n    system_pos[1] += y;\r\n    pos[0] += x;\r\n    pos[1] += y;\r\n}\r\n// updates positions, velocities, and lifetime of particles in system\r\nvirtual bool update() {\r\n    if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n        for(int i=0; i&lt;pos.size(); ++i) {\r\n            pos[i](is_active&gt;0) += vel[i](is_active&gt;0);\r\n            vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n            lifetime += 1;\r\n        }\r\n        return true;\r\n    }\r\n    return false;\r\n}\r\n</pre>\r\nFirst, we initialize <span class=\"lang:default decode:true crayon-inline \">af::arrays</span> which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the <span class=\"lang:default decode:true crayon-inline \">is_active</span>  array where the <span class=\"lang:default decode:true crayon-inline \">is_active</span> array is used to index into the positions of the active particles and update only those particles.\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Constructing a specific particle system\r\n[/feature_headline]\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true\">class explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) \r\n    : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        static const af::array particle = af::constant(1, particle_size, particle_size);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            ids = ids(is_active&gt;0);\r\n            af::array temp = af::constant(0, image.dims());\r\n            temp(ids) = 5/lifetime(is_active&gt;0);\r\n            image += af::convolve(temp, particle);\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the <span class=\"lang:default decode:true crayon-inline \">af::constant</span> and <span class=\"lang:default decode:true crayon-inline \">af::randn</span> functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager.\r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed.\r\nThe render function is fairly similar to the update function with regards to the use of the <span class=\"lang:default decode:true crayon-inline \">is_active</span> array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">#include \"arrayfire.h\"\r\n#include \"particle_system.h\"\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new \r\n                                  explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system.\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\"><img class=\"aligncenter size-full wp-image-8993\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\" alt=\"optimized\" width=\"640\" height=\"678\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','publish','open','closed','','a-simple-particle-system-with-arrayfire','','','2016-07-05 15:13:41','2016-07-05 19:13:41','',0,'http://sandbox.arrayfire.com/?p=8971',0,'post','',0),(8972,18673,'2016-07-04 13:14:54','2016-07-04 17:14:54','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n## Particle System Hierarchy\r\n\r\nIndividual particles in a system have a variety of','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 13:14:54','2016-07-04 17:14:54','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8973,18673,'2016-07-04 13:19:06','2016-07-04 17:19:06','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h2\" looks_like=\"h1\" icon=\"adjust\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system have a variety of','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 13:19:06','2016-07-04 17:19:06','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8974,18673,'2016-07-04 13:19:21','2016-07-04 17:19:21','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h2\" looks_like=\"h1\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system have a variety of','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 13:19:21','2016-07-04 17:19:21','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8975,18673,'2016-07-04 13:20:32','2016-07-04 17:20:32','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system have a variety of','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 13:20:32','2016-07-04 17:20:32','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8976,18673,'2016-07-04 13:20:47','2016-07-04 17:20:47','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system have a variety of','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 13:20:47','2016-07-04 17:20:47','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8977,18673,'2016-07-04 13:45:57','2016-07-04 17:45:57','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n	<li>position</li>\r\n	<li>velocity</li>\r\n	<li>acceleration</li>\r\n	<li>lifespan</li>\r\n	<li>color</li>\r\n	<li>size</li>\r\n	<li>rotation</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n	<li>position of the particle system center of mass</li>\r\n	<li>total # of particles</li>\r\n	<li>type of particle system</li>\r\n	<li>image to draw</li>\r\n	<li># of active particles</li>\r\n	<li>particle system bounding box</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<code>\r\n/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps){bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};\r\n</code>\r\n','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 13:45:57','2016-07-04 17:45:57','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8978,18673,'2016-07-04 13:47:32','2016-07-04 17:47:32','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n	<li>position</li>\r\n	<li>velocity</li>\r\n	<li>acceleration</li>\r\n	<li>lifespan</li>\r\n	<li>color</li>\r\n	<li>size</li>\r\n	<li>rotation</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n	<li>position of the particle system center of mass</li>\r\n	<li>total # of particles</li>\r\n	<li>type of particle system</li>\r\n	<li>image to draw</li>\r\n	<li># of active particles</li>\r\n	<li>particle system bounding box</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n[code]/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps){bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};[/code]\r\n','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 13:47:32','2016-07-04 17:47:32','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8979,18673,'2016-07-04 13:49:00','2016-07-04 17:49:00','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n	<li>position</li>\r\n	<li>velocity</li>\r\n	<li>acceleration</li>\r\n	<li>lifespan</li>\r\n	<li>color</li>\r\n	<li>size</li>\r\n	<li>rotation</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n	<li>position of the particle system center of mass</li>\r\n	<li>total # of particles</li>\r\n	<li>type of particle system</li>\r\n	<li>image to draw</li>\r\n	<li># of active particles</li>\r\n	<li>particle system bounding box</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps){bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 13:49:00','2016-07-04 17:49:00','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8980,18673,'2016-07-04 14:09:55','2016-07-04 18:09:55','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n	<li>position</li>\r\n	<li>velocity</li>\r\n	<li>acceleration</li>\r\n	<li>lifespan</li>\r\n	<li>color</li>\r\n	<li>size</li>\r\n	<li>rotation</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n	<li>position of the particle system center of mass</li>\r\n	<li>total # of particles</li>\r\n	<li>type of particle system</li>\r\n	<li>image to draw</li>\r\n	<li># of active particles</li>\r\n	<li>particle system bounding box</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n	<li>adding particle systems</li>\r\n	<li>(automatically) removing particle systems</li>\r\n	<li>updating particle systems</li>\r\n	<li>rendering particle systems</li>\r\n</ul>\r\n\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">\r\nclass particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\n So far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array! This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true \">\r\n//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 14:09:55','2016-07-04 18:09:55','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8981,18673,'2016-07-04 14:56:00','2016-07-04 18:56:00','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n	<li>position</li>\r\n	<li>velocity</li>\r\n	<li>acceleration</li>\r\n	<li>lifespan</li>\r\n	<li>color</li>\r\n	<li>size</li>\r\n	<li>rotation</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n	<li>position of the particle system center of mass</li>\r\n	<li>total # of particles</li>\r\n	<li>type of particle system</li>\r\n	<li>image to draw</li>\r\n	<li># of active particles</li>\r\n	<li>particle system bounding box</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n	<li>adding particle systems</li>\r\n	<li>(automatically) removing particle systems</li>\r\n	<li>updating particle systems</li>\r\n	<li>rendering particle systems</li>\r\n</ul>\r\n\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">\r\nclass particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\n So far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array! This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true \">\r\n//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the is_active array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true \">\r\nparticle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n        //initialize our particle arrays\r\n        for(int dim=0; dim 0).elements() &gt; 0 ) {\r\n            for(int i=0; i0) += vel[i](is_active&gt;0);\r\n                vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n                lifetime += 1;\r\n            }\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n</pre>\r\nFirst, we initialize af::arrays which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the is_active array where the is_active array is used to index into the positions of the active particles and update only those particles.\r\n\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true \">\r\nclass explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            if(ids.elements() &gt; 0) {\r\n                ids = ids(is_active&gt;0);\r\n                for(int j=0; j&lt;particle_size; ++j)\r\n                    for(int i=0; i0);\r\n            }\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the af::constant and af::randn functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager. \r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed. \r\nThe render function is fairly similar to the update function with regards to the use of the is_active array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">\r\n#include \r\n#include \r\n#include \r\n#include \"particle_systems.h\"\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion-&gt;move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n            //clears the image\r\n\r\n            //simulate\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\n','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 14:56:00','2016-07-04 18:56:00','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8982,18673,'2016-07-04 15:10:34','2016-07-04 19:10:34','','firework','','inherit','open','closed','','firework','','','2016-07-04 15:10:34','2016-07-04 19:10:34','',8971,'http://sandbox.arrayfire.com/wp-content/uploads/2016/07/firework.png',0,'attachment','image/png',0),(8983,18673,'2016-07-04 15:11:21','2016-07-04 19:11:21','','firework','','inherit','open','closed','','firework-2','','','2016-07-04 15:11:21','2016-07-04 19:11:21','',8971,'http://sandbox.arrayfire.com/wp-content/uploads/2016/07/firework-1.png',0,'attachment','image/png',0),(8984,18673,'2016-07-04 15:11:37','2016-07-04 19:11:37','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n	<li>position</li>\r\n	<li>velocity</li>\r\n	<li>acceleration</li>\r\n	<li>lifespan</li>\r\n	<li>color</li>\r\n	<li>size</li>\r\n	<li>rotation</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n	<li>position of the particle system center of mass</li>\r\n	<li>total # of particles</li>\r\n	<li>type of particle system</li>\r\n	<li>image to draw</li>\r\n	<li># of active particles</li>\r\n	<li>particle system bounding box</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n	<li>adding particle systems</li>\r\n	<li>(automatically) removing particle systems</li>\r\n	<li>updating particle systems</li>\r\n	<li>rendering particle systems</li>\r\n</ul>\r\n\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">\r\nclass particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\n So far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array! This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true \">\r\n//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the is_active array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true \">\r\nparticle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n        //initialize our particle arrays\r\n        for(int dim=0; dim 0).elements() &gt; 0 ) {\r\n            for(int i=0; i0) += vel[i](is_active&gt;0);\r\n                vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n                lifetime += 1;\r\n            }\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n</pre>\r\nFirst, we initialize af::arrays which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the is_active array where the is_active array is used to index into the positions of the active particles and update only those particles.\r\n\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true \">\r\nclass explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            if(ids.elements() &gt; 0) {\r\n                ids = ids(is_active&gt;0);\r\n                for(int j=0; j&lt;particle_size; ++j)\r\n                    for(int i=0; i0);\r\n            }\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the af::constant and af::randn functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager. \r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed. \r\nThe render function is fairly similar to the update function with regards to the use of the is_active array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">\r\n#include \r\n#include \r\n#include \r\n#include \"particle_s\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system. \r\n\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>\r\n','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 15:11:37','2016-07-04 19:11:37','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8985,18673,'2016-07-04 15:11:57','2016-07-04 19:11:57','','firework','','inherit','open','closed','','firework-3','','','2016-07-04 15:11:57','2016-07-04 19:11:57','',8971,'http://sandbox.arrayfire.com/wp-content/uploads/2016/07/firework-2.png',0,'attachment','image/png',0),(8986,18673,'2016-07-04 15:12:18','2016-07-04 19:12:18','','firework','','inherit','open','closed','','firework-4','','','2016-07-04 15:12:18','2016-07-04 19:12:18','',8971,'http://sandbox.arrayfire.com/wp-content/uploads/2016/07/firework-3.png',0,'attachment','image/png',0),(8987,18673,'2016-07-04 15:18:24','2016-07-04 19:18:24','','firework','','inherit','open','closed','','firework-5','','','2016-07-04 15:18:24','2016-07-04 19:18:24','',8971,'http://sandbox.arrayfire.com/wp-content/uploads/2016/07/firework.jpg',0,'attachment','image/jpeg',0),(8988,18673,'2016-07-04 15:19:01','2016-07-04 19:19:01','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n	<li>position</li>\r\n	<li>velocity</li>\r\n	<li>acceleration</li>\r\n	<li>lifespan</li>\r\n	<li>color</li>\r\n	<li>size</li>\r\n	<li>rotation</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n	<li>position of the particle system center of mass</li>\r\n	<li>total # of particles</li>\r\n	<li>type of particle system</li>\r\n	<li>image to draw</li>\r\n	<li># of active particles</li>\r\n	<li>particle system bounding box</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n	<li>adding particle systems</li>\r\n	<li>(automatically) removing particle systems</li>\r\n	<li>updating particle systems</li>\r\n	<li>rendering particle systems</li>\r\n</ul>\r\n\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">\r\nclass particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\n So far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array! This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true \">\r\n//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the is_active array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true \">\r\nparticle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n        //initialize our particle arrays\r\n        for(int dim=0; dim 0).elements() &gt; 0 ) {\r\n            for(int i=0; i0) += vel[i](is_active&gt;0);\r\n                vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n                lifetime += 1;\r\n            }\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n</pre>\r\nFirst, we initialize af::arrays which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the is_active array where the is_active array is used to index into the positions of the active particles and update only those particles.\r\n\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true \">\r\nclass explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            if(ids.elements() &gt; 0) {\r\n                ids = ids(is_active&gt;0);\r\n                for(int j=0; j&lt;particle_size; ++j)\r\n                    for(int i=0; i0);\r\n            }\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the af::constant and af::randn functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager. \r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed. \r\nThe render function is fairly similar to the update function with regards to the use of the is_active array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">\r\n#include \r\n#include \r\n#include \r\n#include \"particle_s\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system. \r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/firework.png\"><img src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/firework.png\" alt=\"firework\" width=\"488\" height=\"609\" class=\"aligncenter size-full wp-image-8982\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 15:19:01','2016-07-04 19:19:01','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8989,18673,'2016-07-04 15:25:17','2016-07-04 19:25:17','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n	<li>position</li>\r\n	<li>velocity</li>\r\n	<li>acceleration</li>\r\n	<li>lifespan</li>\r\n	<li>color</li>\r\n	<li>size</li>\r\n	<li>rotation</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n	<li>position of the particle system center of mass</li>\r\n	<li>total # of particles</li>\r\n	<li>type of particle system</li>\r\n	<li>image to draw</li>\r\n	<li># of active particles</li>\r\n	<li>particle system bounding box</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n	<li>adding particle systems</li>\r\n	<li>(automatically) removing particle systems</li>\r\n	<li>updating particle systems</li>\r\n	<li>rendering particle systems</li>\r\n</ul>\r\n\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">\r\nclass particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\n So far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array. This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true \">\r\n//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the is_active array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true \">\r\nparticle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n        //initialize our particle arrays\r\n        for(int dim=0; dim 0).elements() &gt; 0 ) {\r\n            for(int i=0; i0) += vel[i](is_active&gt;0);\r\n                vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n                lifetime += 1;\r\n            }\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n</pre>\r\nFirst, we initialize af::arrays which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the is_active array where the is_active array is used to index into the positions of the active particles and update only those particles.\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Constructing a specific particle system\r\n[/feature_headline]\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true \">\r\nclass explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            if(ids.elements() &gt; 0) {\r\n                ids = ids(is_active&gt;0);\r\n                for(int j=0; j&lt;particle_size; ++j)\r\n                    for(int i=0; i0);\r\n            }\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the af::constant and af::randn functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager. \r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed. \r\nThe render function is fairly similar to the update function with regards to the use of the is_active array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">\r\n#include \r\n#include \r\n#include \r\n#include \"particle_s\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system. \r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/firework.png\"><img src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/firework.png\" alt=\"firework\" width=\"488\" height=\"609\" class=\"aligncenter size-full wp-image-8982\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 15:25:17','2016-07-04 19:25:17','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8990,18673,'2016-07-04 15:26:38','2016-07-04 19:26:38','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n	<li>position</li>\r\n	<li>velocity</li>\r\n	<li>acceleration</li>\r\n	<li>lifespan</li>\r\n	<li>color</li>\r\n	<li>size</li>\r\n	<li>rotation</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n	<li>position of the particle system center of mass</li>\r\n	<li>total # of particles</li>\r\n	<li>type of particle system</li>\r\n	<li>image to draw</li>\r\n	<li># of active particles</li>\r\n	<li>particle system bounding box</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n	<li>adding particle systems</li>\r\n	<li>(automatically) removing particle systems</li>\r\n	<li>updating particle systems</li>\r\n	<li>rendering particle systems</li>\r\n</ul>\r\n\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">\r\nclass particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\n So far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array. This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true \">\r\n//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the is_active array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true \">\r\nparticle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n        //initialize our particle arrays\r\n        for(int dim=0; dim 0).elements() &gt; 0 ) {\r\n            for(int i=0; i0) += vel[i](is_active&gt;0);\r\n                vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n                lifetime += 1;\r\n            }\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n</pre>\r\nFirst, we initialize af::arrays which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the is_active array where the is_active array is used to index into the positions of the active particles and update only those particles.\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Constructing a specific particle system\r\n[/feature_headline]\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true \">\r\nclass explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            if(ids.elements() &gt; 0) {\r\n                ids = ids(is_active&gt;0);\r\n                for(int j=0; j&lt;particle_size; ++j)\r\n                    for(int i=0; i0);\r\n            }\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the af::constant and af::randn functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager. \r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed. \r\nThe render function is fairly similar to the update function with regards to the use of the is_active array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">\r\n#include \"arrayfire.h\"\r\n#include \"particle_system.h\"\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system. \r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/firework.png\"><img src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/firework.png\" alt=\"firework\" width=\"488\" height=\"609\" class=\"aligncenter size-full wp-image-8982\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 15:26:38','2016-07-04 19:26:38','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8991,18673,'2016-07-04 15:27:49','2016-07-04 19:27:49','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n	<li>position</li>\r\n	<li>velocity</li>\r\n	<li>acceleration</li>\r\n	<li>lifespan</li>\r\n	<li>color</li>\r\n	<li>size</li>\r\n	<li>rotation</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n	<li>position of the particle system center of mass</li>\r\n	<li>total # of particles</li>\r\n	<li>type of particle system</li>\r\n	<li>image to draw</li>\r\n	<li># of active particles</li>\r\n	<li>particle system bounding box</li>\r\n	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n	<li>adding particle systems</li>\r\n	<li>(automatically) removing particle systems</li>\r\n	<li>updating particle systems</li>\r\n	<li>rendering particle systems</li>\r\n</ul>\r\n\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">\r\nclass particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\n So far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array. This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true \">\r\n//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the is_active array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true \">\r\nparticle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n        //initialize our particle arrays\r\n        for(int dim=0; dim 0).elements() &gt; 0 ) {\r\n            for(int i=0; i0) += vel[i](is_active&gt;0);\r\n                vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n                lifetime += 1;\r\n            }\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n</pre>\r\nFirst, we initialize af::arrays which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the is_active array where the is_active array is used to index into the positions of the active particles and update only those particles.\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Constructing a specific particle system\r\n[/feature_headline]\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true \">\r\nclass explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) \r\n    : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            if(ids.elements() &gt; 0) {\r\n                ids = ids(is_active&gt;0);\r\n                for(int j=0; j&lt;particle_size; ++j)\r\n                    for(int i=0; i0);\r\n            }\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the af::constant and af::randn functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager. \r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed. \r\nThe render function is fairly similar to the update function with regards to the use of the is_active array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">\r\n#include \"arrayfire.h\"\r\n#include \"particle_system.h\"\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new \r\n                                  explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system. \r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/firework.png\"><img src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/firework.png\" alt=\"firework\" width=\"488\" height=\"609\" class=\"aligncenter size-full wp-image-8982\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-04 15:27:49','2016-07-04 19:27:49','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8993,18673,'2016-07-05 13:58:14','2016-07-05 17:58:14','','optimized','','inherit','open','closed','','optimized','','','2016-07-05 13:58:14','2016-07-05 17:58:14','',8971,'http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif',0,'attachment','image/gif',0),(8994,18673,'2016-07-05 14:07:36','2016-07-05 18:07:36','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n 	<li>position</li>\r\n 	<li>velocity</li>\r\n 	<li>acceleration</li>\r\n 	<li>lifespan</li>\r\n 	<li>color</li>\r\n 	<li>size</li>\r\n 	<li>rotation</li>\r\n 	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n 	<li>position of the particle system center of mass</li>\r\n 	<li>total # of particles</li>\r\n 	<li>type of particle system</li>\r\n 	<li>image to draw</li>\r\n 	<li># of active particles</li>\r\n 	<li>particle system bounding box</li>\r\n 	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n 	<li>adding particle systems</li>\r\n 	<li>(automatically) removing particle systems</li>\r\n 	<li>updating particle systems</li>\r\n 	<li>rendering particle systems</li>\r\n</ul>\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">class particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\nSo far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array. This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true \">//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the <span class=\"lang:default decode:true  crayon-inline \">is_active</span>  array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true \">particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n        //initialize our particle arrays\r\n        for(int dim=0; dim 0).elements() &gt; 0 ) {\r\n            for(int i=0; i0) += vel[i](is_active&gt;0);\r\n                vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n                lifetime += 1;\r\n            }\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n</pre>\r\nFirst, we initialize <span class=\"lang:default decode:true  crayon-inline \">af::arrays</span> which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the <span class=\"lang:default decode:true  crayon-inline \">is_active</span>  array where the <span class=\"lang:default decode:true  crayon-inline \">is_active</span> array is used to index into the positions of the active particles and update only those particles.\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Constructing a specific particle system\r\n[/feature_headline]\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true \">class explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) \r\n    : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            if(ids.elements() &gt; 0) {\r\n                ids = ids(is_active&gt;0);\r\n                for(int j=0; j&lt;particle_size; ++j)\r\n                    for(int i=0; i0);\r\n            }\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the af::constant and af::randn functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager.\r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed.\r\nThe render function is fairly similar to the update function with regards to the use of the <span class=\"lang:default decode:true  crayon-inline \">is_active</span> array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">#include \"arrayfire.h\"\r\n#include \"particle_system.h\"\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new \r\n                                  explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system.\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\"><img class=\"aligncenter size-full wp-image-8993\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\" alt=\"optimized\" width=\"640\" height=\"678\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-05 14:07:36','2016-07-05 18:07:36','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8995,18673,'2016-07-05 14:12:02','2016-07-05 18:12:02','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n 	<li>position</li>\r\n 	<li>velocity</li>\r\n 	<li>acceleration</li>\r\n 	<li>lifespan</li>\r\n 	<li>color</li>\r\n 	<li>size</li>\r\n 	<li>rotation</li>\r\n 	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n 	<li>position of the particle system center of mass</li>\r\n 	<li>total # of particles</li>\r\n 	<li>type of particle system</li>\r\n 	<li>image to draw</li>\r\n 	<li># of active particles</li>\r\n 	<li>particle system bounding box</li>\r\n 	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n 	<li>adding particle systems</li>\r\n 	<li>(automatically) removing particle systems</li>\r\n 	<li>updating particle systems</li>\r\n 	<li>rendering particle systems</li>\r\n</ul>\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">class particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\nSo far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array. This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true \">//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the <span class=\"lang:default decode:true  crayon-inline \">is_active</span>  array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true \">particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n        //initialize our particle arrays\r\n        for(int dim=0; dim 0).elements() &gt; 0 ) {\r\n            for(int i=0; i0) += vel[i](is_active&gt;0);\r\n                vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n                lifetime += 1;\r\n            }\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n</pre>\r\nFirst, we initialize <span class=\"lang:default decode:true  crayon-inline \">af::arrays</span> which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the <span class=\"lang:default decode:true  crayon-inline \">is_active</span>  array where the <span class=\"lang:default decode:true  crayon-inline \">is_active</span> array is used to index into the positions of the active particles and update only those particles.\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Constructing a specific particle system\r\n[/feature_headline]\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true \">class explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) \r\n    : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            if(ids.elements() &gt; 0) {\r\n                ids = ids(is_active&gt;0);\r\n                for(int j=0; j&lt;particle_size; ++j)\r\n                    for(int i=0; i&lt;particle_size; ++i)\r\n                        image(ids + i + j * image_height) += 5/lifetime(is_active&gt;0);\r\n            }\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the af::constant and af::randn functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager.\r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed.\r\nThe render function is fairly similar to the update function with regards to the use of the <span class=\"lang:default decode:true  crayon-inline \">is_active</span> array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">#include \"arrayfire.h\"\r\n#include \"particle_system.h\"\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new \r\n                                  explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system.\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\"><img class=\"aligncenter size-full wp-image-8993\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\" alt=\"optimized\" width=\"640\" height=\"678\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-05 14:12:02','2016-07-05 18:12:02','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8996,18673,'2016-07-05 14:18:27','2016-07-05 18:18:27','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n 	<li>position</li>\r\n 	<li>velocity</li>\r\n 	<li>acceleration</li>\r\n 	<li>lifespan</li>\r\n 	<li>color</li>\r\n 	<li>size</li>\r\n 	<li>rotation</li>\r\n 	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n 	<li>position of the particle system center of mass</li>\r\n 	<li>total # of particles</li>\r\n 	<li>type of particle system</li>\r\n 	<li>image to draw</li>\r\n 	<li># of active particles</li>\r\n 	<li>particle system bounding box</li>\r\n 	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n 	<li>adding particle systems</li>\r\n 	<li>(automatically) removing particle systems</li>\r\n 	<li>updating particle systems</li>\r\n 	<li>rendering particle systems</li>\r\n</ul>\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">class particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\nSo far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array. This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true \">//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the <span class=\"lang:default decode:true  crayon-inline \">is_active</span>  array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true \">particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n        //initialize our particle arrays\r\n        for(int dim=0; dim 0).elements() &gt; 0 ) {\r\n            for(int i=0; i0) += vel[i](is_active&gt;0);\r\n                vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n                lifetime += 1;\r\n            }\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n</pre>\r\nFirst, we initialize <span class=\"lang:default decode:true  crayon-inline \">af::arrays</span> which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the <span class=\"lang:default decode:true  crayon-inline \">is_active</span>  array where the <span class=\"lang:default decode:true  crayon-inline \">is_active</span> array is used to index into the positions of the active particles and update only those particles.\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Constructing a specific particle system\r\n[/feature_headline]\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true \">class explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) \r\n    : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            if(ids.elements() &gt; 0) {\r\n                ids = ids(is_active&gt;0);\r\n                for(int j=0; j&lt;particle_size; ++j)\r\n                    for(int i=0; i&lt;particle_size; ++i)\r\n                        image(ids + i + j * image_height) += 5/lifetime(is_active&gt;0);\r\n            }\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the <span class=\"lang:default decode:true  crayon-inline \">af::constant</span> and <span class=\"lang:default decode:true  crayon-inline \">af::randn</span> functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager.\r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed.\r\nThe render function is fairly similar to the update function with regards to the use of the <span class=\"lang:default decode:true  crayon-inline \">is_active</span> array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">#include \"arrayfire.h\"\r\n#include \"particle_system.h\"\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new \r\n                                  explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system.\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\"><img class=\"aligncenter size-full wp-image-8993\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\" alt=\"optimized\" width=\"640\" height=\"678\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-05 14:18:27','2016-07-05 18:18:27','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8997,18673,'2016-07-05 14:24:32','2016-07-05 18:24:32','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n 	<li>position</li>\r\n 	<li>velocity</li>\r\n 	<li>acceleration</li>\r\n 	<li>lifespan</li>\r\n 	<li>color</li>\r\n 	<li>size</li>\r\n 	<li>rotation</li>\r\n 	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n 	<li>position of the particle system center of mass</li>\r\n 	<li>total # of particles</li>\r\n 	<li>type of particle system</li>\r\n 	<li>image to draw</li>\r\n 	<li># of active particles</li>\r\n 	<li>particle system bounding box</li>\r\n 	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n 	<li>adding particle systems</li>\r\n 	<li>(automatically) removing particle systems</li>\r\n 	<li>updating particle systems</li>\r\n 	<li>rendering particle systems</li>\r\n</ul>\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">class particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\nSo far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array. This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true \">//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the <span class=\"lang:default decode:true  crayon-inline \">is_active</span>  array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true \">particle_system(int num_particles_) {\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n        for(int dim=0; dim 0).elements() &gt; 0 ) {\r\n            for(int i=0; i0) += vel[i](is_active&gt;0);\r\n                vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n                lifetime += 1;\r\n            }\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n</pre>\r\nFirst, we initialize <span class=\"lang:default decode:true  crayon-inline \">af::arrays</span> which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the <span class=\"lang:default decode:true  crayon-inline \">is_active</span>  array where the <span class=\"lang:default decode:true  crayon-inline \">is_active</span> array is used to index into the positions of the active particles and update only those particles.\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Constructing a specific particle system\r\n[/feature_headline]\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true \">class explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) \r\n    : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            if(ids.elements() &gt; 0) {\r\n                ids = ids(is_active&gt;0);\r\n                for(int j=0; j&lt;particle_size; ++j)\r\n                    for(int i=0; i&lt;particle_size; ++i)\r\n                        image(ids + i + j * image_height) += 5/lifetime(is_active&gt;0);\r\n            }\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the <span class=\"lang:default decode:true  crayon-inline \">af::constant</span> and <span class=\"lang:default decode:true  crayon-inline \">af::randn</span> functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager.\r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed.\r\nThe render function is fairly similar to the update function with regards to the use of the <span class=\"lang:default decode:true  crayon-inline \">is_active</span> array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">#include \"arrayfire.h\"\r\n#include \"particle_system.h\"\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new \r\n                                  explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system.\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\"><img class=\"aligncenter size-full wp-image-8993\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\" alt=\"optimized\" width=\"640\" height=\"678\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-05 14:24:32','2016-07-05 18:24:32','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8998,18673,'2016-07-05 14:26:03','2016-07-05 18:26:03','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n 	<li>position</li>\r\n 	<li>velocity</li>\r\n 	<li>acceleration</li>\r\n 	<li>lifespan</li>\r\n 	<li>color</li>\r\n 	<li>size</li>\r\n 	<li>rotation</li>\r\n 	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n 	<li>position of the particle system center of mass</li>\r\n 	<li>total # of particles</li>\r\n 	<li>type of particle system</li>\r\n 	<li>image to draw</li>\r\n 	<li># of active particles</li>\r\n 	<li>particle system bounding box</li>\r\n 	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n 	<li>adding particle systems</li>\r\n 	<li>(automatically) removing particle systems</li>\r\n 	<li>updating particle systems</li>\r\n 	<li>rendering particle systems</li>\r\n</ul>\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">class particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\nSo far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array. This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true \">//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the <span class=\"lang:default decode:true  crayon-inline \">is_active</span>  array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true \">particle_system(int num_particles_) {\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n        for(int dim=0; dim  0).elements() &gt; 0 ) {\r\n            for(int i=0; i  0) += vel[i](is_active &gt; 0);\r\n                vel[i](is_active &gt; 0) += accel[i](is_active &gt; 0);\r\n                lifetime += 1;\r\n            }\r\n            return true;\r\n        }\r\n        return false;\r\n    }\r\n</pre>\r\nFirst, we initialize <span class=\"lang:default decode:true  crayon-inline \">af::arrays</span> which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the <span class=\"lang:default decode:true  crayon-inline \">is_active</span>  array where the <span class=\"lang:default decode:true  crayon-inline \">is_active</span> array is used to index into the positions of the active particles and update only those particles.\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Constructing a specific particle system\r\n[/feature_headline]\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true \">class explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) \r\n    : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            if(ids.elements() &gt; 0) {\r\n                ids = ids(is_active&gt;0);\r\n                for(int j=0; j&lt;particle_size; ++j)\r\n                    for(int i=0; i&lt;particle_size; ++i)\r\n                        image(ids + i + j * image_height) += 5/lifetime(is_active&gt;0);\r\n            }\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the <span class=\"lang:default decode:true  crayon-inline \">af::constant</span> and <span class=\"lang:default decode:true  crayon-inline \">af::randn</span> functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager.\r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed.\r\nThe render function is fairly similar to the update function with regards to the use of the <span class=\"lang:default decode:true  crayon-inline \">is_active</span> array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">#include \"arrayfire.h\"\r\n#include \"particle_system.h\"\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new \r\n                                  explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system.\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\"><img class=\"aligncenter size-full wp-image-8993\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\" alt=\"optimized\" width=\"640\" height=\"678\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-05 14:26:03','2016-07-05 18:26:03','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(8999,18673,'2016-07-05 14:28:31','2016-07-05 18:28:31','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n 	<li>position</li>\r\n 	<li>velocity</li>\r\n 	<li>acceleration</li>\r\n 	<li>lifespan</li>\r\n 	<li>color</li>\r\n 	<li>size</li>\r\n 	<li>rotation</li>\r\n 	<li>etc...</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n 	<li>position of the particle system center of mass</li>\r\n 	<li>total # of particles</li>\r\n 	<li>type of particle system</li>\r\n 	<li>image to draw</li>\r\n 	<li># of active particles</li>\r\n 	<li>particle system bounding box</li>\r\n 	<li>etc...</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n 	<li>adding particle systems</li>\r\n 	<li>(automatically) removing particle systems</li>\r\n 	<li>updating particle systems</li>\r\n 	<li>rendering particle systems</li>\r\n</ul>\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">class particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\nSo far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array. This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true\">//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the <span class=\"lang:default decode:true crayon-inline \">is_active</span>  array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true\">particle_system(int num_particles_) {\r\n    num_particles = num_particles_;\r\n    system_pos[0] = 0; system_pos[1] = 0; system_pos[2] = 0;\r\n\r\n    for(int dim=0; dim&lt;dims; ++dim) {\r\n        pos.push_back(af::constant(0, num_particles));\r\n        vel.push_back(af::constant(0, num_particles));\r\n        accel.push_back(af::constant(0, num_particles));\r\n    }\r\n    lifetime = af::constant(0, num_particles);\r\n    is_active = af::constant(0, num_particles);\r\n}\r\n //offsets the whole particle system\r\nvoid move_system(float x, float y) {\r\n    system_pos[0] += x;\r\n    system_pos[1] += y;\r\n    pos[0] += x;\r\n    pos[1] += y;\r\n}\r\n// updates positions, velocities, and lifetime of particles in system\r\nvirtual bool update() {\r\n    if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n        for(int i=0; i&lt;pos.size(); ++i) {\r\n            pos[i](is_active&gt;0) += vel[i](is_active&gt;0);\r\n            vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n            lifetime += 1;\r\n        }\r\n        return true;\r\n    }\r\n    return false;\r\n}\r\n</pre>\r\nFirst, we initialize <span class=\"lang:default decode:true crayon-inline \">af::arrays</span> which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the <span class=\"lang:default decode:true crayon-inline \">is_active</span>  array where the <span class=\"lang:default decode:true crayon-inline \">is_active</span> array is used to index into the positions of the active particles and update only those particles.\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Constructing a specific particle system\r\n[/feature_headline]\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true \">class explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) \r\n    : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            if(ids.elements() &gt; 0) {\r\n                ids = ids(is_active&gt;0);\r\n                for(int j=0; j&lt;particle_size; ++j)\r\n                    for(int i=0; i&lt;particle_size; ++i)\r\n                        image(ids + i + j * image_height) += 5/lifetime(is_active&gt;0);\r\n            }\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the <span class=\"lang:default decode:true crayon-inline \">af::constant</span> and <span class=\"lang:default decode:true crayon-inline \">af::randn</span> functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager.\r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed.\r\nThe render function is fairly similar to the update function with regards to the use of the <span class=\"lang:default decode:true crayon-inline \">is_active</span> array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">#include \"arrayfire.h\"\r\n#include \"particle_system.h\"\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new \r\n                                  explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system.\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\"><img class=\"aligncenter size-full wp-image-8993\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\" alt=\"optimized\" width=\"640\" height=\"678\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-05 14:28:31','2016-07-05 18:28:31','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(9000,18673,'2016-07-05 14:34:21','2016-07-05 18:34:21','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n 	<li>position</li>\r\n 	<li>velocity</li>\r\n 	<li>acceleration</li>\r\n 	<li>lifespan</li>\r\n 	<li>color</li>\r\n 	<li>size</li>\r\n 	<li>rotation</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n 	<li>position of the particle system center of mass</li>\r\n 	<li>total # of particles</li>\r\n 	<li>type of particle system</li>\r\n 	<li>image to draw</li>\r\n 	<li># of active particles</li>\r\n 	<li>particle system bounding box</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n 	<li>adding particle systems</li>\r\n 	<li>(automatically) removing particle systems</li>\r\n 	<li>updating particle systems</li>\r\n 	<li>rendering particle systems</li>\r\n</ul>\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">class particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\nSo far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array. This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true\">//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the <span class=\"lang:default decode:true crayon-inline \">is_active</span>  array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true\">particle_system(int num_particles_) {\r\n    num_particles = num_particles_;\r\n    system_pos[0] = 0; system_pos[1] = 0; system_pos[2] = 0;\r\n\r\n    for(int dim=0; dim&lt;dims; ++dim) {\r\n        pos.push_back(af::constant(0, num_particles));\r\n        vel.push_back(af::constant(0, num_particles));\r\n        accel.push_back(af::constant(0, num_particles));\r\n    }\r\n    lifetime = af::constant(0, num_particles);\r\n    is_active = af::constant(0, num_particles);\r\n}\r\n //offsets the whole particle system\r\nvoid move_system(float x, float y) {\r\n    system_pos[0] += x;\r\n    system_pos[1] += y;\r\n    pos[0] += x;\r\n    pos[1] += y;\r\n}\r\n// updates positions, velocities, and lifetime of particles in system\r\nvirtual bool update() {\r\n    if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n        for(int i=0; i&lt;pos.size(); ++i) {\r\n            pos[i](is_active&gt;0) += vel[i](is_active&gt;0);\r\n            vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n            lifetime += 1;\r\n        }\r\n        return true;\r\n    }\r\n    return false;\r\n}\r\n</pre>\r\nFirst, we initialize <span class=\"lang:default decode:true crayon-inline \">af::arrays</span> which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the <span class=\"lang:default decode:true crayon-inline \">is_active</span>  array where the <span class=\"lang:default decode:true crayon-inline \">is_active</span> array is used to index into the positions of the active particles and update only those particles.\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Constructing a specific particle system\r\n[/feature_headline]\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true \">class explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) \r\n    : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            if(ids.elements() &gt; 0) {\r\n                ids = ids(is_active&gt;0);\r\n                for(int j=0; j&lt;particle_size; ++j)\r\n                    for(int i=0; i&lt;particle_size; ++i)\r\n                        image(ids + i + j * image_height) += 5/lifetime(is_active&gt;0);\r\n            }\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the <span class=\"lang:default decode:true crayon-inline \">af::constant</span> and <span class=\"lang:default decode:true crayon-inline \">af::randn</span> functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager.\r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed.\r\nThe render function is fairly similar to the update function with regards to the use of the <span class=\"lang:default decode:true crayon-inline \">is_active</span> array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">#include \"arrayfire.h\"\r\n#include \"particle_system.h\"\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new \r\n                                  explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system.\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\"><img class=\"aligncenter size-full wp-image-8993\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\" alt=\"optimized\" width=\"640\" height=\"678\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-05 14:34:21','2016-07-05 18:34:21','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(9001,18673,'2016-07-05 15:13:45','2016-07-05 19:13:45','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n 	<li>position</li>\r\n 	<li>velocity</li>\r\n 	<li>acceleration</li>\r\n 	<li>lifespan</li>\r\n 	<li>color</li>\r\n 	<li>size</li>\r\n 	<li>rotation</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n 	<li>position of the particle system center of mass</li>\r\n 	<li>total # of particles</li>\r\n 	<li>type of particle system</li>\r\n 	<li>image to draw</li>\r\n 	<li># of active particles</li>\r\n 	<li>particle system bounding box</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n 	<li>adding particle systems</li>\r\n 	<li>(automatically) removing particle systems</li>\r\n 	<li>updating particle systems</li>\r\n 	<li>rendering particle systems</li>\r\n</ul>\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">class particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\nSo far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array. This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true\">//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the <span class=\"lang:default decode:true crayon-inline \">is_active</span>  array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true\">particle_system(int num_particles_) {\r\n    num_particles = num_particles_;\r\n    system_pos[0] = 0; system_pos[1] = 0; system_pos[2] = 0;\r\n\r\n    for(int dim=0; dim&lt;dims; ++dim) {\r\n        pos.push_back(af::constant(0, num_particles));\r\n        vel.push_back(af::constant(0, num_particles));\r\n        accel.push_back(af::constant(0, num_particles));\r\n    }\r\n    lifetime = af::constant(0, num_particles);\r\n    is_active = af::constant(0, num_particles);\r\n}\r\n //offsets the whole particle system\r\nvoid move_system(float x, float y) {\r\n    system_pos[0] += x;\r\n    system_pos[1] += y;\r\n    pos[0] += x;\r\n    pos[1] += y;\r\n}\r\n// updates positions, velocities, and lifetime of particles in system\r\nvirtual bool update() {\r\n    if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n        for(int i=0; i&lt;pos.size(); ++i) {\r\n            pos[i](is_active&gt;0) += vel[i](is_active&gt;0);\r\n            vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n            lifetime += 1;\r\n        }\r\n        return true;\r\n    }\r\n    return false;\r\n}\r\n</pre>\r\nFirst, we initialize <span class=\"lang:default decode:true crayon-inline \">af::arrays</span> which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the <span class=\"lang:default decode:true crayon-inline \">is_active</span>  array where the <span class=\"lang:default decode:true crayon-inline \">is_active</span> array is used to index into the positions of the active particles and update only those particles.\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Constructing a specific particle system\r\n[/feature_headline]\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true\">class explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) \r\n    : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        static const af::array particle = af::constant(1, particle_size, particle_size);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            ids = ids(is_active&gt;0);\r\n            af::array temp = af::constant(0, image.dims());\r\n            temp(ids) = 5/lifetime(is_active&gt;0);\r\n            image += af::convolve(temp, particle);\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the <span class=\"lang:default decode:true crayon-inline \">af::constant</span> and <span class=\"lang:default decode:true crayon-inline \">af::randn</span> functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager.\r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed.\r\nThe render function is fairly similar to the update function with regards to the use of the <span class=\"lang:default decode:true crayon-inline \">is_active</span> array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">#include \"arrayfire.h\"\r\n#include \"particle_system.h\"\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new \r\n                                  explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system.\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\"><img class=\"aligncenter size-full wp-image-8993\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\" alt=\"optimized\" width=\"640\" height=\"678\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-autosave-v1','','','2016-07-05 15:13:45','2016-07-05 19:13:45','',8971,'http://sandbox.arrayfire.com/8971-autosave-v1/',0,'revision','',0),(9002,18673,'2016-07-05 15:13:41','2016-07-05 19:13:41','It\'s the 4th of July today and we\'re celebrating at ArrayFire! The 4th of July implies fireworks, and fireworks obviously imply particle systems. Particle systems are a collection of many small images or points that can be rendered to represent some complex behaving object. So before we can launch our fireworks, we will need to create a particle system. The large number of particles in a system lends well to GPU computation. Thankfully, ArrayFire\'s easy to use interface will allow us to do this simply and efficiently. First, let\'s examine the structure of a typical particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Particle System Structure and Hierarchy\r\n[/feature_headline]\r\nIndividual particles in a system typically have a variety of properties that govern their individual behavior. A non-comprehensive list below summarizes some of these:\r\n<ul>\r\n 	<li>position</li>\r\n 	<li>velocity</li>\r\n 	<li>acceleration</li>\r\n 	<li>lifespan</li>\r\n 	<li>color</li>\r\n 	<li>size</li>\r\n 	<li>rotation</li>\r\n</ul>\r\nThe properties are used to simulate the particles motion and appearance. Together, a collection of particles forms a particle system. The particle system holds additional information about the system as a whole. For example, these properties can include:\r\n<ul>\r\n 	<li>position of the particle system center of mass</li>\r\n 	<li>total # of particles</li>\r\n 	<li>type of particle system</li>\r\n 	<li>image to draw</li>\r\n 	<li># of active particles</li>\r\n 	<li>particle system bounding box</li>\r\n</ul>\r\nThe particle system is responsible for keeping track of all of its particles. It simulates and updates their positions. It draws the particles to the screen. It also keeps track of which particles are alive or need to be respawned.\r\nA single scene might have multiple particle systems at once. Fireworks wouldn\'t be as exciting if there could only be one explosion at a time, so we\'ll also need a particle system manager. The manager will keep track of active particle systems and make sure each one of them is updated at the appropriate time. Particle systems can be added and removed from the manager and the manager will keep track of the systems in memory. These functional requirements create a straightforward blueprint for a small collection of classes and functions required to make a particle system.\r\n\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Basic classes and data structures\r\n[/feature_headline]\r\nStarting from the top down, let\'s create a particle manager:\r\n<pre class=\"lang:default decode:true \">/*\r\n * Particle Manager Class\r\n * keeps track of all living particle systems\r\n */\r\n\r\nclass particle_manager\r\n{\r\npublic:\r\n    //a vector containing pointers to our active systems\r\n    std::vector systems;\r\n\r\n    particle_manager() {}\r\n    \r\n    //function to add a system\r\n    void addSystem(particle_system *sys) {\r\n        systems.push_back(sys);\r\n    }\r\n\r\n    //used to update all systems\r\n    //will free particle systems which are inactive\r\n    void update() {\r\n        systems.erase(std::remove_if(systems.begin(), systems.end(),\r\n                    [](particle_system* ps)\r\n                    bool alive = ps-&gt;update(); if(!alive) delete ps; return !alive;}), \r\n                    systems.end());\r\n    }\r\n\r\n    //used to render all systems\r\n    void render(af::array &amp;image) {\r\n        for(auto sys : systems)\r\n            sys-&gt;render(image);\r\n    }\r\n};</pre>\r\nAs we planned, the particle manager supports:\r\n<ul>\r\n 	<li>adding particle systems</li>\r\n 	<li>(automatically) removing particle systems</li>\r\n 	<li>updating particle systems</li>\r\n 	<li>rendering particle systems</li>\r\n</ul>\r\nOur actual particle system is still undefined. We want the particle system to implement the updating and rendering functions required by the manager while holding data to keep track of the particle system as a whole. We also want our basic particle system class to be generic so we can extend its functionality to match the complexity of any imaginable particle system.\r\n<pre class=\"lang:default decode:true \">class particle_system\r\n{\r\npublic:\r\n    //particle system data\r\n    af::array texture;\r\n    int num_particles;\r\n    int particle_size;\r\n    int system_type;\r\n    float system_pos[2];\r\n\r\n    particle_system(int num_particles_) {\r\n        num_particles = num_particles_;\r\n        system_pos[0] = 0; system_pos[1] = 0;\r\n    }\r\n\r\n    virtual ~particle_system() {}\r\n\r\n    // updates positions, velocities, and lifetime of particles in system\r\n    virtual bool update() {\r\n        return true;\r\n    }\r\n    //renders specific particle system\r\n    virtual void render(af::array &amp;image) = 0;\r\n};\r\n</pre>\r\nSo far, our particle system is actually missing our particles! In a more traditional approach, we would need to dynamically allocate space for our particles as they come alive and free space as they disappear. The frequent allocations would not work well with a GPU approach or with ArrayFire. Instead, we will be managing a data-structure that is known as a pool. Instead of frequently re-allocating space as each particle appears/disappears, we will instead allocate one large array with the maximum number of particles and keep track of what particles need to be updated. The pool approach maps directly to an af:array. This frees up our need to manage memory and puts all of the heavy lifting on ArrayFire. We will add several pools to our particle system to keep track of the particles\' properties:\r\n<pre class=\"lang:default decode:true\">//particle data\r\n    static const int dims = 2;\r\n    std::vector pos;\r\n    std::vector vel;\r\n    std::vector accel;\r\n    af::array lifetime;\r\n    af::array is_active;\r\n</pre>\r\nThe key array that lets us use a pool approach is the <span class=\"lang:default decode:true crayon-inline \">is_active</span>  array. It will be used as a mask array to update only the particles which are active. Now, we can make our generic functions slightly more useful by addressing the newly added particles.\r\n<pre class=\"lang:default decode:true\">particle_system(int num_particles_) {\r\n    num_particles = num_particles_;\r\n    system_pos[0] = 0; system_pos[1] = 0; system_pos[2] = 0;\r\n\r\n    for(int dim=0; dim&lt;dims; ++dim) {\r\n        pos.push_back(af::constant(0, num_particles));\r\n        vel.push_back(af::constant(0, num_particles));\r\n        accel.push_back(af::constant(0, num_particles));\r\n    }\r\n    lifetime = af::constant(0, num_particles);\r\n    is_active = af::constant(0, num_particles);\r\n}\r\n //offsets the whole particle system\r\nvoid move_system(float x, float y) {\r\n    system_pos[0] += x;\r\n    system_pos[1] += y;\r\n    pos[0] += x;\r\n    pos[1] += y;\r\n}\r\n// updates positions, velocities, and lifetime of particles in system\r\nvirtual bool update() {\r\n    if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n        for(int i=0; i&lt;pos.size(); ++i) {\r\n            pos[i](is_active&gt;0) += vel[i](is_active&gt;0);\r\n            vel[i](is_active&gt;0) += accel[i](is_active&gt;0);\r\n            lifetime += 1;\r\n        }\r\n        return true;\r\n    }\r\n    return false;\r\n}\r\n</pre>\r\nFirst, we initialize <span class=\"lang:default decode:true crayon-inline \">af::arrays</span> which represent the particles in the constructor. Then we add a method to move the particle system as a whole. The update function shows the key use of the <span class=\"lang:default decode:true crayon-inline \">is_active</span>  array where the <span class=\"lang:default decode:true crayon-inline \">is_active</span> array is used to index into the positions of the active particles and update only those particles.\r\n[feature_headline type=\"left\" level=\"h4\" looks_like=\"h4\"]Constructing a specific particle system\r\n[/feature_headline]\r\nNow that we have these generic classes we can attempt to make something more concrete, like an explosion! To do this, we will inherit from our basic particle system and mainly implement the rendering function specific to our firework explosion.\r\n<pre class=\"lang:default decode:true\">class explosion_system : public particle_system\r\n{\r\npublic:\r\n    float expl_speed;\r\n    explosion_system(int num_particles_, float expl_speed_) \r\n    : particle_system::particle_system(num_particles_)\r\n    {\r\n        particle_size = 5;\r\n        expl_speed = expl_speed_;\r\n\r\n        is_active = af::constant(1, num_particles);\r\n\r\n        pos[0]   = af::constant(system_pos[0], num_particles);\r\n        pos[1]   = af::constant(system_pos[1], num_particles);\r\n        vel[0]   = af::randn(num_particles) * expl_speed;\r\n        vel[1]   = af::randn(num_particles) * expl_speed;\r\n        accel[0] = af::constant(0.f, num_particles);\r\n        accel[1] = af::constant(0.09f, num_particles);\r\n\r\n        system_type = EXPLOSION_SYSTEM;\r\n    }\r\n\r\n    bool update() {\r\n        //kill particles after 250 iterations\r\n        if(af::where(lifetime &gt; 250).elements() &gt; 0 ) {\r\n            is_active(lifetime &gt; 250) = 0;\r\n        }\r\n        //limit the top speed of our particles\r\n        if(af::where(vel[1] &gt; 3.f).elements() &gt; 0) {\r\n            vel[0](vel[1] &gt; 3.f) *= 0.9f;\r\n            vel[1](vel[1] &gt; 3.f) *= 0.9f;\r\n        }\r\n        return particle_system::update();\r\n    }\r\n\r\n    void render(af::array &amp;image) {\r\n        int image_width = image.dims(0);\r\n        int image_height = image.dims(1);\r\n        static const af::array particle = af::constant(1, particle_size, particle_size);\r\n        af::array ids = ids_from_pos(image_width, image_height, pos);\r\n        if(af::where(is_active &gt; 0).elements() &gt; 0 ) {\r\n            ids = ids(is_active&gt;0);\r\n            af::array temp = af::constant(0, image.dims());\r\n            temp(ids) = 5/lifetime(is_active&gt;0);\r\n            image += af::convolve(temp, particle);\r\n        }\r\n    }\r\n};\r\n</pre>\r\nIn this class, we start by setting up the initial conditions of our explosion particle system. This uses the <span class=\"lang:default decode:true crayon-inline \">af::constant</span> and <span class=\"lang:default decode:true crayon-inline \">af::randn</span> functions to set the particles\' positions and speeds. We set all of the pooled particles to be active from the very beginning and specify the type of our system in case we need to modify it from the manager.\r\nOur update function keeps track of the lifetime of our particles and also limits their maximum speed.\r\nThe render function is fairly similar to the update function with regards to the use of the <span class=\"lang:default decode:true crayon-inline \">is_active</span> array. Once again, this allows drawing only the active particles. To make our fireworks fade away, we vary the intensity of each particle with respect to its lifetime.\r\n\r\nNow that we have a decent particle system and manager, let\'s set up the framework code and use our shiny new classes.\r\n<pre class=\"lang:default decode:true \">#include \"arrayfire.h\"\r\n#include \"particle_system.h\"\r\n\r\nusing namespace af;\r\nusing namespace std;\r\n\r\nstatic const int width = 768, height = 768;\r\nconst float explosion_speed = 1.1f;\r\nconst int num_explosion_particles = 400;\r\n\r\nint main(int argc, char *argv[])\r\n{\r\n    try {\r\n        //set up an arrayfire window with a color map\r\n        af::Window myWindow(width, height, \"Particle Engine using ArrayFire\");\r\n        myWindow.setColorMap(AF_COLORMAP_HEAT);\r\n\r\n        int frame_count = 0;\r\n        af::array image = af::constant(0, width, height);\r\n\r\n        //create our particle manager\r\n        particle_manager particles;\r\n\r\n        while(!myWindow.close()) {\r\n            //launch new firework every 200 frames\r\n            if(frame_count % 200 == 0) {\r\n                explosion_system *explosion = new \r\n                                  explosion_system(num_explosion_particles, explosion_speed);\r\n                explosion -&gt; move_system(width/2, height/2);\r\n                particles.addSystem(explosion);\r\n            }\r\n\r\n            //render image with the particle manager\r\n            particles.render(image);\r\n            //and display it to the window then clear the image\r\n            myWindow.image(image);\r\n            image = af::constant(0, image.dims());\r\n\r\n            //simulate all particle systems\r\n            particles.update();\r\n            frame_count++;\r\n        }\r\n    } catch (af::exception&amp; e) {\r\n        fprintf(stderr, \"%s\\n\", e.what());\r\n        throw;\r\n    }\r\n    return 0;\r\n}\r\n</pre>\r\nAnd Boom! You should have a working particle system.\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\"><img class=\"aligncenter size-full wp-image-8993\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/07/optimized.gif\" alt=\"optimized\" width=\"640\" height=\"678\" /></a>\r\nIn our full code, we added one more particle system which shows additional ways the particle manager can be used to manage particle systems. Check it out at this <a href=\"https://github.com/syurkevi/arrayfire_particle_system_example\">github repository.</a>','A Simple Particle System with ArrayFire','','inherit','closed','closed','','8971-revision-v1','','','2016-07-05 15:13:41','2016-07-05 19:13:41','',8971,'http://sandbox.arrayfire.com/8971-revision-v1/',0,'revision','',0),(9004,18528,'2016-07-13 09:13:31','2016-07-13 13:13:31','[content_band inner_container=\"true\" no_margin=\"true\" border=\"bottom\" padding_top=\"40px\" padding_bottom=\"40px\" bg_color=\"#FFF\" ]\n\nWe do business as ArrayFire. Our official company name is AccelerEyes.\n<h3>Terms of Use</h3>\n<strong>Acceptance of Terms</strong>\n\nArrayFire makes available for your use on this Web site (the \"Site\") information, documents, software and products (collectively, the \"Materials\") and various services operated by ArrayFire (collectively, the \"Services\"), subject to the terms and conditions set forth in this document (the \"Terms of Use\"). By accessing or using this Site, which includes your access to or use of any of the Services, you agree to the Terms of Use. ArrayFire reserves the right to change the Terms of Use from time to time at its sole discretion. Your use of the Site will be subject to the most current version of the Terms of Use posted on the Site at the time of such use. In addition, when using particular Services or Materials on this Site, you shall be subject to any posted guidelines or rules applicable to such Services or Materials that may contain terms and conditions in addition to those in the Terms of Use. All such guidelines or rules are hereby incorporated by reference into the Terms of Use. If you breach any of the Terms of Use, your authorization to use this Site automatically terminates and you must immediately destroy any Materials Downloaded or printed from the Site.\n\n<strong>Copyright / Limited License</strong>\n\nThe Materials and Services on this Site are protected by copyright and/or other intellectual property laws and any unauthorized use of the Materials or Services at this Site may violate such laws. Except as expressly provided herein, ArrayFire and its suppliers do not grant any express or implied right to you under any patents, copyrights, trademarks, or trade secret information with respect to the Materials and Services.\n\nExcept as specifically permitted herein, no portion of the information or documents on this Site may be reproduced in any form or by any means without the prior written permission of ArrayFire.\n\n<strong>Use of Software</strong>. The software and accompanying documentation that are made available to Download from this Site are the copyrighted work of ArrayFire and/or its suppliers. Use of the software is governed by the terms of the end user license agreement that accompanies or is included with such software. You will not be able to Download or install any software that is accompanied by or includes an end user license agreement unless you agree to the terms of such end user license agreement. If you do not agree to such terms, you will not be able to use the software. You may not decompile, reverse engineer or otherwise attempt to discover the source code of the software available on the Site.\n\n<strong>Use of Site Information</strong>. Except as otherwise indicated elsewhere on this Site, you may view, Download and print the documents and information available on this Site subject to the following conditions:\n\nThe documents and information may be used solely for personal, informational, internal, non-commercial purposes. The documents and information may not be modified or altered in any way. The documents and information on the Site may not be distributed. You may not remove any copyright or other proprietary notices contained in the documents and information.\n\nArrayFire reserves the right to revoke the authorization to view, Download and print the documents and information available on this Site at any time, and any such use shall be discontinued immediately upon written notice from ArrayFire. The rights granted to you constitute a license and not a transfer of title. The rights specified above to view, Download and print the documents and information available on this Site are not applicable to the design or layout of this Site. Elements of this Site are protected by trade dress and other laws and may not be copied or imitated in whole or in part.\n\n<strong>Use and Protection of Account Numbers and Password</strong>\n\nYou are responsible for maintaining the confidentiality of your account number and/or password, if applicable. You are responsible for all uses of your account, whether or not actually or expressly authorized by you.\n\n<strong>Warranty and Disclaimers</strong>\n\nEXCEPT AS EXPRESSLY PROVIDED OTHERWISE IN A WRITTEN AGREEMENT BETWEEN YOU AND ArrayFire, ALL MATERIALS AND SERVICES ON THIS SITE ARE PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR THE WARRANTY OF NON-INFRINGEMENT. WITHOUT LIMITING THE FOREGOING, ArrayFire MAKES NO WARRANTY THAT (i) THE SERVICES AND MATERIALS WILL MEET YOUR REQUIREMENTS, (ii) THE SERVICES AND MATERIALS WILL BE UNINTERRUPTED, TIMELY, SECURE, OR ERROR-FREE, (iii) THE RESULTS THAT MAY BE OBTAINED FROM THE USE OF THE SERVICES OR MATERIALS WILL BE EFFECTIVE, ACCURATE OR RELIABLE, (iv) THE QUALITY OF ANY PRODUCTS, SERVICES, OR INFORMATION PURCHASED OR OBTAINED BY YOU FROM THE SITE WILL MEET YOUR EXPECTATIONS, AND (v) ANY ERRORS IN THE SOFTWARE OBTAINED FROM THE SITE WILL BE CORRECTED. SOME STATES OR JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES OR LIMITATIONS ON HOW LONG AN IMPLIED WARRANTY MAY LAST, SO THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU. TO THE EXTENT PERMISSIBLE, ANY IMPLIED WARRANTIES ARE LIMITED TO NINETY (90) DAYS.\n\nTHIS SITE COULD INCLUDE TECHNICAL OR OTHER MISTAKES, INACCURACIES OR TYPOGRAPHICAL ERRORS. ArrayFire MAY MAKE CHANGES TO THE MATERIALS AND SERVICES AT THIS SITE, INCLUDING THE PRICES AND DESCRIPTIONS OF ANY PRODUCTS LISTED HEREIN, AT ANY TIME WITHOUT NOTICE. THE MATERIALS OR SERVICES AT THIS SITE MAY BE OUT OF DATE, AND ArrayFire MAKES NO COMMITMENT TO UPDATE SUCH MATERIALS OR SERVICES.\n\nArrayFire ASSUMES NO RESPONSIBILITY FOR ERRORS OR OMISSIONS IN THE INFORMATION, DOCUMENTS, SOFTWARE, MATERIALS AND/OR SERVICES WHICH ARE REFERENCED BY OR LINKED TO THIS SITE. REFERENCES TO OTHER CORPORATIONS, THEIR SERVICES AND PRODUCTS, ARE PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED.\n\nIN NO EVENT SHALL ArrayFire OR ITS SUPPLIERS BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY SPECIAL, PUNITIVE, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING, WITHOUT LIMITATION, THOSE RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ArrayFire HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OF THIS SITE OR OF ANY WEB SITE REFERENCED OR LINKED TO FROM THIS SITE. SOME JURISDICTIONS PROHIBIT THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, SO THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.\n\nTHE USE OF THE SERVICES OR THE DOWNLOAD OR OTHER ACQUISITION OF ANY MATERIALS THROUGH THE SITE IS DONE AT YOUR OWN DISCRETION AND RISK AND WITH YOUR AGREEMENT THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM SUCH ACTIVITIES. NO ADVICE OR INFORMATION, WHETHER ORAL OR WRITTEN, OBTAINED BY YOU FROM ArrayFire OR THROUGH OR FROM THE SITE SHALL CREATE ANY WARRANTY NOT EXPRESSLY STATED IN THE TERMS OF USE.\n\nThis Site contains links to third-party Web sites that are not under the control of ArrayFire. ArrayFire makes no representations whatsoever about any other Web site to which you may have access through this Site. When you access a non-ArrayFire Web site, you do so at your own risk and ArrayFire is not responsible for the accuracy or reliability of any information, data, opinions, advice, or statements made on these sites or for the quality of any products or services available on such sites. ArrayFire provides these links merely as a convenience and the inclusion of such links does not imply that ArrayFire endorses or accepts any responsibility for the content or uses of such Web sites.\n\nThis Site can be accessed from other countries around the world and may contain references to ArrayFire products, services, and programs that have not been announced in your country. These references do not imply that ArrayFire intends to announce such products, services or programs in your country.\n\n<strong>Personal Information and Privacy</strong>\n\nTo learn about how ArrayFire protects your personal information, such as your name and address, refer to the ArrayFire Online Privacy Policy. Please note that any non-personal information or material sent to ArrayFire will be generally be deemed to NOT be confidential.\n\n<strong>License for User Content</strong>\n\nCertain Services offered on this Site accommodate or require user-supplied information, materials or communications (collectively, \'User Content\'). Depending upon the nature of the Service, by submitting User Content to this Site you grant ArrayFire one of the following two types of licenses:\n\nFor User Content that is the result of your creative efforts, such as examples of work you have done using ArrayFire products, you hereby grant ArrayFire a worldwide, royalty-free, non-exclusive license to reproduce and modify (for purposes of formatting, maintenance or Site administration only) such User Content. You also grant ArrayFire the right to distribute and publicly display and perform such User Content for the purpose for which such User Content was submitted to the Service. This license will be in effect until such User Content is removed from the Site.\n\nFor User Content such as comments to the ArrayFire User to User Forums, bug reports, piracy reports or product suggestions, you grant ArrayFire an unrestricted, worldwide, irrevocable license to use, reproduce, display, perform, modify, transmit and distribute such User Content, and you also agree that ArrayFire is free to use any ideas, concepts, know-how or techniques that you send us for any purpose. However, we will not release your name or otherwise publicize the fact that you submitted such User Content to us unless: (a) you grant us permission to do so; (b) we first notify you that the User Content you submit to a particular part of the Site will be published or otherwise used with your name on it; or (c) we are required to do so by law.\n\n<strong>Prohibited Communications</strong>\n\nYou may only submit to the Site, User Content that is (a) owned by you, (b) submitted with the express permission of the owner, or (c) in the public domain. You are prohibited from posting or transmitting to or from this Site any unlawful, threatening, libelous, defamatory, obscene, pornographic, or other materials that would violate any law or the rights of others, including without limitation, laws against copyright infringement. Violation of these restrictions may result in limitations on access by you to this Site.\n\n<strong>Managing User Content and Communications</strong>\n\nArrayFire reserves the right, in its sole discretion, to delete or remove your User Content from the Site and to restrict, suspend or terminate your access to all or part of this Site, at any time for any reason without prior notice or liability.\n\nArrayFire may establish general practices and limits on the use of any Service, including, but not limited to, limits on retention time, file size, and storage space for User Content. ArrayFire shall have no liability or responsibility for the deletion or failure to store any information or materials in connection with any Service.\n\nArrayFire may, but is not obligated to, monitor or review (i) any areas on the Site where users transmit or post User Content, including but not limited to areas where Services are available, or chat rooms, bulletin boards or other user forums, and (ii) the substance of any User Content.\n\nTo the maximum extent permitted by law, ArrayFire will have no liability related to User Content arising under the laws of copyright, libel, privacy, obscenity, or otherwise. ArrayFire also disclaims all liability with respect to the misuse, loss, modification, or unavailability of any User Content.\n\n<strong>User Forums</strong>\n\nIn addition to these Terms of Use, users of the ArrayFire User To User Forums must agree to a separate legal agreement located within the Forums Registration area of the Site. Your access to the User to User Forums will be denied for violation of the prohibitions set forth in this Terms of Use under the Section entitled PROHIBITED COMMUNICATIONS.\n\n<strong>Notification of Copyright Infringement</strong>\n\nArrayFire will, in appropriate circumstances, terminate the accounts of users who infringe the intellectual property rights of others. If you believe that your work has been used or copied in a way that constitutes copyright infringement and such infringement is occurring on this Site or on sites linked to from this Site, please provide ArrayFire\' Copyright Agent a Notice containing the following elements:\n\na physical or electronic signature of the person authorized to act on behalf of the owner of the copyright interest that is alleged to have been infringed; a description of the copyrighted work or works that you claim have been infringed and identification of what material in such work(s) is claimed to be infringing and which you request to be removed or access to which is to be disabled; a description of where the material that you claim is infringing is located on the ArrayFire site; information sufficient to permit ArrayFire to contact you, such as your physical address, telephone number, and email address; a statement by you that you have a good faith belief that the use of the material identified in your Notice in the manner complained of is not authorized by the copyright owner, its agent, or the law; a statement by you that the information in your Notice is accurate and, under penalty of perjury, that you are the copyright owner or authorized to act on the copyright owner\'s behalf.\n\n<strong>Indemnity</strong>\n\nYou agree to indemnify and hold ArrayFire, and its subsidiaries, affiliates, officers, agents, co-branders or other partners, and employees, harmless from any claim or demand, including reasonable attorneys\' fees, made by any third party due to or arising out of content you submit, post to or transmit through the Site (including, without limitation, any User Content), your use of the Site, your connection to the Site, your violation of the Terms of Use, or your violation of any rights of another person or entity.\n\n<strong>Compliance with Local Laws</strong>\n\nThis site (excluding linked sites) is controlled by ArrayFire from its offices in Austell, GA, USA. ArrayFire makes no representation that materials or services available on this site are appropriate or available for use in specific locations. Accessing them from territories where their contents are illegal is prohibited. Those who choose to access this site from any location do so on their own initiative and are responsible for compliance with local laws.\n\n<strong>Trademark Information</strong>\n\nPlease see our <a href=\"http://sandbox.arrayfire.com/trademark-policy/\">trademark policy</a>.\n<h3>Online Privacy Policy</h3>\nBy accessing or using the ArrayFire.com Web site, you agree to the terms of the ArrayFire Online Privacy Policy, as outlined below. If you do not agree to these terms, please do not access or use this site. ArrayFire reserves the right to change the Online Privacy Policy from time to time at its sole discretion. Your use of this site will be subject to the most current version of the Online Privacy Policy at the time of such use.\n\nCollection of personal information\n\nWhen you engage in certain activities on this site, such as ordering or registering products, Download software, or entering contests, ArrayFire may ask you to provide certain information about yourself by filling out and submitting an online form. It is completely optional for you to engage in these activities. If you elect to engage in these activities, however, ArrayFire may ask that you provide us personal information, such as your first and last name, mailing address (including zip code), e-mail address, employer, job title and department, telephone and facsimile numbers, and other personal identifying information. When ordering products or services on the site, you may be asked to provide a credit card number. Depending upon the activity, some of the information that we ask you to provide is identified as mandatory and some as voluntary. If you do not provide the mandatory data with respect to a particular activity, you will not be able to engage in that activity.\n\nWhen you submit personal information to ArrayFire on this site, you understand and agree that this information may be transferred across national boundaries and may be stored and processed in any of the countries in which ArrayFire and its affiliates and subsidiaries maintain offices, including without limitation, the United States. You also acknowledge that in certain countries or with respect to certain activities, the collection, transferring, storage and processing of your information may be undertaken by trusted vendors of ArrayFire.\n\nHow your personal information is used ArrayFire collects your information in order to record and support your participation in the activities you select. If you order a product that is to be electronically Download, for example, the information is used to register your license and rights, if any, to technical support, upgrade discounts, or other benefits that may be made available to registered users. If you enter a contest, information is collected to qualify the entry and contact you regarding the contest or prize awards. The information that you provide is also used as part of our effort to keep you informed about product upgrades, special offers, and other products and services of ArrayFire and selected third parties.\n\nYour choices with respect to personal information ArrayFire recognizes and appreciates the importance of responsible use of information collected on this site. If you do not want the information you provide to ArrayFire to be used to inform you of other products, services and special offers available from ArrayFire, and you indicate this preference when you provide your personal information to ArrayFire, ArrayFire will honor your preference. ArrayFire reserves the right to provide aggregate data to third parties for statistical analysis. Such data will not be linked to any particular individuals.\n\nProtection of your personal information\n\nThe personal information that you provide in connection with registering yourself as an ArrayFire user or registering an ArrayFire product is classified as Registration Information. Registration Information is protected. Your Registration Information resides on a secure server that only selected ArrayFire personnel and contractors have access to via password. ArrayFire encrypts your personal information and thereby prevents unauthorized parties from viewing such information when it is transmitted to ArrayFire.\n\nPersonal information that you provide that is not Registration Information also resides on a secure server and is only accessible via password. Since this information is not accessible from outside ArrayFire, you will not be asked to select a password in order to view or modify such information.\n\nPlease note that any information you post to a public bulletin board or chat room, such as the ArrayFire User to User Forums, is available to all persons accessing that site.\n\nUse of cookies\n\nThe rights specified above to view, Download and print the documents and information available on this Site are not applicable to the design or layout of this Site. Elements of this Site are protected by trade dress and other laws and may not be copied or imitated in whole or in part. When you visit ArrayFire.com, you can surf the site anonymously and access important information without revealing your identity. In order to improve our site, we use \"cookies\" to track your visit. A cookie is small amount of data that is transferred to your browser by a Web server and can only be read by the server that gave it to you. It functions as your identification card, recording your passwords, purchases, and preferences. It cannot be executed as code or deliver viruses.\n\nMost browsers are initially set to accept cookies. You can set your browser to notify you when you receive a cookie, giving you the chance to decide whether or not to accept it. (For some Web pages that require an authorization, cookies are not optional. Users choosing not to accept cookies will probably not be able to access those pages.)\n\nWhile ArrayFire uses cookies to track your visit to ArrayFire.com, and our Web servers automatically log the IP/Internet address of your computer, this information does not identify you personally and you remain anonymous unless you have otherwise provided ArrayFire with personal information.\n\nPrivacy related complaints\n\nIf you believe that ArrayFire has not complied with this Online Privacy Policy with respect to your personal information, you may write the ArrayFire Privacy Officer at the address indicated above.\n\nIn your letter, please describe in as much detail as possible the ways in which you believe that the ArrayFire Online Privacy Policy has not been complied with. We will investigate your complaint promptly.\n\nPlease note that if you provide ArrayFire with inconsistent privacy preferences (for example, by indicating on one occasion that third parties may contact you with marketing offers and indicating on another occasion that they may not), ArrayFire cannot guarantee that your most recent privacy preference will be honored.\n\nAlso, please note that ArrayFire is not responsible for the content or privacy practices of non-ArrayFire Web sites to which ArrayFire.com or any other ArrayFire Web site may link.<span style=\"color: #ffffff;\"><span style=\"color: #000000;\">[/content_band]</span></span>[content_band inner_container=\"true\" no_margin=\"true\" border=\"bottom\" padding_top=\"40px\" padding_bottom=\"40px\"]\n<h3>Imprint</h3>\n<strong>AccelerEyes LLC</strong>\n3450 Piedmont Rd NE STE 100\nAtlanta, GA  30305\nUSA\nPhone: (800) 570-1941\nEmail: <a href=\"mailto:sales@arrayfire.com\">sales@arrayfire.com</a>\nEditor: AccelerEyes LLC, Atlanta, GA.\nState of Incorporation: Georgia, USA.\n\n<strong>Disclaimer</strong>\n\n<strong>Contents of the Website</strong>\n\nArrayFire makes every effort to ensure that the material contained in its web site is current, complete and correct. Despite this errors and mistakes cannot be completely ruled out. ArrayFire does not accept liability for the relevance, accuracy or completeness of the information and material offered in its website unless the mistake occurred intentionally or through gross negligence. This refers to any loss, additional costs or damage of any kind suffered as a result of any use of any material in this website.\n\n<strong>Copyright</strong>\n\nThe Layout of the Homepage, graphics and pictures used and the collection of individual contributions are protected by copyright. ArrayFire reserves all rights including the rights of reproduction, the duplication and distribution via special processes.\n\n<strong>Trademarks</strong>\n\nThe following are either registered trademarks or trademarks of the named company in the United States, United Kingdom and/or other countries.\n\n\"Personal Supercomputing\" - AccelerEyes LLC.\n\"Simple Software for Powerful Visual Computing\" - AccelerEyes LLC.\n\"AccelerEyes\", the AccelerEyes logo - AccelerEyes LLC.\n\"Jacket\", \"LibJacket\", \"ArrayFire\", and their respective logos - AccelerEyes LLC.\nthe NVIDIA logo - NVIDIA.\n\"Windows\" - Microsoft Corporation.\n\"OpenCL\" - Apple.\n\"Adobe\" and \"Acrobat\" - Adobe Systems Inc.\nAerospace Blockset™, Bioinformatics Toolbox™, Communications Blockset™, Communications Toolbox™, Control System Toolbox™, Curve Fitting Toolbox™, Data Acquisition Toolbox™, Database Toolbox™, Datafeed Toolbox™, Econometrics Toolbox™, EDA Simulator Link™, Embedded IDE Link™, Embedded MATLAB®, Extended Symbolic Math Toolbox™, Filter Design HDL Coder™, Filter Design Toolbox™, Financial Derivatives Toolbox™, Financial Toolbox™, Fixed-Income Toolbox™, Fixed-Point Toolbox™, Fuzzy Logic Toolbox™, GARCH Toolbox™, Gauges Blockset™, Genetic Algorithm and Direct Search Toolbox™, Handle Graphics®, Image Acquisition Toolbox™, Image Processing Toolbox™, Instrument Control Toolbox™, L-shaped membrane logo (graphic only)®, Mapping Toolbox™, MathWorks®, MATLAB®, MATLAB® Builder™ EX, MATLAB® Builder™ JA, MATLAB® Builder™ NE, MATLAB® Compiler™, MATLAB® Connector™, MATLAB® Distributed Computing Server™, MATLAB® Mobile™, MATLAB® Report Generator™, Model Predictive Control Toolbox™, Model-Based Calibration Toolbox™, Neural Network Toolbox™, OPC Toolbox™, Optimization Toolbox™, Parallel Computing Toolbox™, Partial Differential Equation Toolbox™, Polyspace®, Polyspace® Client™ for Ada, Polyspace® Client™ for C/C++, Polyspace® Model Link™ SL, Polyspace® Model Link™ TL, Polyspace® Server™ for Ada, Polyspace® Server™ for C/C++, Polyspace® UML Link™ RH, Real-Time Windows Target™, Real-Time Workshop®, Real-Time Workshop® Embedded Coder™, RF Blockset™, RF Toolbox™, Robust Control Toolbox™, Signal Processing Blockset™, Signal Processing Toolbox™, SimBiology®, SimDriveline™, SimElectronics®, SimEvents®, SimHydraulics®, SimMechanics™, SimPowerSystems™, SimRF™, Simscape™, Simulink®, Simulink® 3D Animation™, Simulink® Accelerator™, Simulink® Control Design™, Simulink® Design Optimization™, Simulink® Design Verifier™, Simulink® Fixed Point™, Simulink® HDL Coder™, Simulink® Parameter Estimation™, Simulink® PLC Coder™, Simulink® Report Generator™, Simulink® Response Optimization™, Simulink® Verification and Validation™, Spline Toolbox™, Spreadsheet Link™ EX, Stateflow®, Stateflow® Coder™, Statistics Toolbox™, Symbolic Math Toolbox™, System Identification Toolbox™, SystemTest™, Target Support Package™, Vehicle Network Toolbox™, Video and Image Processing Blockset™, Virtual Reality Toolbox™, Wavelet Toolbox™, xPC Target™, xPC TargetBox™, xPC Target™ Embedded Option™ - The MathWorks, Inc.\n\nIf you notice the use of a trademark on this site which is not accredited herein, please contact our Marketing Department at <a href=\"mailto:sales@arrayfire.com\">sales@arrayfire.com</a>.\n\n<strong>Links to Third Party Information</strong>\n\nThe ArrayFire website links to third party information providers. ArrayFire has no influence on the contents or reliability of the websites of these third party information providers. The following therefore applies to all links:\n\nArrayFire has no influence on the design and contents of third party internet websites. ArrayFire therefore expressly distances itself from the material of all third party internet websites, even if the ArrayFire website links to these external sites. The declaration is valid for all links given on our website and the material of all sites reached via links on the ArrayFire website. Privacy Where you are invited to submit personal information (eMail address, names, postal addresses) the submission of this information is purely voluntary.\n\n<strong>Legal validity</strong>\n\nThis general disclaimer is part of the material offered on the ArrayFire website. If any of the terms and conditions should be determined invalid by reason of the relevant laws then the remaining terms and conditions shall remain in full effect.[/content_band]\n<h3></h3>','Legal','','inherit','closed','closed','','319-autosave-v1','','','2016-07-13 09:13:31','2016-07-13 13:13:31','',319,'http://sandbox.arrayfire.com/319-autosave-v1/',0,'revision','',0),(9005,18528,'2016-07-13 09:14:51','2016-07-13 13:14:51','[content_band inner_container=\"true\" no_margin=\"true\" border=\"bottom\" padding_top=\"40px\" padding_bottom=\"40px\" bg_color=\"#FFF\" ]\r\n\r\nWe do business as ArrayFire. Our official company name is AccelerEyes.\r\n<h3>Terms of Use</h3>\r\n<strong>Acceptance of Terms</strong>\r\n\r\nArrayFire makes available for your use on this Web site (the \"Site\") information, documents, software and products (collectively, the \"Materials\") and various services operated by ArrayFire (collectively, the \"Services\"), subject to the terms and conditions set forth in this document (the \"Terms of Use\"). By accessing or using this Site, which includes your access to or use of any of the Services, you agree to the Terms of Use. ArrayFire reserves the right to change the Terms of Use from time to time at its sole discretion. Your use of the Site will be subject to the most current version of the Terms of Use posted on the Site at the time of such use. In addition, when using particular Services or Materials on this Site, you shall be subject to any posted guidelines or rules applicable to such Services or Materials that may contain terms and conditions in addition to those in the Terms of Use. All such guidelines or rules are hereby incorporated by reference into the Terms of Use. If you breach any of the Terms of Use, your authorization to use this Site automatically terminates and you must immediately destroy any Materials Downloaded or printed from the Site.\r\n\r\n<strong>Copyright / Limited License</strong>\r\n\r\nThe Materials and Services on this Site are protected by copyright and/or other intellectual property laws and any unauthorized use of the Materials or Services at this Site may violate such laws. Except as expressly provided herein, ArrayFire and its suppliers do not grant any express or implied right to you under any patents, copyrights, trademarks, or trade secret information with respect to the Materials and Services.\r\n\r\nExcept as specifically permitted herein, no portion of the information or documents on this Site may be reproduced in any form or by any means without the prior written permission of ArrayFire.\r\n\r\n<strong>Use of Software</strong>. The software and accompanying documentation that are made available to Download from this Site are the copyrighted work of ArrayFire and/or its suppliers. Use of the software is governed by the terms of the end user license agreement that accompanies or is included with such software. You will not be able to Download or install any software that is accompanied by or includes an end user license agreement unless you agree to the terms of such end user license agreement. If you do not agree to such terms, you will not be able to use the software. You may not decompile, reverse engineer or otherwise attempt to discover the source code of the software available on the Site.\r\n\r\n<strong>Use of Site Information</strong>. Except as otherwise indicated elsewhere on this Site, you may view, Download and print the documents and information available on this Site subject to the following conditions:\r\n\r\nThe documents and information may be used solely for personal, informational, internal, non-commercial purposes. The documents and information may not be modified or altered in any way. The documents and information on the Site may not be distributed. You may not remove any copyright or other proprietary notices contained in the documents and information.\r\n\r\nArrayFire reserves the right to revoke the authorization to view, Download and print the documents and information available on this Site at any time, and any such use shall be discontinued immediately upon written notice from ArrayFire. The rights granted to you constitute a license and not a transfer of title. The rights specified above to view, Download and print the documents and information available on this Site are not applicable to the design or layout of this Site. Elements of this Site are protected by trade dress and other laws and may not be copied or imitated in whole or in part.\r\n\r\n<strong>Use and Protection of Account Numbers and Password</strong>\r\n\r\nYou are responsible for maintaining the confidentiality of your account number and/or password, if applicable. You are responsible for all uses of your account, whether or not actually or expressly authorized by you.\r\n\r\n<strong>Warranty and Disclaimers</strong>\r\n\r\nEXCEPT AS EXPRESSLY PROVIDED OTHERWISE IN A WRITTEN AGREEMENT BETWEEN YOU AND ArrayFire, ALL MATERIALS AND SERVICES ON THIS SITE ARE PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, OR THE WARRANTY OF NON-INFRINGEMENT. WITHOUT LIMITING THE FOREGOING, ArrayFire MAKES NO WARRANTY THAT (i) THE SERVICES AND MATERIALS WILL MEET YOUR REQUIREMENTS, (ii) THE SERVICES AND MATERIALS WILL BE UNINTERRUPTED, TIMELY, SECURE, OR ERROR-FREE, (iii) THE RESULTS THAT MAY BE OBTAINED FROM THE USE OF THE SERVICES OR MATERIALS WILL BE EFFECTIVE, ACCURATE OR RELIABLE, (iv) THE QUALITY OF ANY PRODUCTS, SERVICES, OR INFORMATION PURCHASED OR OBTAINED BY YOU FROM THE SITE WILL MEET YOUR EXPECTATIONS, AND (v) ANY ERRORS IN THE SOFTWARE OBTAINED FROM THE SITE WILL BE CORRECTED. SOME STATES OR JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED WARRANTIES OR LIMITATIONS ON HOW LONG AN IMPLIED WARRANTY MAY LAST, SO THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU. TO THE EXTENT PERMISSIBLE, ANY IMPLIED WARRANTIES ARE LIMITED TO NINETY (90) DAYS.\r\n\r\nTHIS SITE COULD INCLUDE TECHNICAL OR OTHER MISTAKES, INACCURACIES OR TYPOGRAPHICAL ERRORS. ArrayFire MAY MAKE CHANGES TO THE MATERIALS AND SERVICES AT THIS SITE, INCLUDING THE PRICES AND DESCRIPTIONS OF ANY PRODUCTS LISTED HEREIN, AT ANY TIME WITHOUT NOTICE. THE MATERIALS OR SERVICES AT THIS SITE MAY BE OUT OF DATE, AND ArrayFire MAKES NO COMMITMENT TO UPDATE SUCH MATERIALS OR SERVICES.\r\n\r\nArrayFire ASSUMES NO RESPONSIBILITY FOR ERRORS OR OMISSIONS IN THE INFORMATION, DOCUMENTS, SOFTWARE, MATERIALS AND/OR SERVICES WHICH ARE REFERENCED BY OR LINKED TO THIS SITE. REFERENCES TO OTHER CORPORATIONS, THEIR SERVICES AND PRODUCTS, ARE PROVIDED \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r\n\r\nIN NO EVENT SHALL ArrayFire OR ITS SUPPLIERS BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY SPECIAL, PUNITIVE, INCIDENTAL, INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER, INCLUDING, WITHOUT LIMITATION, THOSE RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ArrayFire HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES, AND ON ANY THEORY OF LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OF THIS SITE OR OF ANY WEB SITE REFERENCED OR LINKED TO FROM THIS SITE. SOME JURISDICTIONS PROHIBIT THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES, SO THE ABOVE LIMITATIONS MAY NOT APPLY TO YOU.\r\n\r\nTHE USE OF THE SERVICES OR THE DOWNLOAD OR OTHER ACQUISITION OF ANY MATERIALS THROUGH THE SITE IS DONE AT YOUR OWN DISCRETION AND RISK AND WITH YOUR AGREEMENT THAT YOU WILL BE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR COMPUTER SYSTEM OR LOSS OF DATA THAT RESULTS FROM SUCH ACTIVITIES. NO ADVICE OR INFORMATION, WHETHER ORAL OR WRITTEN, OBTAINED BY YOU FROM ArrayFire OR THROUGH OR FROM THE SITE SHALL CREATE ANY WARRANTY NOT EXPRESSLY STATED IN THE TERMS OF USE.\r\n\r\nThis Site contains links to third-party Web sites that are not under the control of ArrayFire. ArrayFire makes no representations whatsoever about any other Web site to which you may have access through this Site. When you access a non-ArrayFire Web site, you do so at your own risk and ArrayFire is not responsible for the accuracy or reliability of any information, data, opinions, advice, or statements made on these sites or for the quality of any products or services available on such sites. ArrayFire provides these links merely as a convenience and the inclusion of such links does not imply that ArrayFire endorses or accepts any responsibility for the content or uses of such Web sites.\r\n\r\nThis Site can be accessed from other countries around the world and may contain references to ArrayFire products, services, and programs that have not been announced in your country. These references do not imply that ArrayFire intends to announce such products, services or programs in your country.\r\n\r\n<strong>Personal Information and Privacy</strong>\r\n\r\nTo learn about how ArrayFire protects your personal information, such as your name and address, refer to the ArrayFire Online Privacy Policy. Please note that any non-personal information or material sent to ArrayFire will be generally be deemed to NOT be confidential.\r\n\r\n<strong>License for User Content</strong>\r\n\r\nCertain Services offered on this Site accommodate or require user-supplied information, materials or communications (collectively, \'User Content\'). Depending upon the nature of the Service, by submitting User Content to this Site you grant ArrayFire one of the following two types of licenses:\r\n\r\nFor User Content that is the result of your creative efforts, such as examples of work you have done using ArrayFire products, you hereby grant ArrayFire a worldwide, royalty-free, non-exclusive license to reproduce and modify (for purposes of formatting, maintenance or Site administration only) such User Content. You also grant ArrayFire the right to distribute and publicly display and perform such User Content for the purpose for which such User Content was submitted to the Service. This license will be in effect until such User Content is removed from the Site.\r\n\r\nFor User Content such as comments to the ArrayFire User to User Forums, bug reports, piracy reports or product suggestions, you grant ArrayFire an unrestricted, worldwide, irrevocable license to use, reproduce, display, perform, modify, transmit and distribute such User Content, and you also agree that ArrayFire is free to use any ideas, concepts, know-how or techniques that you send us for any purpose. However, we will not release your name or otherwise publicize the fact that you submitted such User Content to us unless: (a) you grant us permission to do so; (b) we first notify you that the User Content you submit to a particular part of the Site will be published or otherwise used with your name on it; or (c) we are required to do so by law.\r\n\r\n<strong>Prohibited Communications</strong>\r\n\r\nYou may only submit to the Site, User Content that is (a) owned by you, (b) submitted with the express permission of the owner, or (c) in the public domain. You are prohibited from posting or transmitting to or from this Site any unlawful, threatening, libelous, defamatory, obscene, pornographic, or other materials that would violate any law or the rights of others, including without limitation, laws against copyright infringement. Violation of these restrictions may result in limitations on access by you to this Site.\r\n\r\n<strong>Managing User Content and Communications</strong>\r\n\r\nArrayFire reserves the right, in its sole discretion, to delete or remove your User Content from the Site and to restrict, suspend or terminate your access to all or part of this Site, at any time for any reason without prior notice or liability.\r\n\r\nArrayFire may establish general practices and limits on the use of any Service, including, but not limited to, limits on retention time, file size, and storage space for User Content. ArrayFire shall have no liability or responsibility for the deletion or failure to store any information or materials in connection with any Service.\r\n\r\nArrayFire may, but is not obligated to, monitor or review (i) any areas on the Site where users transmit or post User Content, including but not limited to areas where Services are available, or chat rooms, bulletin boards or other user forums, and (ii) the substance of any User Content.\r\n\r\nTo the maximum extent permitted by law, ArrayFire will have no liability related to User Content arising under the laws of copyright, libel, privacy, obscenity, or otherwise. ArrayFire also disclaims all liability with respect to the misuse, loss, modification, or unavailability of any User Content.\r\n\r\n<strong>User Forums</strong>\r\n\r\nIn addition to these Terms of Use, users of the ArrayFire User To User Forums must agree to a separate legal agreement located within the Forums Registration area of the Site. Your access to the User to User Forums will be denied for violation of the prohibitions set forth in this Terms of Use under the Section entitled PROHIBITED COMMUNICATIONS.\r\n\r\n<strong>Notification of Copyright Infringement</strong>\r\n\r\nArrayFire will, in appropriate circumstances, terminate the accounts of users who infringe the intellectual property rights of others. If you believe that your work has been used or copied in a way that constitutes copyright infringement and such infringement is occurring on this Site or on sites linked to from this Site, please provide ArrayFire\' Copyright Agent a Notice containing the following elements:\r\n\r\na physical or electronic signature of the person authorized to act on behalf of the owner of the copyright interest that is alleged to have been infringed; a description of the copyrighted work or works that you claim have been infringed and identification of what material in such work(s) is claimed to be infringing and which you request to be removed or access to which is to be disabled; a description of where the material that you claim is infringing is located on the ArrayFire site; information sufficient to permit ArrayFire to contact you, such as your physical address, telephone number, and email address; a statement by you that you have a good faith belief that the use of the material identified in your Notice in the manner complained of is not authorized by the copyright owner, its agent, or the law; a statement by you that the information in your Notice is accurate and, under penalty of perjury, that you are the copyright owner or authorized to act on the copyright owner\'s behalf.\r\n\r\n<strong>Indemnity</strong>\r\n\r\nYou agree to indemnify and hold ArrayFire, and its subsidiaries, affiliates, officers, agents, co-branders or other partners, and employees, harmless from any claim or demand, including reasonable attorneys\' fees, made by any third party due to or arising out of content you submit, post to or transmit through the Site (including, without limitation, any User Content), your use of the Site, your connection to the Site, your violation of the Terms of Use, or your violation of any rights of another person or entity.\r\n\r\n<strong>Compliance with Local Laws</strong>\r\n\r\nThis site (excluding linked sites) is controlled by ArrayFire from its offices in Austell, GA, USA. ArrayFire makes no representation that materials or services available on this site are appropriate or available for use in specific locations. Accessing them from territories where their contents are illegal is prohibited. Those who choose to access this site from any location do so on their own initiative and are responsible for compliance with local laws.\r\n\r\n<strong>Trademark Information</strong>\r\n\r\nPlease see our <a href=\"http://sandbox.arrayfire.com/trademark-policy/\">trademark policy</a>.\r\n<h3>Online Privacy Policy</h3>\r\nBy accessing or using the ArrayFire.com Web site, you agree to the terms of the ArrayFire Online Privacy Policy, as outlined below. If you do not agree to these terms, please do not access or use this site. ArrayFire reserves the right to change the Online Privacy Policy from time to time at its sole discretion. Your use of this site will be subject to the most current version of the Online Privacy Policy at the time of such use.\r\n\r\nCollection of personal information\r\n\r\nWhen you engage in certain activities on this site, such as ordering or registering products, Download software, or entering contests, ArrayFire may ask you to provide certain information about yourself by filling out and submitting an online form. It is completely optional for you to engage in these activities. If you elect to engage in these activities, however, ArrayFire may ask that you provide us personal information, such as your first and last name, mailing address (including zip code), e-mail address, employer, job title and department, telephone and facsimile numbers, and other personal identifying information. When ordering products or services on the site, you may be asked to provide a credit card number. Depending upon the activity, some of the information that we ask you to provide is identified as mandatory and some as voluntary. If you do not provide the mandatory data with respect to a particular activity, you will not be able to engage in that activity.\r\n\r\nWhen you submit personal information to ArrayFire on this site, you understand and agree that this information may be transferred across national boundaries and may be stored and processed in any of the countries in which ArrayFire and its affiliates and subsidiaries maintain offices, including without limitation, the United States. You also acknowledge that in certain countries or with respect to certain activities, the collection, transferring, storage and processing of your information may be undertaken by trusted vendors of ArrayFire.\r\n\r\nHow your personal information is used ArrayFire collects your information in order to record and support your participation in the activities you select. If you order a product that is to be electronically Download, for example, the information is used to register your license and rights, if any, to technical support, upgrade discounts, or other benefits that may be made available to registered users. If you enter a contest, information is collected to qualify the entry and contact you regarding the contest or prize awards. The information that you provide is also used as part of our effort to keep you informed about product upgrades, special offers, and other products and services of ArrayFire and selected third parties.\r\n\r\nYour choices with respect to personal information ArrayFire recognizes and appreciates the importance of responsible use of information collected on this site. If you do not want the information you provide to ArrayFire to be used to inform you of other products, services and special offers available from ArrayFire, and you indicate this preference when you provide your personal information to ArrayFire, ArrayFire will honor your preference. ArrayFire reserves the right to provide aggregate data to third parties for statistical analysis. Such data will not be linked to any particular individuals.\r\n\r\nProtection of your personal information\r\n\r\nThe personal information that you provide in connection with registering yourself as an ArrayFire user or registering an ArrayFire product is classified as Registration Information. Registration Information is protected. Your Registration Information resides on a secure server that only selected ArrayFire personnel and contractors have access to via password. ArrayFire encrypts your personal information and thereby prevents unauthorized parties from viewing such information when it is transmitted to ArrayFire.\r\n\r\nPersonal information that you provide that is not Registration Information also resides on a secure server and is only accessible via password. Since this information is not accessible from outside ArrayFire, you will not be asked to select a password in order to view or modify such information.\r\n\r\nPlease note that any information you post to a public bulletin board or chat room, such as the ArrayFire User to User Forums, is available to all persons accessing that site.\r\n\r\nUse of cookies\r\n\r\nThe rights specified above to view, Download and print the documents and information available on this Site are not applicable to the design or layout of this Site. Elements of this Site are protected by trade dress and other laws and may not be copied or imitated in whole or in part. When you visit ArrayFire.com, you can surf the site anonymously and access important information without revealing your identity. In order to improve our site, we use \"cookies\" to track your visit. A cookie is small amount of data that is transferred to your browser by a Web server and can only be read by the server that gave it to you. It functions as your identification card, recording your passwords, purchases, and preferences. It cannot be executed as code or deliver viruses.\r\n\r\nMost browsers are initially set to accept cookies. You can set your browser to notify you when you receive a cookie, giving you the chance to decide whether or not to accept it. (For some Web pages that require an authorization, cookies are not optional. Users choosing not to accept cookies will probably not be able to access those pages.)\r\n\r\nWhile ArrayFire uses cookies to track your visit to ArrayFire.com, and our Web servers automatically log the IP/Internet address of your computer, this information does not identify you personally and you remain anonymous unless you have otherwise provided ArrayFire with personal information.\r\n\r\nPrivacy related complaints\r\n\r\nIf you believe that ArrayFire has not complied with this Online Privacy Policy with respect to your personal information, you may write the ArrayFire Privacy Officer at the address indicated above.\r\n\r\nIn your letter, please describe in as much detail as possible the ways in which you believe that the ArrayFire Online Privacy Policy has not been complied with. We will investigate your complaint promptly.\r\n\r\nPlease note that if you provide ArrayFire with inconsistent privacy preferences (for example, by indicating on one occasion that third parties may contact you with marketing offers and indicating on another occasion that they may not), ArrayFire cannot guarantee that your most recent privacy preference will be honored.\r\n\r\nAlso, please note that ArrayFire is not responsible for the content or privacy practices of non-ArrayFire Web sites to which ArrayFire.com or any other ArrayFire Web site may link.<span style=\"color: #ffffff;\"><span style=\"color: #000000;\">[/content_band]</span></span>[content_band inner_container=\"true\" no_margin=\"true\" border=\"bottom\" padding_top=\"40px\" padding_bottom=\"40px\"]\r\n<h3>Imprint</h3>\r\n<strong>AccelerEyes LLC</strong>\r\n3450 Piedmont Rd NE STE 100\r\nAtlanta, GA  30305\r\nUSA\r\nPhone: (800) 570-1941\r\nEmail: <a href=\"mailto:sales@arrayfire.com\">sales@arrayfire.com</a>\r\nEditor: AccelerEyes LLC, Atlanta, GA.\r\nState of Incorporation: Georgia, USA.\r\n\r\n<strong>Disclaimer</strong>\r\n\r\n<strong>Contents of the Website</strong>\r\n\r\nArrayFire makes every effort to ensure that the material contained in its web site is current, complete and correct. Despite this errors and mistakes cannot be completely ruled out. ArrayFire does not accept liability for the relevance, accuracy or completeness of the information and material offered in its website unless the mistake occurred intentionally or through gross negligence. This refers to any loss, additional costs or damage of any kind suffered as a result of any use of any material in this website.\r\n\r\n<strong>Copyright</strong>\r\n\r\nThe Layout of the Homepage, graphics and pictures used and the collection of individual contributions are protected by copyright. ArrayFire reserves all rights including the rights of reproduction, the duplication and distribution via special processes.\r\n\r\n<strong>Trademarks</strong>\r\n\r\nThe following are either registered trademarks or trademarks of the named company in the United States, United Kingdom and/or other countries.\r\n\r\n\"Personal Supercomputing\" - AccelerEyes LLC.\r\n\"Simple Software for Powerful Visual Computing\" - AccelerEyes LLC.\r\n\"AccelerEyes\", the AccelerEyes logo - AccelerEyes LLC.\r\n\"Jacket\", \"LibJacket\", \"ArrayFire\", and their respective logos - AccelerEyes LLC.\r\nthe NVIDIA logo - NVIDIA.\r\n\"Windows\" - Microsoft Corporation.\r\n\"OpenCL\" - Apple.\r\n\"Adobe\" and \"Acrobat\" - Adobe Systems Inc.\r\nAerospace Blockset™, Bioinformatics Toolbox™, Communications Blockset™, Communications Toolbox™, Control System Toolbox™, Curve Fitting Toolbox™, Data Acquisition Toolbox™, Database Toolbox™, Datafeed Toolbox™, Econometrics Toolbox™, EDA Simulator Link™, Embedded IDE Link™, Embedded MATLAB®, Extended Symbolic Math Toolbox™, Filter Design HDL Coder™, Filter Design Toolbox™, Financial Derivatives Toolbox™, Financial Toolbox™, Fixed-Income Toolbox™, Fixed-Point Toolbox™, Fuzzy Logic Toolbox™, GARCH Toolbox™, Gauges Blockset™, Genetic Algorithm and Direct Search Toolbox™, Handle Graphics®, Image Acquisition Toolbox™, Image Processing Toolbox™, Instrument Control Toolbox™, L-shaped membrane logo (graphic only)®, Mapping Toolbox™, MathWorks®, MATLAB®, MATLAB® Builder™ EX, MATLAB® Builder™ JA, MATLAB® Builder™ NE, MATLAB® Compiler™, MATLAB® Connector™, MATLAB® Distributed Computing Server™, MATLAB® Mobile™, MATLAB® Report Generator™, Model Predictive Control Toolbox™, Model-Based Calibration Toolbox™, Neural Network Toolbox™, OPC Toolbox™, Optimization Toolbox™, Parallel Computing Toolbox™, Partial Differential Equation Toolbox™, Polyspace®, Polyspace® Client™ for Ada, Polyspace® Client™ for C/C++, Polyspace® Model Link™ SL, Polyspace® Model Link™ TL, Polyspace® Server™ for Ada, Polyspace® Server™ for C/C++, Polyspace® UML Link™ RH, Real-Time Windows Target™, Real-Time Workshop®, Real-Time Workshop® Embedded Coder™, RF Blockset™, RF Toolbox™, Robust Control Toolbox™, Signal Processing Blockset™, Signal Processing Toolbox™, SimBiology®, SimDriveline™, SimElectronics®, SimEvents®, SimHydraulics®, SimMechanics™, SimPowerSystems™, SimRF™, Simscape™, Simulink®, Simulink® 3D Animation™, Simulink® Accelerator™, Simulink® Control Design™, Simulink® Design Optimization™, Simulink® Design Verifier™, Simulink® Fixed Point™, Simulink® HDL Coder™, Simulink® Parameter Estimation™, Simulink® PLC Coder™, Simulink® Report Generator™, Simulink® Response Optimization™, Simulink® Verification and Validation™, Spline Toolbox™, Spreadsheet Link™ EX, Stateflow®, Stateflow® Coder™, Statistics Toolbox™, Symbolic Math Toolbox™, System Identification Toolbox™, SystemTest™, Target Support Package™, Vehicle Network Toolbox™, Video and Image Processing Blockset™, Virtual Reality Toolbox™, Wavelet Toolbox™, xPC Target™, xPC TargetBox™, xPC Target™ Embedded Option™ - The MathWorks, Inc.\r\n\r\nIf you notice the use of a trademark on this site which is not accredited herein, please contact our Marketing Department at <a href=\"mailto:sales@arrayfire.com\">sales@arrayfire.com</a>.\r\n\r\n<strong>Links to Third Party Information</strong>\r\n\r\nThe ArrayFire website links to third party information providers. ArrayFire has no influence on the contents or reliability of the websites of these third party information providers. The following therefore applies to all links:\r\n\r\nArrayFire has no influence on the design and contents of third party internet websites. ArrayFire therefore expressly distances itself from the material of all third party internet websites, even if the ArrayFire website links to these external sites. The declaration is valid for all links given on our website and the material of all sites reached via links on the ArrayFire website. Privacy Where you are invited to submit personal information (eMail address, names, postal addresses) the submission of this information is purely voluntary.\r\n\r\n<strong>Legal validity</strong>\r\n\r\nThis general disclaimer is part of the material offered on the ArrayFire website. If any of the terms and conditions should be determined invalid by reason of the relevant laws then the remaining terms and conditions shall remain in full effect.[/content_band]\r\n<h3></h3>','Legal','','inherit','closed','closed','','319-revision-v1','','','2016-07-13 09:14:51','2016-07-13 13:14:51','',319,'http://sandbox.arrayfire.com/319-revision-v1/',0,'revision','',0),(9008,18528,'2016-07-13 15:22:28','2016-07-13 19:22:28','We provide two methods for you to install the ArrayFire Library. You may either download pre-built installers or compile the library from source.\r\n<h4>Traditional Installation Method</h4>\r\nOur installers are pre-built packages for Windows, Mac OSX, and Linux. Here are a few benefits of the installers:\r\n<ul>\r\n 	<li>Fastest installation method for Windows, Mac, and Linux platforms</li>\r\n 	<li>Pre-configured with CPU, OpenCL, and CUDA backends</li>\r\n 	<li>Forge Visualization library built-in</li>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n</ul>\r\n[column type=\"one-half\"] [button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"https://sandbox.arrayfire.com/login/?redirect_to=https%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button] [/column]\r\n[column type=\"one-half\"]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"https://www.sandbox.arrayfire.com/register?redirect_to=https%3A%2F%2Farrayfire.com%2Fdownload-wait\" size=\"regular\" ]Register[/button]\r\n[/column]\r\n\r\n[gap size=\"9%\"]\r\n<h4>Build from Source</h4>\r\nArrayFire\'s source code is distributed on GitHub where you can also find full build and installation instructions for Windows, Mac OSX, and Linux. Please be aware that an initial checkout and build of ArrayFire from source can take in excess of 40 minutes on modern quad-core processor.\r\n\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Download and Compile from Source[/button]','Download Splash','','publish','closed','closed','','download-splash','','','2017-01-02 14:59:40','2017-01-02 19:59:40','',0,'http://sandbox.arrayfire.com/?page_id=9008',0,'page','',0),(9009,18528,'2016-07-13 10:33:31','2016-07-13 14:33:31','&nbsp;\r\n\r\n&nbsp;','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 10:33:31','2016-07-13 14:33:31','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9010,18528,'2016-07-13 10:39:18','2016-07-13 14:39:18','&nbsp;\r\n\r\n[column type=\"one-third\"][button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button][/column]\r\n[column type=\"one-third\"][button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button][/column]\r\n[column type=\"one-third\" last=\"true\"][button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button][/column]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 10:39:18','2016-07-13 14:39:18','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9011,18528,'2016-07-13 11:17:58','2016-07-13 15:17:58','[column type=\"two-third\"]text here[/column]\r\n\r\n[column type=\"one-third\"]open source[/column]\r\n\r\n[column type=\"one-third\"][button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button][/column]\r\n[column type=\"one-third\"][button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button][/column]\r\n[column type=\"one-third\" last=\"true\"][button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button][/column]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:17:58','2016-07-13 15:17:58','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9012,18528,'2016-07-13 11:18:22','2016-07-13 15:18:22','[column type=\"two-third\"]text here[/column]\r\n\r\n[column type=\"one-third\"]open source[/column]\r\n\r\n[gap size=\"9%\"]\r\n\r\n[column type=\"one-third\"][button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button][/column]\r\n[column type=\"one-third\"][button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button][/column]\r\n[column type=\"one-third\" last=\"true\"][button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button][/column]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:18:22','2016-07-13 15:18:22','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9013,18528,'2016-07-13 11:21:25','2016-07-13 15:21:25','[column type=\"two-third\"]\r\n<h4>Binary Installers</h4>\r\nWe provide binary installers for Windows, Mac OSX, and Linux platforms. These\r\n<ul>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Pre-packaged installation</li>\r\n</ul>\r\n[/column]\r\n\r\n[column type=\"one-third\"]\r\n<h4>Open Source</h4>\r\n<ul>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n 	<li></li>\r\n</ul>\r\n[/column]\r\n\r\n[gap size=\"9%\"]\r\n\r\n[column type=\"one-third\"][button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button][/column]\r\n[column type=\"one-third\"][button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button][/column]\r\n[column type=\"one-third\" last=\"true\"][button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button][/column]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:21:25','2016-07-13 15:21:25','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9014,18528,'2016-07-13 11:22:26','2016-07-13 15:22:26','[column type=\"two-third\"]\r\n<h4>Binary Installers</h4>\r\nWe provide binary installers for Windows, Mac OSX, and Linux platforms. These\r\n<ul>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Pre-packaged installation</li>\r\n</ul>\r\n[column type=\"one-third\"][button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button][/column]\r\n[column type=\"one-third\"][button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button][/column]\r\n\r\n[/column]\r\n\r\n[column type=\"one-third\"]\r\n<h4>Open Source</h4>\r\n<ul>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]\r\n\r\n[/column]\r\n\r\n[gap size=\"9%\"]\r\n\r\n&nbsp;','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:22:26','2016-07-13 15:22:26','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9015,18528,'2016-07-13 11:22:42','2016-07-13 15:22:42','[column type=\"two-third\"]\r\n<h4>Binary Installers</h4>\r\nWe provide binary installers for Windows, Mac OSX, and Linux platforms. These\r\n<ul>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Pre-packaged installation</li>\r\n</ul>\r\n[button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button]\r\n\r\n[/column]\r\n\r\n[column type=\"one-third\"]\r\n<h4>Open Source</h4>\r\n<ul>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]\r\n\r\n[/column]\r\n\r\n[gap size=\"9%\"]\r\n\r\n&nbsp;','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:22:42','2016-07-13 15:22:42','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9016,18528,'2016-07-13 11:23:05','2016-07-13 15:23:05','[column type=\"two-third\"]\r\n\r\nBinary Installers\r\n\r\nWe provide binary installers for Windows, Mac OSX, and Linux platforms. These\r\n<ul>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Pre-packaged installation</li>\r\n</ul>\r\n[button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button]\r\n\r\n[/column][column type=\"one-third\"]\r\n\r\nOpen Source\r\n<ul>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]\r\n\r\n[/column]\r\n\r\n[gap size=\"9%\"]\r\n\r\n&nbsp;','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:23:05','2016-07-13 15:23:05','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9017,18528,'2016-07-13 11:24:32','2016-07-13 15:24:32','<div style=\"width:60%;padding:0 10px 0 0;float:left;\">\r\n\r\n\r\nWe provide binary installers for Windows, Mac OSX, and Linux platforms. These\r\n<ul>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Pre-packaged installation</li>\r\n</ul>\r\n[button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button]\r\n\r\n</div>\r\n<div style=\"width:40%;padding:0 10px 0 0;float:left;\">\r\n\r\n\r\nOpen Source\r\n<ul>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]\r\n\r\n</div>','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:24:32','2016-07-13 15:24:32','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9018,18528,'2016-07-13 11:25:04','2016-07-13 15:25:04','<div style=\"width:60%;padding:0 10px 0 0;float:left;\">\r\n\r\n\r\nWe provide binary installers for Windows, Mac OSX, and Linux platforms. These\r\n<ul>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Pre-packaged installation</li>\r\n</ul>\r\n\r\n<div style=\"width:40%;padding:0 10px 0 0;float:left;\">\r\n\r\n[button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button]\r\n</div>\r\n<div style=\"width:40%;padding:0 10px 0 0;float:left;\">\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button]\r\n</div>\r\n\r\n</div>\r\n<div style=\"width:40%;padding:0 10px 0 0;float:left;\">\r\n\r\n\r\nOpen Source\r\n<ul>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]\r\n\r\n</div>','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:25:04','2016-07-13 15:25:04','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9019,18528,'2016-07-13 11:26:12','2016-07-13 15:26:12','<div style=\"width:60%;padding:0 10px 0 0;float:left;\">\r\nBinary Installers\r\n\r\nWe provide binary installers for Windows, Mac OSX, and Linux platforms. These\r\n<ul>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Pre-packaged installation</li>\r\n</ul>\r\n\r\n<div style=\"width:40%;padding:0 10px 0 0;float:left;\">\r\n\r\n[button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login[/button]\r\n</div>\r\n<div style=\"width:40%;padding:0 10px 0 0;float:left;\">\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button]\r\n</div>\r\n\r\n</div>\r\n<div style=\"width:40%;padding:0 10px 0 0;float:left;\">\r\nOpen Source\r\n\r\n<ul>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]\r\n\r\n</div>','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:26:12','2016-07-13 15:26:12','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9020,18528,'2016-07-13 11:28:54','2016-07-13 15:28:54','[column type=\"two-third\"]Binary Installers\r\n\r\nWe provide binary installers for Windows, Mac OSX, and Linux platforms. These\r\n<ul>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Pre-packaged installation</li>\r\n</ul>\r\n[button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button]\r\n\r\n[/column][column type=\"one-third\"]\r\n\r\nOpen Source\r\n<ul>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]\r\n\r\n[/column]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:28:54','2016-07-13 15:28:54','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9021,18528,'2016-07-13 11:29:29','2016-07-13 15:29:29','[column type=\"one-third\"]Binary Installers\r\n\r\nWe provide binary installers for Windows, Mac OSX, and Linux platforms. These\r\n<ul>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Pre-packaged installation</li>\r\n</ul>\r\n[button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button]\r\n\r\n[/column][column type=\"one-third\"]\r\n\r\nOpen Source\r\n<ul>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]\r\n\r\n[/column]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:29:29','2016-07-13 15:29:29','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9022,18528,'2016-07-13 11:29:58','2016-07-13 15:29:58','[column type=\"two-third\"]Binary Installers\r\n\r\nWe provide binary installers for Windows, Mac OSX, and Linux platforms. These\r\n<ul>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Pre-packaged installation</li>\r\n</ul>\r\n[button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button]\r\n\r\n[/column][column type=\"one-third\"]\r\n\r\nOpen Source\r\n<ul>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]\r\n\r\n[/column]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:29:58','2016-07-13 15:29:58','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9023,18528,'2016-07-13 11:30:18','2016-07-13 15:30:18','[column type=\"half\"]Binary Installers\r\n\r\nWe provide binary installers for Windows, Mac OSX, and Linux platforms. These\r\n<ul>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Pre-packaged installation</li>\r\n</ul>\r\n[button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button]\r\n\r\n[/column][column type=\"half\"]\r\n\r\nOpen Source\r\n<ul>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]\r\n\r\n[/column]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:30:18','2016-07-13 15:30:18','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9024,18528,'2016-07-13 11:34:24','2016-07-13 15:34:24','<h4>Binary Installers</h4>\r\nWe provide binary installers for Windows, Mac OSX, and Linux platforms. These\r\n<ul>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Pre-packaged installation</li>\r\n</ul>\r\n[button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button]\r\n\r\n&nbsp;\r\n<h4>Open Source</h4>\r\n<ul>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:34:24','2016-07-13 15:34:24','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9025,18528,'2016-07-13 11:35:18','2016-07-13 15:35:18','<h4>Binary Installers</h4>\r\nWe provide binary installers for Windows, Mac OSX, and Linux platforms. These\r\n<ul>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Pre-packaged installation</li>\r\n</ul>\r\n[column type=\"one-half\"] [button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button] [/column]\r\n[column type=\"one-half\"]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button]\r\n[/column]\r\n\r\n&nbsp;\r\n<h4>Open Source</h4>\r\n<ul>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 11:35:18','2016-07-13 15:35:18','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9026,18528,'2016-07-13 14:49:39','2016-07-13 18:49:39','We provide two methods for you to install the ArrayFire Library, the first are pre-built installers, the second of which is compilation from source. We explain the benefits\r\n<h4>Binary Installers</h4>\r\nThese are pre-built installation packages for Windows, Mac OSX, and Linux which we have assembled and si\r\n<ul>\r\n 	<li>Pre-built installation packages for Windows, Mac OSX, and Linux</li>\r\n 	<li>Windows and OSX images are cryptographically signed.</li>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n 	<li>Bugfix and release notifications via. email.</li>\r\n</ul>\r\n[column type=\"one-half\"] [button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button] [/column]\r\n[column type=\"one-half\"]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button]\r\n[/column]\r\n<h4>Open Source</h4>\r\n<ul>\r\n 	<li>You have access to all of the source code</li>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 14:49:39','2016-07-13 18:49:39','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9027,18528,'2016-07-13 15:02:14','2016-07-13 19:02:14','We provide two methods for you to install the ArrayFire Library. You may either download pre-built installers or compile the library from source.\r\n<h4>Binary Installers</h4>\r\nOur installers are pre-built packages for Windows, Mac OSX, and Linux. Downloading our installers requires registration because most of our grant funding agencies require that we quantify our impact to the computing community annually. We will use your contact information to email you shortly after you download the library to see if you need any help and then again whenever there are new releases of the library.\r\n\r\nHere are a few benefits of the installers:\r\n<ul>\r\n 	<li>Fastest installation method for Windows, Mac, and Linux platforms</li>\r\n 	<li>Pre-configured with CPU, OpenCL, and CUDA backends</li>\r\n 	<li>Forge Visualization library built-in</li>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n</ul>\r\n[column type=\"one-half\"] [button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button] [/column]\r\n[column type=\"one-half\"]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register\" size=\"regular\" ]Register[/button]\r\n[/column]\r\n<h4>Open Source</h4>\r\n<ul>\r\n 	<li>You have access to all of the source code</li>\r\n 	<li>You have to compile it (~1 hour for CPU, CUDA, and OpenCL backends)</li>\r\n</ul>\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 15:02:14','2016-07-13 19:02:14','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9028,18528,'2016-07-13 15:12:58','2016-07-13 19:12:58','We provide two methods for you to install the ArrayFire Library. You may either download pre-built installers or compile the library from source.\r\n<h4>Traditional Installation Method</h4>\r\nOur installers are pre-built packages for Windows, Mac OSX, and Linux. Downloading our installers requires registration because most of our grant funding agencies require that we quantify our impact to the computing community annually. We will use your contact information to email you shortly after you download the library to see if you need any help and then again whenever there are new releases of the library.\r\n\r\nHere are a few benefits of the installers:\r\n<ul>\r\n 	<li>Fastest installation method for Windows, Mac, and Linux platforms</li>\r\n 	<li>Pre-configured with CPU, OpenCL, and CUDA backends</li>\r\n 	<li>Forge Visualization library built-in</li>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n</ul>\r\n[column type=\"one-half\"] [button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button] [/column]\r\n[column type=\"one-half\"]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Register[/button]\r\n[/column]\r\n<h4>Build from Source</h4>\r\nIf you are a developer who wants to contribute to ArrayFire, a programmer who must have the latest features, or a package maintainer who wants to ship ArrayFire as part of your favorite operating system, this is the method for you. ArrayFire\'s source code is distributed on GitHub where you can also find full build and installation instructions for Windows, Mac OSX, and Linux.\r\n\r\nAlthough we fully encourage everyone to get involved with ArrayFire through GitHub, please be aware that an initial checkout and build of ArrayFire from source can take in excess of 40 minutes on modern quad-core processor.\r\n\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 15:12:58','2016-07-13 19:12:58','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9029,18528,'2016-07-13 15:13:13','2016-07-13 19:13:13','We provide two methods for you to install the ArrayFire Library. You may either download pre-built installers or compile the library from source.\r\n<h4>Traditional Installation Method</h4>\r\nOur installers are pre-built packages for Windows, Mac OSX, and Linux. Downloading our installers requires registration because most of our grant funding agencies require that we quantify our impact to the computing community annually. We will use your contact information to email you shortly after you download the library to see if you need any help and then again whenever there are new releases of the library.\r\n\r\nHere are a few benefits of the installers:\r\n<ul>\r\n 	<li>Fastest installation method for Windows, Mac, and Linux platforms</li>\r\n 	<li>Pre-configured with CPU, OpenCL, and CUDA backends</li>\r\n 	<li>Forge Visualization library built-in</li>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n</ul>\r\n[column type=\"one-half\"] [button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button] [/column]\r\n[column type=\"one-half\"]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Register[/button]\r\n[/column]\r\n\r\n[gap size=\"9%\"]\r\n<h4>Build from Source</h4>\r\nIf you are a developer who wants to contribute to ArrayFire, a programmer who must have the latest features, or a package maintainer who wants to ship ArrayFire as part of your favorite operating system, this is the method for you. ArrayFire\'s source code is distributed on GitHub where you can also find full build and installation instructions for Windows, Mac OSX, and Linux.\r\n\r\nAlthough we fully encourage everyone to get involved with ArrayFire through GitHub, please be aware that an initial checkout and build of ArrayFire from source can take in excess of 40 minutes on modern quad-core processor.\r\n\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Compile from source[/button]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 15:13:13','2016-07-13 19:13:13','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9030,18528,'2016-07-13 15:13:36','2016-07-13 19:13:36','We provide two methods for you to install the ArrayFire Library. You may either download pre-built installers or compile the library from source.\r\n<h4>Traditional Installation Method</h4>\r\nOur installers are pre-built packages for Windows, Mac OSX, and Linux. Downloading our installers requires registration because most of our grant funding agencies require that we quantify our impact to the computing community annually. We will use your contact information to email you shortly after you download the library to see if you need any help and then again whenever there are new releases of the library.\r\n\r\nHere are a few benefits of the installers:\r\n<ul>\r\n 	<li>Fastest installation method for Windows, Mac, and Linux platforms</li>\r\n 	<li>Pre-configured with CPU, OpenCL, and CUDA backends</li>\r\n 	<li>Forge Visualization library built-in</li>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n</ul>\r\n[column type=\"one-half\"] [button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button] [/column]\r\n[column type=\"one-half\"]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Register[/button]\r\n[/column]\r\n\r\n[gap size=\"9%\"]\r\n<h4>Build from Source</h4>\r\nIf you are a developer who wants to contribute to ArrayFire, a programmer who must have the latest features, or a package maintainer who wants to ship ArrayFire as part of your favorite operating system, this is the method for you. ArrayFire\'s source code is distributed on GitHub where you can also find full build and installation instructions for Windows, Mac OSX, and Linux.\r\n\r\nAlthough we fully encourage everyone to get involved with ArrayFire through GitHub, please be aware that an initial checkout and build of ArrayFire from source can take in excess of 40 minutes on modern quad-core processor.\r\n\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Download and Compile from Source[/button]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 15:13:36','2016-07-13 19:13:36','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9032,18528,'2016-07-13 15:17:01','2016-07-13 19:17:01','We provide two methods for you to install the ArrayFire Library. You may either download pre-built installers or compile the library from source.\r\n<h4>Traditional Installation Method</h4>\r\nOur installers are pre-built packages for Windows, Mac OSX, and Linux. Here are a few benefits of the installers:\r\n<ul>\r\n 	<li>Fastest installation method for Windows, Mac, and Linux platforms</li>\r\n 	<li>Pre-configured with CPU, OpenCL, and CUDA backends</li>\r\n 	<li>Forge Visualization library built-in</li>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n</ul>\r\n[column type=\"one-half\"] [button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button] [/column]\r\n[column type=\"one-half\"]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Register[/button]\r\n[/column]\r\n\r\n[gap size=\"9%\"]\r\n<h4>Build from Source</h4>\r\nIf you are a developer who wants to contribute to ArrayFire, a programmer who must have the latest features, or a package maintainer who wants to ship ArrayFire as part of your favorite operating system, this is the method for you. ArrayFire\'s source code is distributed on GitHub where you can also find full build and installation instructions for Windows, Mac OSX, and Linux.\r\n\r\nAlthough we fully encourage everyone to get involved with ArrayFire through GitHub, please be aware that an initial checkout and build of ArrayFire from source can take in excess of 40 minutes on modern quad-core processor.\r\n\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Download and Compile from Source[/button]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 15:17:01','2016-07-13 19:17:01','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9033,18528,'2016-07-13 15:19:58','2016-07-13 19:19:58','We provide two methods for you to install the ArrayFire Library. You may either download pre-built installers or compile the library from source.\r\n<h4>Traditional Installation Method</h4>\r\nOur installers are pre-built packages for Windows, Mac OSX, and Linux. Here are a few benefits of the installers:\r\n<ul>\r\n 	<li>Fastest installation method for Windows, Mac, and Linux platforms</li>\r\n 	<li>Pre-configured with CPU, OpenCL, and CUDA backends</li>\r\n 	<li>Forge Visualization library built-in</li>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n</ul>\r\n[column type=\"one-half\"] [button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button] [/column]\r\n[column type=\"one-half\"]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Register[/button]\r\n[/column]\r\n\r\n[gap size=\"9%\"]\r\n<h4>Build from Source</h4>\r\nArrayFire\'s source code is distributed on GitHub where you can also find full build and installation instructions for Windows, Mac OSX, and Linux.\r\n\r\nAlthough we fully encourage everyone to get involved with ArrayFire through GitHub, please be aware that an initial checkout and build of ArrayFire from source can take in excess of 40 minutes on modern quad-core processor.\r\n\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Download and Compile from Source[/button]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 15:19:58','2016-07-13 19:19:58','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9034,18528,'2016-07-13 15:20:35','2016-07-13 19:20:35','We provide two methods for you to install the ArrayFire Library. You may either download pre-built installers or compile the library from source.\r\n<h4>Traditional Installation Method</h4>\r\nOur installers are pre-built packages for Windows, Mac OSX, and Linux. Here are a few benefits of the installers:\r\n<ul>\r\n 	<li>Fastest installation method for Windows, Mac, and Linux platforms</li>\r\n 	<li>Pre-configured with CPU, OpenCL, and CUDA backends</li>\r\n 	<li>Forge Visualization library built-in</li>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n</ul>\r\n[column type=\"one-half\"] [button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button] [/column]\r\n[column type=\"one-half\"]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Register[/button]\r\n[/column]\r\n\r\n[gap size=\"9%\"]\r\n<h4>Build from Source</h4>\r\nArrayFire\'s source code is distributed on GitHub where you can also find full build and installation instructions for Windows, Mac OSX, and Linux. Please be aware that an initial checkout and build of ArrayFire from source can take in excess of 40 minutes on modern quad-core processor.\r\n\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Download and Compile from Source[/button]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 15:20:35','2016-07-13 19:20:35','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9035,18528,'2016-07-13 16:00:56','2016-07-13 20:00:56','We provide two methods for you to install the ArrayFire Library. You may either download pre-built installers or compile the library from source.\r\n<h4>Traditional Installation Method</h4>\r\nOur installers are pre-built packages for Windows, Mac OSX, and Linux. Here are a few benefits of the installers:\r\n<ul>\r\n 	<li>Fastest installation method for Windows, Mac, and Linux platforms</li>\r\n 	<li>Pre-configured with CPU, OpenCL, and CUDA backends</li>\r\n 	<li>Forge Visualization library built-in</li>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n</ul>\r\n[column type=\"one-half\"] [button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button] [/column]\r\n[column type=\"one-half\"]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register?redirect_to=http%3A%2F%2Farrayfire.com%2Flogin\" size=\"regular\" ]Register[/button]\r\n[/column]\r\n\r\n[gap size=\"9%\"]\r\n<h4>Build from Source</h4>\r\nArrayFire\'s source code is distributed on GitHub where you can also find full build and installation instructions for Windows, Mac OSX, and Linux. Please be aware that an initial checkout and build of ArrayFire from source can take in excess of 40 minutes on modern quad-core processor.\r\n\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Download and Compile from Source[/button]','Download','','inherit','closed','closed','','9008-revision-v1','','','2016-07-13 16:00:56','2016-07-13 20:00:56','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9037,18528,'2016-07-14 10:43:58','2016-07-14 14:43:58','We provide two methods for you to install the ArrayFire Library. You may either download pre-built installers or compile the library from source.\r\n<h4>Traditional Installation Method</h4>\r\nOur installers are pre-built packages for Windows, Mac OSX, and Linux. Here are a few benefits of the installers:\r\n<ul>\r\n 	<li>Fastest installation method for Windows, Mac, and Linux platforms</li>\r\n 	<li>Pre-configured with CPU, OpenCL, and CUDA backends</li>\r\n 	<li>Forge Visualization library built-in</li>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n</ul>\r\n[column type=\"one-half\"] [button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button] [/column]\r\n[column type=\"one-half\"]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register?redirect_to=http%3A%2F%2Farrayfire.com%2Flogin\" size=\"regular\" ]Register[/button]\r\n[/column]\r\n\r\n[gap size=\"9%\"]\r\n<h4>Build from Source</h4>\r\nArrayFire\'s source code is distributed on GitHub where you can also find full build and installation instructions for Windows, Mac OSX, and Linux. Please be aware that an initial checkout and build of ArrayFire from source can take in excess of 40 minutes on modern quad-core processor.\r\n\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Download and Compile from Source[/button]','Download Splash','','inherit','closed','closed','','9008-revision-v1','','','2016-07-14 10:43:58','2016-07-14 14:43:58','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9038,18528,'2016-07-14 10:44:21','2016-07-14 14:44:21','We provide two methods for you to install the ArrayFire Library. You may either download pre-built installers or compile the library from source.\r\n<h4>Traditional Installation Method</h4>\r\nOur installers are pre-built packages for Windows, Mac OSX, and Linux. Here are a few benefits of the installers:\r\n<ul>\r\n 	<li>Fastest installation method for Windows, Mac, and Linux platforms</li>\r\n 	<li>Pre-configured with CPU, OpenCL, and CUDA backends</li>\r\n 	<li>Forge Visualization library built-in</li>\r\n 	<li>Includes Intel Math Kernel Library to accelerate CPU-bound tasks</li>\r\n</ul>\r\n[column type=\"one-half\"] [button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/login/?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload\" size=\"regular\" ]Login to Download[/button] [/column]\r\n[column type=\"one-half\"]\r\n[button  block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://www.sandbox.arrayfire.com/register?redirect_to=http%3A%2F%2Farrayfire.com%2Fdownload-wait\" size=\"regular\" ]Register[/button]\r\n[/column]\r\n\r\n[gap size=\"9%\"]\r\n<h4>Build from Source</h4>\r\nArrayFire\'s source code is distributed on GitHub where you can also find full build and installation instructions for Windows, Mac OSX, and Linux. Please be aware that an initial checkout and build of ArrayFire from source can take in excess of 40 minutes on modern quad-core processor.\r\n\r\n[button block=\"true\"  type=\"flat\"  shape=\"rounded\" href=\"https://github.com/arrayfire/arrayfire\" size=\"regular\" ]Download and Compile from Source[/button]','Download Splash','','inherit','closed','closed','','9008-revision-v1','','','2016-07-14 10:44:21','2016-07-14 14:44:21','',9008,'http://sandbox.arrayfire.com/9008-revision-v1/',0,'revision','',0),(9039,18528,'2016-07-14 10:49:45','2016-07-14 14:49:45','Thank you for registering!  Please confirm your email by clicking the link in the email.\r\n\r\n[button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"https://sandbox.arrayfire.com/download\" size=\"regular\" ]Confirm your email, login, then click here to continue[/button]','Download Wait','','publish','closed','closed','','download-wait','','','2017-01-02 15:00:05','2017-01-02 20:00:05','',0,'http://sandbox.arrayfire.com/?page_id=9039',0,'page','',0),(9040,18528,'2016-07-14 10:49:45','2016-07-14 14:49:45','Thank you for registering.  Please check your email for the confirmation email.','Download Wait','','inherit','closed','closed','','9039-revision-v1','','','2016-07-14 10:49:45','2016-07-14 14:49:45','',9039,'http://sandbox.arrayfire.com/9039-revision-v1/',0,'revision','',0),(9041,18528,'2016-07-14 10:50:49','2016-07-14 14:50:49','Thank you for registering!  Please confirm your email by clicking the link in the email.\n\n&nbsp;','Download Wait','','inherit','closed','closed','','9039-autosave-v1','','','2016-07-14 10:50:49','2016-07-14 14:50:49','',9039,'http://sandbox.arrayfire.com/9039-autosave-v1/',0,'revision','',0),(9042,18528,'2016-07-14 10:51:26','2016-07-14 14:51:26','Thank you for registering!  Please confirm your email by clicking the link in the email.\r\n\r\n[button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/download\" size=\"regular\" ]Confirm your email, then click here to continue[/button]','Download Wait','','inherit','closed','closed','','9039-revision-v1','','','2016-07-14 10:51:26','2016-07-14 14:51:26','',9039,'http://sandbox.arrayfire.com/9039-revision-v1/',0,'revision','',0),(9043,18528,'2016-07-14 11:00:43','2016-07-14 15:00:43','Thank you for registering!  Please confirm your email by clicking the link in the email.\r\n\r\n[button block=\"true\" type=\"flat\"  shape=\"rounded\" href=\"http://sandbox.arrayfire.com/download\" size=\"regular\" ]Confirm your email, login, then click here to continue[/button]','Download Wait','','inherit','closed','closed','','9039-revision-v1','','','2016-07-14 11:00:43','2016-07-14 15:00:43','',9039,'http://sandbox.arrayfire.com/9039-revision-v1/',0,'revision','',0),(9044,18528,'2016-07-15 08:38:41','2016-07-15 12:38:41','The ArrayFire library is our flagship product. It is a general-purpose computational tool that simplifies the process of developing software that targets parallel and massively-parallel architectures including CPUs, GPUs, and other hardware acceleration devices. ArrayFire provides software developers with a high-level abstraction of data which resides on the accelerator, the <code>af::array</code> object (or C-style struct). Developers write code which performs operations on ArrayFire arrays which, in turn, are automatically translated into near-optimal kernels that execute on the computational device. ArrayFire includes support for supports CPUs from all major vendors (Intel, AMD, Arm), GPUs from the dominant manufacturers (NVIDIA, AMD, and Qualcomm), as well as a variety of other accelerator devices. ArrayFire has been used successfully on devices ranging from low-power mobile phones to high-power GPU-enabled supercomputers.\r\n\r\nSeveral of ArrayFire\'s benefits include:\r\n<ul>\r\n 	<li>Commercially Friendly Open-Source Licensing: ArrayFire uses a BSD 3-clause license which permits you to use it in commercial and non-commercial software with only one catch: you must include our copyright statement and license document with your code.</li>\r\n 	<li>Tested Computational Accuracy: Every modification of ArrayFire\'s source code is evaluated by our extensive unit testing framework. If the changes cause a test to fail, the modifications are not accepted until all tests pass.</li>\r\n 	<li>Agressive Performance Evaluation: The computational throughput of almost every function in ArrayFire is tested prior to each release using our own <a href=\"https://github.com/bkloppenborg/arrayfire-benchmark\">benchmarking software</a>. Our benchmarking process includes new and legacy hardware from all major manufacturers installed in systems running Windows, Mac OSX, and Linux operating systems. We routinely <a href=\"http://sandbox.arrayfire.com/blog\">blog about our results</a>, discuss how <a href=\"http://sandbox.arrayfire.com/benchmarking-parallel-vector-libraries/\">our software compares to competing products</a>, and offer data which justifies how our<a href=\"http://sandbox.arrayfire.com/performance-of-arrayfire-jit-code-generation/\">unique approach to kernel generation</a> offers better performance than traditional methods of accelerated computing.</li>\r\n 	<li>Cross platform compatibility: ArrayFire works with <strong>CUDA</strong>, <strong>OpenCL</strong> and even native <strong>CPU</strong> on Windows, Mac, and Linux.</li>\r\n 	<li>Unencumbered interoperability with CUDA, OpenCL, and OpenGL: ArrayFire provides direct access to CUDA device pointers and OpenCL memory buffers, thus you can mix and match <a href=\"http://sandbox.arrayfire.com/arrayfire-cuda-interoperability/\">ArrayFire with CUDA</a> or <a href=\"http://sandbox.arrayfire.com/arrayfire-opencl-interoperability/\">ArrayFire with OpenCL</a>. Using similar techniques you can easily share data between ArrayFire and OpenGL.</li>\r\n 	<li>Develop in your favorite language: Although ArrayFire is a C/C++ library, we have developed wrappers for a variety of languages including: <a href=\"https://github.com/arrayfire/arrayfire-rust\">Rust</a>, <a href=\"https://github.com/arrayfire/arrayfire-dotnet\">.NET</a>, <a href=\"https://github.com/arrayfire/arrayfire-java\">Java</a>, <a href=\"https://github.com/arrayfire/arrayfire-r\">R</a>, <a href=\"https://github.com/arrayfire/arrayfire-go\">Go</a>, <a href=\"https://github.com/arrayfire/arrayfire-js\">Node.js / Javascript</a>, <a href=\"https://github.com/arrayfire/arrayfire-lua\">Lua</a>, and <a href=\"https://github.com/arrayfire/arrayfire-fortran\">Fortran</a>. In addition to our work, the broader ArrayFire community has written wrappers for several other languages. Chances are support for your most beloved language is only a quick Google search away!</li>\r\n 	<li>Built-in Visualization Functions: Our <a href=\"http://sandbox.arrayfire.com/visualizing-arrays-with-forge/\">Forge</a> library provides a method to view data on the accelerator using 2D or 3D OpenGL-accelerated charts.</li>\r\n 	<li>Project Templates: We have created <a href=\"https://github.com/arrayfire/arrayfire-project-templates\">skeleton projects</a> for development using CMake, Visual Studio, and XCode.</li>\r\n 	<li>Strong Community of Support: We are quite active on <a href=\"https://gitter.im/arrayfire/arrayfire\">Gitter</a>, <a href=\"https://groups.google.com/forum/#!forum/arrayfire-users\">Google Groups</a></li>\r\n 	<li>Backed by a commercial company: Our developers use ArrayFire on a daily basis to <a href=\"http://sandbox.arrayfire.com/consulting\">develop new and accelerate existing applications</a> for commercial, governmental, and academic clients.</li>\r\n 	<li>Open Source and Distributed on GitHub: The ArrayFire library has received contributions from nearly 40 programmers across the globe. The <a href=\"http://github.com/arrayfire/arrayfire\">library is maintained on GitHub</a> with an open issue tracking and reporting policy.</li>\r\n</ul>','The ArrayFire Library','','publish','closed','closed','','the-arrayfire-library','','','2016-07-15 10:57:43','2016-07-15 14:57:43','',0,'http://sandbox.arrayfire.com/?page_id=9044',0,'page','',0),(9045,18528,'2016-07-15 08:38:41','2016-07-15 12:38:41','The ArrayFire library is a general-purpose computational tool that simplifies the process of developing software that targets parallel and massively-parallel architectures including CPUs, GPUs, and other hardware acceleration devices. To achieve this goal, ArrayFire provides software developers with a high-level abstraction of data which resides on the accelerator, the <code>af::array</code> object (or C-style struct). Developers write code which performs operations on ArrayFire arrays which, in turn, are automatically translated into near-optimal kernels that execute on the computational device. ArrayFire includes support for supports CPUs from all major vendors (Intel, AMD, Arm), GPUs from the dominant manufacturers (NVIDIA, AMD, and Qualcomm), as well as a variety of other accelerator devices. ArrayFire has been used successfully on devices ranging from low-power mobile phones to high-power GPU-enabled supercomputers.\r\n\r\nSeveral of ArrayFire\'s benefits include:\r\n<ul>\r\n 	<li>Commercially Friendly Open-Source Licensing: ArrayFire uses a BSD 3-clause license which permits you to use it in commercial and non-commercial software with only one catch: you must include our copyright statement and license document with your code.</li>\r\n 	<li>Tested Computational Accuracy: Every modification of ArrayFire\'s source code is evaluated by our extensive unit testing framework. If the changes cause a test to fail, the modifications are not accepted until all tests pass.</li>\r\n 	<li>Agressive Performance Evaluation: The computational throughput of almost every function in ArrayFire is tested prior to each release using our own <a href=\"https://github.com/bkloppenborg/arrayfire-benchmark\">benchmarking software</a>. Our benchmarking process includes new and legacy hardware from all major manufacturers installed in systems running Windows, Mac OSX, and Linux operating systems. We routinely <a href=\"http://sandbox.arrayfire.com/blog\">blog about our results</a>, discuss how <a href=\"http://sandbox.arrayfire.com/benchmarking-parallel-vector-libraries/\">our software compares to competing products</a>, and offer data which justifies how our<a href=\"http://sandbox.arrayfire.com/performance-of-arrayfire-jit-code-generation/\">unique approach to kernel generation</a> offers better performance than traditional methods of accelerated computing.</li>\r\n 	<li>Cross platform compatibility: ArrayFire works with <strong>CUDA</strong>, <strong>OpenCL</strong> and even native <strong>CPU</strong> on Windows, Mac, and Linux.</li>\r\n 	<li>Unencumbered interoperability with CUDA, OpenCL, and OpenGL: ArrayFire provides direct access to CUDA device pointers and OpenCL memory buffers, thus you can mix and match <a href=\"http://sandbox.arrayfire.com/arrayfire-cuda-interoperability/\">ArrayFire with CUDA</a> or <a href=\"http://sandbox.arrayfire.com/arrayfire-opencl-interoperability/\">ArrayFire with OpenCL</a>. Using similar techniques you can easily share data between ArrayFire and OpenGL.</li>\r\n 	<li>Develop in your favorite language: Although ArrayFire is a C/C++ library, we have developed wrappers for a variety of languages including: <a href=\"https://github.com/arrayfire/arrayfire-rust\">Rust</a>, <a href=\"https://github.com/arrayfire/arrayfire-dotnet\">.NET</a>, <a href=\"https://github.com/arrayfire/arrayfire-java\">Java</a>, <a href=\"https://github.com/arrayfire/arrayfire-r\">R</a>, <a href=\"https://github.com/arrayfire/arrayfire-go\">Go</a>, <a href=\"https://github.com/arrayfire/arrayfire-js\">Node.js / Javascript</a>, <a href=\"https://github.com/arrayfire/arrayfire-lua\">Lua</a>, and <a href=\"https://github.com/arrayfire/arrayfire-fortran\">Fortran</a>. In addition to our work, the broader ArrayFire community has written wrappers for several other languages. Chances are support for your most beloved language is only a quick Google search away!</li>\r\n 	<li>Built-in Visualization Functions: Our <a href=\"http://sandbox.arrayfire.com/visualizing-arrays-with-forge/\">Forge</a> library provides a method to view data on the accelerator using 2D or 3D OpenGL-accelerated charts.</li>\r\n 	<li>Project Templates: We have created <a href=\"https://github.com/arrayfire/arrayfire-project-templates\">skeleton projects</a> for development using CMake, Visual Studio, and XCode.</li>\r\n 	<li>Strong Community of Support: We are quite active on <a href=\"https://gitter.im/arrayfire/arrayfire\">Gitter</a>, <a href=\"https://groups.google.com/forum/#!forum/arrayfire-users\">Google Groups</a></li>\r\n 	<li>Backed by a commercial company: Our developers use ArrayFire on a daily basis to <a href=\"http://sandbox.arrayfire.com/consulting\">develop new and accelerate existing applications</a> for commercial, governmental, and academic clients.</li>\r\n 	<li>Open Source and Distributed on GitHub: The ArrayFire library has received contributions from nearly 40 programmers across the globe. The <a href=\"http://github.com/arrayfire/arrayfire\">library is maintained on GitHub</a> with an open issue tracking and reporting policy.</li>\r\n</ul>','The ArrayFire Library','','inherit','closed','closed','','9044-revision-v1','','','2016-07-15 08:38:41','2016-07-15 12:38:41','',9044,'http://sandbox.arrayfire.com/9044-revision-v1/',0,'revision','',0),(9046,18528,'2016-07-15 10:57:09','2016-07-15 14:57:09','The ArrayFire library is our flagship product. It\n\n&nbsp;\n\na general-purpose computational tool that simplifies the process of developing software that targets parallel and massively-parallel architectures including CPUs, GPUs, and other hardware acceleration devices. To achieve this goal, ArrayFire provides software developers with a high-level abstraction of data which resides on the accelerator, the <code>af::array</code> object (or C-style struct). Developers write code which performs operations on ArrayFire arrays which, in turn, are automatically translated into near-optimal kernels that execute on the computational device. ArrayFire includes support for supports CPUs from all major vendors (Intel, AMD, Arm), GPUs from the dominant manufacturers (NVIDIA, AMD, and Qualcomm), as well as a variety of other accelerator devices. ArrayFire has been used successfully on devices ranging from low-power mobile phones to high-power GPU-enabled supercomputers.\n\nSeveral of ArrayFire\'s benefits include:\n<ul>\n 	<li>Commercially Friendly Open-Source Licensing: ArrayFire uses a BSD 3-clause license which permits you to use it in commercial and non-commercial software with only one catch: you must include our copyright statement and license document with your code.</li>\n 	<li>Tested Computational Accuracy: Every modification of ArrayFire\'s source code is evaluated by our extensive unit testing framework. If the changes cause a test to fail, the modifications are not accepted until all tests pass.</li>\n 	<li>Agressive Performance Evaluation: The computational throughput of almost every function in ArrayFire is tested prior to each release using our own <a href=\"https://github.com/bkloppenborg/arrayfire-benchmark\">benchmarking software</a>. Our benchmarking process includes new and legacy hardware from all major manufacturers installed in systems running Windows, Mac OSX, and Linux operating systems. We routinely <a href=\"http://sandbox.arrayfire.com/blog\">blog about our results</a>, discuss how <a href=\"http://sandbox.arrayfire.com/benchmarking-parallel-vector-libraries/\">our software compares to competing products</a>, and offer data which justifies how our<a href=\"http://sandbox.arrayfire.com/performance-of-arrayfire-jit-code-generation/\">unique approach to kernel generation</a> offers better performance than traditional methods of accelerated computing.</li>\n 	<li>Cross platform compatibility: ArrayFire works with <strong>CUDA</strong>, <strong>OpenCL</strong> and even native <strong>CPU</strong> on Windows, Mac, and Linux.</li>\n 	<li>Unencumbered interoperability with CUDA, OpenCL, and OpenGL: ArrayFire provides direct access to CUDA device pointers and OpenCL memory buffers, thus you can mix and match <a href=\"http://sandbox.arrayfire.com/arrayfire-cuda-interoperability/\">ArrayFire with CUDA</a> or <a href=\"http://sandbox.arrayfire.com/arrayfire-opencl-interoperability/\">ArrayFire with OpenCL</a>. Using similar techniques you can easily share data between ArrayFire and OpenGL.</li>\n 	<li>Develop in your favorite language: Although ArrayFire is a C/C++ library, we have developed wrappers for a variety of languages including: <a href=\"https://github.com/arrayfire/arrayfire-rust\">Rust</a>, <a href=\"https://github.com/arrayfire/arrayfire-dotnet\">.NET</a>, <a href=\"https://github.com/arrayfire/arrayfire-java\">Java</a>, <a href=\"https://github.com/arrayfire/arrayfire-r\">R</a>, <a href=\"https://github.com/arrayfire/arrayfire-go\">Go</a>, <a href=\"https://github.com/arrayfire/arrayfire-js\">Node.js / Javascript</a>, <a href=\"https://github.com/arrayfire/arrayfire-lua\">Lua</a>, and <a href=\"https://github.com/arrayfire/arrayfire-fortran\">Fortran</a>. In addition to our work, the broader ArrayFire community has written wrappers for several other languages. Chances are support for your most beloved language is only a quick Google search away!</li>\n 	<li>Built-in Visualization Functions: Our <a href=\"http://sandbox.arrayfire.com/visualizing-arrays-with-forge/\">Forge</a> library provides a method to view data on the accelerator using 2D or 3D OpenGL-accelerated charts.</li>\n 	<li>Project Templates: We have created <a href=\"https://github.com/arrayfire/arrayfire-project-templates\">skeleton projects</a> for development using CMake, Visual Studio, and XCode.</li>\n 	<li>Strong Community of Support: We are quite active on <a href=\"https://gitter.im/arrayfire/arrayfire\">Gitter</a>, <a href=\"https://groups.google.com/forum/#!forum/arrayfire-users\">Google Groups</a></li>\n 	<li>Backed by a commercial company: Our developers use ArrayFire on a daily basis to <a href=\"http://sandbox.arrayfire.com/consulting\">develop new and accelerate existing applications</a> for commercial, governmental, and academic clients.</li>\n 	<li>Open Source and Distributed on GitHub: The ArrayFire library has received contributions from nearly 40 programmers across the globe. The <a href=\"http://github.com/arrayfire/arrayfire\">library is maintained on GitHub</a> with an open issue tracking and reporting policy.</li>\n</ul>','The ArrayFire Library','','inherit','closed','closed','','9044-autosave-v1','','','2016-07-15 10:57:09','2016-07-15 14:57:09','',9044,'http://sandbox.arrayfire.com/9044-autosave-v1/',0,'revision','',0),(9047,18528,'2016-07-15 10:57:43','2016-07-15 14:57:43','The ArrayFire library is our flagship product. It is a general-purpose computational tool that simplifies the process of developing software that targets parallel and massively-parallel architectures including CPUs, GPUs, and other hardware acceleration devices. ArrayFire provides software developers with a high-level abstraction of data which resides on the accelerator, the <code>af::array</code> object (or C-style struct). Developers write code which performs operations on ArrayFire arrays which, in turn, are automatically translated into near-optimal kernels that execute on the computational device. ArrayFire includes support for supports CPUs from all major vendors (Intel, AMD, Arm), GPUs from the dominant manufacturers (NVIDIA, AMD, and Qualcomm), as well as a variety of other accelerator devices. ArrayFire has been used successfully on devices ranging from low-power mobile phones to high-power GPU-enabled supercomputers.\r\n\r\nSeveral of ArrayFire\'s benefits include:\r\n<ul>\r\n 	<li>Commercially Friendly Open-Source Licensing: ArrayFire uses a BSD 3-clause license which permits you to use it in commercial and non-commercial software with only one catch: you must include our copyright statement and license document with your code.</li>\r\n 	<li>Tested Computational Accuracy: Every modification of ArrayFire\'s source code is evaluated by our extensive unit testing framework. If the changes cause a test to fail, the modifications are not accepted until all tests pass.</li>\r\n 	<li>Agressive Performance Evaluation: The computational throughput of almost every function in ArrayFire is tested prior to each release using our own <a href=\"https://github.com/bkloppenborg/arrayfire-benchmark\">benchmarking software</a>. Our benchmarking process includes new and legacy hardware from all major manufacturers installed in systems running Windows, Mac OSX, and Linux operating systems. We routinely <a href=\"http://sandbox.arrayfire.com/blog\">blog about our results</a>, discuss how <a href=\"http://sandbox.arrayfire.com/benchmarking-parallel-vector-libraries/\">our software compares to competing products</a>, and offer data which justifies how our<a href=\"http://sandbox.arrayfire.com/performance-of-arrayfire-jit-code-generation/\">unique approach to kernel generation</a> offers better performance than traditional methods of accelerated computing.</li>\r\n 	<li>Cross platform compatibility: ArrayFire works with <strong>CUDA</strong>, <strong>OpenCL</strong> and even native <strong>CPU</strong> on Windows, Mac, and Linux.</li>\r\n 	<li>Unencumbered interoperability with CUDA, OpenCL, and OpenGL: ArrayFire provides direct access to CUDA device pointers and OpenCL memory buffers, thus you can mix and match <a href=\"http://sandbox.arrayfire.com/arrayfire-cuda-interoperability/\">ArrayFire with CUDA</a> or <a href=\"http://sandbox.arrayfire.com/arrayfire-opencl-interoperability/\">ArrayFire with OpenCL</a>. Using similar techniques you can easily share data between ArrayFire and OpenGL.</li>\r\n 	<li>Develop in your favorite language: Although ArrayFire is a C/C++ library, we have developed wrappers for a variety of languages including: <a href=\"https://github.com/arrayfire/arrayfire-rust\">Rust</a>, <a href=\"https://github.com/arrayfire/arrayfire-dotnet\">.NET</a>, <a href=\"https://github.com/arrayfire/arrayfire-java\">Java</a>, <a href=\"https://github.com/arrayfire/arrayfire-r\">R</a>, <a href=\"https://github.com/arrayfire/arrayfire-go\">Go</a>, <a href=\"https://github.com/arrayfire/arrayfire-js\">Node.js / Javascript</a>, <a href=\"https://github.com/arrayfire/arrayfire-lua\">Lua</a>, and <a href=\"https://github.com/arrayfire/arrayfire-fortran\">Fortran</a>. In addition to our work, the broader ArrayFire community has written wrappers for several other languages. Chances are support for your most beloved language is only a quick Google search away!</li>\r\n 	<li>Built-in Visualization Functions: Our <a href=\"http://sandbox.arrayfire.com/visualizing-arrays-with-forge/\">Forge</a> library provides a method to view data on the accelerator using 2D or 3D OpenGL-accelerated charts.</li>\r\n 	<li>Project Templates: We have created <a href=\"https://github.com/arrayfire/arrayfire-project-templates\">skeleton projects</a> for development using CMake, Visual Studio, and XCode.</li>\r\n 	<li>Strong Community of Support: We are quite active on <a href=\"https://gitter.im/arrayfire/arrayfire\">Gitter</a>, <a href=\"https://groups.google.com/forum/#!forum/arrayfire-users\">Google Groups</a></li>\r\n 	<li>Backed by a commercial company: Our developers use ArrayFire on a daily basis to <a href=\"http://sandbox.arrayfire.com/consulting\">develop new and accelerate existing applications</a> for commercial, governmental, and academic clients.</li>\r\n 	<li>Open Source and Distributed on GitHub: The ArrayFire library has received contributions from nearly 40 programmers across the globe. The <a href=\"http://github.com/arrayfire/arrayfire\">library is maintained on GitHub</a> with an open issue tracking and reporting policy.</li>\r\n</ul>','The ArrayFire Library','','inherit','closed','closed','','9044-revision-v1','','','2016-07-15 10:57:43','2016-07-15 14:57:43','',9044,'http://sandbox.arrayfire.com/9044-revision-v1/',0,'revision','',0),(9049,18673,'2016-07-28 17:15:42','0000-00-00 00:00:00','Our goal at ArrayFire is to provide a simple-to-use library that can utilize the high-performance of a GPU. For the case that the user wants to extend ArrayFire capabilities, the ArrayFire library provides methods that allow programmers to look under the hood of an <code>af::array</code> and access the memory directly. While this approach is very powerful, it can be tedious to worry about the details of the memory management and layout. So today, we are eager to introduce new interoperability functions that will interface ArrayFire with several popular, and some might argue essential libraries. These are the Thrust, STL, and OpenCV libraries.\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Getting Started[/custom_headline]\r\n\r\nThe new functions are part of a new standalone repository that can be found at <a href=\"https://github.com/arrayfire/arrayfire-extras\">https://github.com/arrayfire/arrayfire-extras</a> .\r\n\r\nThis new repository will have functionality that will extend the ArrayFire library. The library can be cloned separately, however it can be automatically downloaded during ArrayFire installation if the <code>BUILD_ARRAYFIRE_EXTRAS</code> option is set within the CMake configuration. This is the case by default, so using the new functionality is as simple as including the relevant headers.\r\n<pre class=\"lang:c++ decode:true\" title=\"#include headers for interop functionalilty\">#include &lt;af/extras/thrust.h&gt;\r\n#include &lt;af/extras/stl.h&gt;\r\n#include &lt;af/extras/opencv.h&gt;\r\n#include &lt;af/extras/opencv3.h&gt;</pre>\r\nEach header brings in the function pertaining to the specific library. There are headers for both versions of OpenCV.\r\n\r\nAt a high level, the interface follows a simple structure consisting of two directions. The interface is consistent regardless of the underlying library:\r\n\r\n<code>array(...)</code> - to copy some data structure to an <code>af::array</code>\r\n\r\n<code>toDataStructure(array)</code> - to copy an af::array to some data structure\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]STL Interoperability[/custom_headline]\r\n\r\nThe STL is ubiquitous, and rightfully so. Data structures like the <code>std::vector</code> are interwoven within the source of most C++ programs. Furthermore, copying to and from the host in a GPU program often happens with the help of an STL data structure. For efficiency\'s sake, we further abstracted the back and forth process and came up with the following interface functions.\r\n<pre class=\"lang:c++ decode:true\" title=\"STL interop interface\">//create af::array from STL data structures\r\naf::array array(const std::vector&lt;T&gt; &amp;vec)\r\naf::array array(std::valarray&lt;T&gt; &amp;varr)\r\n\r\n\r\n//create STL data structures from af::array\r\nstd::vector&lt;T&gt;     toStdVector(af::array &amp;arr)\r\nstd::valarray&lt;T&gt; toStdValarray(af::array &amp;arr)\r\n</pre>\r\nUsing the interface is quite simple and can be seen below.\r\n\r\n&nbsp;\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Thrust Interoperability[/custom_headline]\r\n\r\nThrust is based on the STL, so the interoperability interface is almost identical to the previously-covered STL interface.\r\n<pre class=\"lang:default decode:true \" title=\"Thrust interop interface\">//create af::array from thrust data structures\r\naf::array array(thrust::device_vector&lt;T&gt; &amp;tvec)\r\naf::array array(thrust::host_vector&lt;T&gt;   &amp;tvec)\r\n\r\n//create thrust data structures from af::array\r\nthrust::device_vector&lt;T&gt; toDeviceVector(af::array &amp;arr)\r\nthrust::host_vector&lt;T&gt;     toHostVector(af::array &amp;arr)</pre>\r\nLikewise, an almost identical example can be seen below.\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]OpenCV Interoperability[/custom_headline]\r\n\r\nThe OpenCV library provides a large number of computer vision related functions. While ArrayFire supports some gpu-enabled computer vision functionality such as <a href=\"http://sandbox.arrayfire.com/computer-vision-arrayfire-part-1/\">feature detectors</a>, the OpenCV library has other functions and even GPU-implementations that are very useful. To ease the communication with the ArrayFire library, we provide the following methods to interface with OpenCV\'s main data structure, the <code>cv::Mat</code> .\r\n<pre class=\"lang:default decode:true\" title=\"OpenCV interop interface\">//create af::array from OpenCV data structures\r\naf::array array(const cv::Mat&amp; input, bool transpose = true);\r\naf::array array(const std::vector&lt;cv::Mat&gt;&amp; input, bool transpose = true);\r\n\r\n//create cv::Mat from an af::array\r\ncv::Mat toMat(const af::array&amp; input, int type = CV_32F, bool transpose = true);</pre>\r\nThe OpenCV interop functions provide quite a bit of flexibility with respect to the number of channels and images to be converted. It is even possible to pass in a <code>std::vector</code> of multiple OpenCV images and have the whole thing be converted. This could be helpful when dealing with a batch of images or a video fragment.\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Conclusion[/custom_headline]\r\n\r\nIntegrating ArrayFire with your code is easier than ever! With these new interoperability functions you can focus on using the tools you need instead of the implementation details.','ArrayFire interoperability with Thrust, STL, and OpenCV','','draft','open','closed','','','','','2016-07-28 17:15:42','2016-07-28 21:15:42','',0,'http://sandbox.arrayfire.com/?p=9049',0,'post','',0),(9050,18673,'2016-07-28 16:31:46','2016-07-28 20:31:46','Our goal at ArrayFire is to provide a simple-to-use library that can utilize the high-performance of a GPU. For the case that the user wants to extend ArrayFire capabilities, the ArrayFire library provides methods that allow programmers to look under the hood of an <code>af::array</code> and access the memory directly. While this approach is very powerful, it can be tedious to worry about the details of the layout and memory management. So today, we are eager to introduce new interoperability functions that will interface ArrayFire with several common, popular, and some might argue essential libraries. These are the Thrust, STL, and OpenCV libraries.\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Getting Started[/custom_headline]\r\n\r\nThe new functions are part of a new standalone repository that can be found here: https://github.com/arrayfire/arrayfire-extras\r\n\r\nThis new repository will have functionality that will extend the ArrayFire library. The library can be cloned separately, however it can be automatically downloaded during ArrayFire installation if the <code>BUILD_ARRAYFIRE_EXTRAS</code> option is set within the CMake configuration. This is the case by default, so using the new functionality is as simple as including the relevant headers.\r\n<pre class=\"lang:c++ decode:true\" title=\"#include headers for interop functionalilty\">#include &lt;af/extras/thrust.h&gt;\r\n#include &lt;af/extras/stl.h&gt;\r\n#include &lt;af/extras/opencv.h&gt;\r\n#include &lt;af/extras/opencv3.h&gt;</pre>\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]STL Interoperability[/custom_headline]\r\n\r\nThe STL is ubiquitous, and rightfully so. Data structures like the <code>std::vector</code> are interwoven within the source of most C++ programs. Furthermore, copying to and from the host in a GPU program often happens with the help of an STL data structure. For efficiency\'s sake, we further abstracted the back and forth process and came up with the following interface functions.\r\n<pre class=\"lang:c++ decode:true\" title=\"STL interop interface\">//create af::array from STL data structures\r\naf::array array(const std::vector&lt;T&gt; &amp;vec)\r\naf::array array(std::valarray&lt;T&gt; &amp;varr)\r\n//create STL data structures from af::array\r\nstd::vector&lt;T&gt;toStdVector(af::array &amp;arr)\r\nstd::valarray&lt;T&gt;toStdValarray(af::array &amp;arr)\r\n\r\n</pre>\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Thrust Interoperability[/custom_headline]\r\n\r\nThrust is based on the STL, so the interoperability interface is almost identical to the previously-covered STL interface.\r\n<pre class=\"lang:default decode:true\" title=\"Thrust interop interface\">//create af::array from thrust data structures\r\naf::array array(thrust::device_vector&lt;T&gt; &amp;tvec)\r\naf::array array(thrust::host_vector&lt;T&gt; &amp;tvec)\r\n//create thrust data structures from af::array\r\nthrust::device_vector&lt;T&gt; toDeviceVector(af::array &amp;arr)\r\nthrust::host_vector&lt;T&gt; toHostVector(af::array &amp;arr)</pre>\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]OpenCV Interoperability[/custom_headline]\r\n\r\nThe OpenCV library provides a large number of computer vision related functions. While ArrayFire supports some gpu-enabled computer vision functionality such as <a href=\"http://sandbox.arrayfire.com/computer-vision-arrayfire-part-1/\">feature detectors</a>, the OpenCV library has other functions and even GPU-implementations that are very useful. To ease the communication with the ArrayFire library, we provide the following methods to interface with OpenCV\'s main data structure, the <code>cv::Mat</code> .\r\n<pre class=\"lang:default decode:true \" title=\"OpenCV interop interface\">//create af::array from OpenCV data structures\r\naf::array array(const cv::Mat&amp; input, bool transpose = true);\r\naf::array array(const std::vector&lt;cv::Mat&gt;&amp; input, bool transpose = true);\r\n//create cv::Mat from an af::array\r\ncv::Mat toMat(const af::array&amp; input, int type = CV_32F, bool transpose = true);</pre>\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Conclusion[/custom_headline]\r\n\r\nIntegrating ArrayFire with your code is easier than ever!With these new interoperability functions you can focus on using the tools you need instead of the implementation details.','ArrayFire interoperability with Thrust, STL, and OpenCV','','inherit','closed','closed','','9049-revision-v1','','','2016-07-28 16:31:46','2016-07-28 20:31:46','',9049,'http://sandbox.arrayfire.com/9049-revision-v1/',0,'revision','',0),(9051,18673,'2016-07-28 16:42:48','2016-07-28 20:42:48','Our goal at ArrayFire is to provide a simple-to-use library that can utilize the high-performance of a GPU. For the case that the user wants to extend ArrayFire capabilities, the ArrayFire library provides methods that allow programmers to look under the hood of an <code>af::array</code> and access the memory directly. While this approach is very powerful, it can be tedious to worry about the details of the memory management and layout. So today, we are eager to introduce new interoperability functions that will interface ArrayFire with several popular, and some might argue essential libraries. These are the Thrust, STL, and OpenCV libraries.\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Getting Started[/custom_headline]\r\n\r\nThe new functions are part of a new standalone repository that can be found here.\r\n\r\nThis new repository will have functionality that will extend the ArrayFire library. The library can be cloned separately, however it can be automatically downloaded during ArrayFire installation if the <code>BUILD_ARRAYFIRE_EXTRAS</code> option is set within the CMake configuration. This is the case by default, so using the new functionality is as simple as including the relevant headers.\r\n<pre class=\"lang:c++ decode:true\" title=\"#include headers for interop functionalilty\">#include &lt;af/extras/thrust.h&gt;\r\n#include &lt;af/extras/stl.h&gt;\r\n#include &lt;af/extras/opencv.h&gt;\r\n#include &lt;af/extras/opencv3.h&gt;</pre>\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]STL Interoperability[/custom_headline]\r\n\r\nThe STL is ubiquitous, and rightfully so. Data structures like the <code>std::vector</code> are interwoven within the source of most C++ programs. Furthermore, copying to and from the host in a GPU program often happens with the help of an STL data structure. For efficiency\'s sake, we further abstracted the back and forth process and came up with the following interface functions.\r\n<pre class=\"lang:c++ decode:true\" title=\"STL interop interface\">//create af::array from STL data structures\r\naf::array array(const std::vector&lt;T&gt; &amp;vec)\r\naf::array array(std::valarray&lt;T&gt; &amp;varr)\r\n//create STL data structures from af::array\r\nstd::vector&lt;T&gt;toStdVector(af::array &amp;arr)\r\nstd::valarray&lt;T&gt;toStdValarray(af::array &amp;arr)\r\n\r\n</pre>\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Thrust Interoperability[/custom_headline]\r\n\r\nThrust is based on the STL, so the interoperability interface is almost identical to the previously-covered STL interface.\r\n<pre class=\"lang:default decode:true\" title=\"Thrust interop interface\">//create af::array from thrust data structures\r\naf::array array(thrust::device_vector&lt;T&gt; &amp;tvec)\r\naf::array array(thrust::host_vector&lt;T&gt; &amp;tvec)\r\n//create thrust data structures from af::array\r\nthrust::device_vector&lt;T&gt; toDeviceVector(af::array &amp;arr)\r\nthrust::host_vector&lt;T&gt; toHostVector(af::array &amp;arr)</pre>\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]OpenCV Interoperability[/custom_headline]\r\n\r\nThe OpenCV library provides a large number of computer vision related functions. While ArrayFire supports some gpu-enabled computer vision functionality such as <a href=\"http://sandbox.arrayfire.com/computer-vision-arrayfire-part-1/\">feature detectors</a>, the OpenCV library has other functions and even GPU-implementations that are very useful. To ease the communication with the ArrayFire library, we provide the following methods to interface with OpenCV\'s main data structure, the <code>cv::Mat</code> .\r\n<pre class=\"lang:default decode:true \" title=\"OpenCV interop interface\">//create af::array from OpenCV data structures\r\naf::array array(const cv::Mat&amp; input, bool transpose = true);\r\naf::array array(const std::vector&lt;cv::Mat&gt;&amp; input, bool transpose = true);\r\n//create cv::Mat from an af::array\r\ncv::Mat toMat(const af::array&amp; input, int type = CV_32F, bool transpose = true);</pre>\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Conclusion[/custom_headline]\r\n\r\nIntegrating ArrayFire with your code is easier than ever!With these new interoperability functions you can focus on using the tools you need instead of the implementation details.','ArrayFire interoperability with Thrust, STL, and OpenCV','','inherit','closed','closed','','9049-revision-v1','','','2016-07-28 16:42:48','2016-07-28 20:42:48','',9049,'http://sandbox.arrayfire.com/9049-revision-v1/',0,'revision','',0),(9052,18673,'2016-07-28 16:43:28','2016-07-28 20:43:28','Our goal at ArrayFire is to provide a simple-to-use library that can utilize the high-performance of a GPU. For the case that the user wants to extend ArrayFire capabilities, the ArrayFire library provides methods that allow programmers to look under the hood of an <code>af::array</code> and access the memory directly. While this approach is very powerful, it can be tedious to worry about the details of the memory management and layout. So today, we are eager to introduce new interoperability functions that will interface ArrayFire with several popular, and some might argue essential libraries. These are the Thrust, STL, and OpenCV libraries.\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Getting Started[/custom_headline]\r\n\r\nThe new functions are part of a new standalone repository that can be found here .\r\n\r\nThis new repository will have functionality that will extend the ArrayFire library. The library can be cloned separately, however it can be automatically downloaded during ArrayFire installation if the <code>BUILD_ARRAYFIRE_EXTRAS</code> option is set within the CMake configuration. This is the case by default, so using the new functionality is as simple as including the relevant headers.\r\n<pre class=\"lang:c++ decode:true\" title=\"#include headers for interop functionalilty\">#include &lt;af/extras/thrust.h&gt;\r\n#include &lt;af/extras/stl.h&gt;\r\n#include &lt;af/extras/opencv.h&gt;\r\n#include &lt;af/extras/opencv3.h&gt;</pre>\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]STL Interoperability[/custom_headline]\r\n\r\nThe STL is ubiquitous, and rightfully so. Data structures like the <code>std::vector</code> are interwoven within the source of most C++ programs. Furthermore, copying to and from the host in a GPU program often happens with the help of an STL data structure. For efficiency\'s sake, we further abstracted the back and forth process and came up with the following interface functions.\r\n<pre class=\"lang:c++ decode:true\" title=\"STL interop interface\">//create af::array from STL data structures\r\naf::array array(const std::vector&lt;T&gt; &amp;vec)\r\naf::array array(std::valarray&lt;T&gt; &amp;varr)\r\n//create STL data structures from af::array\r\nstd::vector&lt;T&gt;toStdVector(af::array &amp;arr)\r\nstd::valarray&lt;T&gt;toStdValarray(af::array &amp;arr)\r\n\r\n</pre>\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Thrust Interoperability[/custom_headline]\r\n\r\nThrust is based on the STL, so the interoperability interface is almost identical to the previously-covered STL interface.\r\n<pre class=\"lang:default decode:true\" title=\"Thrust interop interface\">//create af::array from thrust data structures\r\naf::array array(thrust::device_vector&lt;T&gt; &amp;tvec)\r\naf::array array(thrust::host_vector&lt;T&gt; &amp;tvec)\r\n//create thrust data structures from af::array\r\nthrust::device_vector&lt;T&gt; toDeviceVector(af::array &amp;arr)\r\nthrust::host_vector&lt;T&gt; toHostVector(af::array &amp;arr)</pre>\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]OpenCV Interoperability[/custom_headline]\r\n\r\nThe OpenCV library provides a large number of computer vision related functions. While ArrayFire supports some gpu-enabled computer vision functionality such as <a href=\"http://sandbox.arrayfire.com/computer-vision-arrayfire-part-1/\">feature detectors</a>, the OpenCV library has other functions and even GPU-implementations that are very useful. To ease the communication with the ArrayFire library, we provide the following methods to interface with OpenCV\'s main data structure, the <code>cv::Mat</code> .\r\n<pre class=\"lang:default decode:true \" title=\"OpenCV interop interface\">//create af::array from OpenCV data structures\r\naf::array array(const cv::Mat&amp; input, bool transpose = true);\r\naf::array array(const std::vector&lt;cv::Mat&gt;&amp; input, bool transpose = true);\r\n//create cv::Mat from an af::array\r\ncv::Mat toMat(const af::array&amp; input, int type = CV_32F, bool transpose = true);</pre>\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Conclusion[/custom_headline]\r\n\r\nIntegrating ArrayFire with your code is easier than ever!With these new interoperability functions you can focus on using the tools you need instead of the implementation details.','ArrayFire interoperability with Thrust, STL, and OpenCV','','inherit','closed','closed','','9049-revision-v1','','','2016-07-28 16:43:28','2016-07-28 20:43:28','',9049,'http://sandbox.arrayfire.com/9049-revision-v1/',0,'revision','',0),(9053,18673,'2016-07-28 17:05:45','2016-07-28 21:05:45','Our goal at ArrayFire is to provide a simple-to-use library that can utilize the high-performance of a GPU. For the case that the user wants to extend ArrayFire capabilities, the ArrayFire library provides methods that allow programmers to look under the hood of an <code>af::array</code> and access the memory directly. While this approach is very powerful, it can be tedious to worry about the details of the memory management and layout. So today, we are eager to introduce new interoperability functions that will interface ArrayFire with several popular, and some might argue essential libraries. These are the Thrust, STL, and OpenCV libraries.\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Getting Started[/custom_headline]\r\n\r\nThe new functions are part of a new standalone repository that can be found here .\r\n\r\nThis new repository will have functionality that will extend the ArrayFire library. The library can be cloned separately, however it can be automatically downloaded during ArrayFire installation if the <code>BUILD_ARRAYFIRE_EXTRAS</code> option is set within the CMake configuration. This is the case by default, so using the new functionality is as simple as including the relevant headers.\r\n<pre class=\"lang:c++ decode:true\" title=\"#include headers for interop functionalilty\">#include &lt;af/extras/thrust.h&gt;\r\n#include &lt;af/extras/stl.h&gt;\r\n#include &lt;af/extras/opencv.h&gt;\r\n#include &lt;af/extras/opencv3.h&gt;</pre>\r\nEach header brings in the function pertaining to the specific library. There are headers for both versions of OpenCV.\r\n\r\nAt a high level, the interface follows a simple structure consisting of two directions. The interface is consistent regardless of the underlying library:\r\n\r\n<code>array(...)</code> - to copy some data structure to an <code>af::array</code>\r\n\r\n<code>toDataStructure(array)</code> - to copy an af::array to some data structure\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]STL Interoperability[/custom_headline]\r\n\r\nThe STL is ubiquitous, and rightfully so. Data structures like the <code>std::vector</code> are interwoven within the source of most C++ programs. Furthermore, copying to and from the host in a GPU program often happens with the help of an STL data structure. For efficiency\'s sake, we further abstracted the back and forth process and came up with the following interface functions.\r\n<pre class=\"lang:c++ decode:true\" title=\"STL interop interface\">//create af::array from STL data structures\r\naf::array array(const std::vector&lt;T&gt; &amp;vec)\r\naf::array array(std::valarray&lt;T&gt; &amp;varr)\r\n//create STL data structures from af::array\r\nstd::vector&lt;T&gt;toStdVector(af::array &amp;arr)\r\nstd::valarray&lt;T&gt;toStdValarray(af::array &amp;arr)\r\n\r\n</pre>\r\nUsing the interface is quite simple and can be seen below.\r\n\r\n&nbsp;\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Thrust Interoperability[/custom_headline]\r\n\r\nThrust is based on the STL, so the interoperability interface is almost identical to the previously-covered STL interface.\r\n<pre class=\"lang:default decode:true\" title=\"Thrust interop interface\">//create af::array from thrust data structures\r\naf::array array(thrust::device_vector&lt;T&gt; &amp;tvec)\r\naf::array array(thrust::host_vector&lt;T&gt; &amp;tvec)\r\n//create thrust data structures from af::array\r\nthrust::device_vector&lt;T&gt; toDeviceVector(af::array &amp;arr)\r\nthrust::host_vector&lt;T&gt; toHostVector(af::array &amp;arr)</pre>\r\nLikewise, an almost identical example can be seen below.\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]OpenCV Interoperability[/custom_headline]\r\n\r\nThe OpenCV library provides a large number of computer vision related functions. While ArrayFire supports some gpu-enabled computer vision functionality such as <a href=\"http://sandbox.arrayfire.com/computer-vision-arrayfire-part-1/\">feature detectors</a>, the OpenCV library has other functions and even GPU-implementations that are very useful. To ease the communication with the ArrayFire library, we provide the following methods to interface with OpenCV\'s main data structure, the <code>cv::Mat</code> .\r\n<pre class=\"lang:default decode:true\" title=\"OpenCV interop interface\">//create af::array from OpenCV data structures\r\naf::array array(const cv::Mat&amp; input, bool transpose = true);\r\naf::array array(const std::vector&lt;cv::Mat&gt;&amp; input, bool transpose = true);\r\n//create cv::Mat from an af::array\r\ncv::Mat toMat(const af::array&amp; input, int type = CV_32F, bool transpose = true);</pre>\r\nThe OpenCV interop functions provide quite a bit of flexibility with respect to the number of channels and images to be converted. It is even possible to pass in a <code>std::vector</code> of multiple OpenCV images and have the whole thing be converted. This could be helpful when dealing with a batch of images or a video fragment.\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Conclusion[/custom_headline]\r\n\r\nIntegrating ArrayFire with your code is easier than ever!With these new interoperability functions you can focus on using the tools you need instead of the implementation details.','ArrayFire interoperability with Thrust, STL, and OpenCV','','inherit','closed','closed','','9049-revision-v1','','','2016-07-28 17:05:45','2016-07-28 21:05:45','',9049,'http://sandbox.arrayfire.com/9049-revision-v1/',0,'revision','',0),(9054,18673,'2016-07-28 17:15:39','2016-07-28 21:15:39','Our goal at ArrayFire is to provide a simple-to-use library that can utilize the high-performance of a GPU. For the case that the user wants to extend ArrayFire capabilities, the ArrayFire library provides methods that allow programmers to look under the hood of an <code>af::array</code> and access the memory directly. While this approach is very powerful, it can be tedious to worry about the details of the memory management and layout. So today, we are eager to introduce new interoperability functions that will interface ArrayFire with several popular, and some might argue essential libraries. These are the Thrust, STL, and OpenCV libraries.\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Getting Started[/custom_headline]\r\n\r\nThe new functions are part of a new standalone repository that can be found at <a href=\"https://github.com/arrayfire/arrayfire-extras\">https://github.com/arrayfire/arrayfire-extras</a> .\r\n\r\nThis new repository will have functionality that will extend the ArrayFire library. The library can be cloned separately, however it can be automatically downloaded during ArrayFire installation if the <code>BUILD_ARRAYFIRE_EXTRAS</code> option is set within the CMake configuration. This is the case by default, so using the new functionality is as simple as including the relevant headers.\r\n<pre class=\"lang:c++ decode:true\" title=\"#include headers for interop functionalilty\">#include &lt;af/extras/thrust.h&gt;\r\n#include &lt;af/extras/stl.h&gt;\r\n#include &lt;af/extras/opencv.h&gt;\r\n#include &lt;af/extras/opencv3.h&gt;</pre>\r\nEach header brings in the function pertaining to the specific library. There are headers for both versions of OpenCV.\r\n\r\nAt a high level, the interface follows a simple structure consisting of two directions. The interface is consistent regardless of the underlying library:\r\n\r\n<code>array(...)</code> - to copy some data structure to an <code>af::array</code>\r\n\r\n<code>toDataStructure(array)</code> - to copy an af::array to some data structure\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]STL Interoperability[/custom_headline]\r\n\r\nThe STL is ubiquitous, and rightfully so. Data structures like the <code>std::vector</code> are interwoven within the source of most C++ programs. Furthermore, copying to and from the host in a GPU program often happens with the help of an STL data structure. For efficiency\'s sake, we further abstracted the back and forth process and came up with the following interface functions.\r\n<pre class=\"lang:c++ decode:true\" title=\"STL interop interface\">//create af::array from STL data structures\r\naf::array array(const std::vector&lt;T&gt; &amp;vec)\r\naf::array array(std::valarray&lt;T&gt; &amp;varr)\r\n\r\n\r\n//create STL data structures from af::array\r\nstd::vector&lt;T&gt;     toStdVector(af::array &amp;arr)\r\nstd::valarray&lt;T&gt; toStdValarray(af::array &amp;arr)\r\n</pre>\r\nUsing the interface is quite simple and can be seen below.\r\n\r\n&nbsp;\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Thrust Interoperability[/custom_headline]\r\n\r\nThrust is based on the STL, so the interoperability interface is almost identical to the previously-covered STL interface.\r\n<pre class=\"lang:default decode:true \" title=\"Thrust interop interface\">//create af::array from thrust data structures\r\naf::array array(thrust::device_vector&lt;T&gt; &amp;tvec)\r\naf::array array(thrust::host_vector&lt;T&gt;   &amp;tvec)\r\n\r\n//create thrust data structures from af::array\r\nthrust::device_vector&lt;T&gt; toDeviceVector(af::array &amp;arr)\r\nthrust::host_vector&lt;T&gt;     toHostVector(af::array &amp;arr)</pre>\r\nLikewise, an almost identical example can be seen below.\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]OpenCV Interoperability[/custom_headline]\r\n\r\nThe OpenCV library provides a large number of computer vision related functions. While ArrayFire supports some gpu-enabled computer vision functionality such as <a href=\"http://sandbox.arrayfire.com/computer-vision-arrayfire-part-1/\">feature detectors</a>, the OpenCV library has other functions and even GPU-implementations that are very useful. To ease the communication with the ArrayFire library, we provide the following methods to interface with OpenCV\'s main data structure, the <code>cv::Mat</code> .\r\n<pre class=\"lang:default decode:true\" title=\"OpenCV interop interface\">//create af::array from OpenCV data structures\r\naf::array array(const cv::Mat&amp; input, bool transpose = true);\r\naf::array array(const std::vector&lt;cv::Mat&gt;&amp; input, bool transpose = true);\r\n\r\n//create cv::Mat from an af::array\r\ncv::Mat toMat(const af::array&amp; input, int type = CV_32F, bool transpose = true);</pre>\r\nThe OpenCV interop functions provide quite a bit of flexibility with respect to the number of channels and images to be converted. It is even possible to pass in a <code>std::vector</code> of multiple OpenCV images and have the whole thing be converted. This could be helpful when dealing with a batch of images or a video fragment.\r\n\r\n[custom_headline type=\"left\" level=\"h3\" looks_like=\"h3\"]Conclusion[/custom_headline]\r\n\r\nIntegrating ArrayFire with your code is easier than ever! With these new interoperability functions you can focus on using the tools you need instead of the implementation details.','ArrayFire interoperability with Thrust, STL, and OpenCV','','inherit','closed','closed','','9049-revision-v1','','','2016-07-28 17:15:39','2016-07-28 21:15:39','',9049,'http://sandbox.arrayfire.com/9049-revision-v1/',0,'revision','',0),(9058,18528,'2016-08-22 15:36:40','2016-08-22 19:36:40','[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"40px\" padding_bottom=\"10px\"][column type=\"two-fifths\"]\r\n\r\n[custom_headline type=\"left\" level=\"h3\"]If you want faster code, you\'ve come to the right place.[/custom_headline][gap size=\"3%\"][button  type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/download\" size=\"x-large\" block=\"true\"]Download ArrayFire[/button]\r\n\r\n[gap size=\"5%\"]\r\n\r\n[button  type=\"flat\" block=\"true\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/consulting/\" size=\"x-large\" ]Schedule a consultation[/button][gap size=\"2%\"]\r\n\r\n[/column][column type=\"three-fifths\" last=\"true\"][gap size=\"7%\"]\r\n<div id=\"wistia_rj2bar3xxp\" class=\"wistia_embed\" style=\"width: 640px; height: 388px;\"></div>\r\n<script src=\"//fast.wistia.com/assets/external/E-v1.js\" charset=\"ISO-8859-1\"></script><script>// <![CDATA[\r\nwistiaEmbed = Wistia.embed(\"rj2bar3xxp\");\r\n// ]]></script>\r\n[/column]\r\n<div id=\"arrayfire\"></div>\r\n[/content_band]\r\n\r\n\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n[custom_headline type=\"left\" level=\"h3\" class=\"center-text\"]Services[/custom_headline]\r\n\r\nArrayFire specializes in developing accelerated, scalable computing solutions on modern computational platforms for our clients. As an industry leader in high performance computing for nearly 10 years, ArrayFire continues to drive innovation in all areas of accelerated computing, ranging from apps deployed on low-powered and mobile platforms to scientific simulations on high-end supercomputers.\r\n\r\n[/content_band]\r\n\r\n[content_band bg_color=\"#ffffff\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"40px\" padding_bottom=\"10px\"]\r\n\r\n[column type=\"one-third\" ][custom_headline type=\"left\" level=\"h3\" class=\"center-text\"][image src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/car-e1412967813807.png\" class=\"mbn\"] Software Design[/custom_headline]\r\n\r\n[line style=\"border-top: solid #999999;\"]ArrayFire has worked with hundreds of companies and entrepreneurs to develop custom, high performance software solutions for their unique problems. We use the latest software development methods, profiling tools, and deployment methods to deliver scalable solutions for your present and future business goals.\r\n\r\n[button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/consulting\" padding_top=\"40px\" padding_bottom=\"40px\"]Read more...[/button]\r\n[/column]\r\n\r\n[column type=\"one-third\" ][custom_headline type=\"left\" level=\"h3\" class=\"center-text\"][image src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/09/mini-motorcycle-01-e1412969290876.png\" class=\"mbn\"] System Assessment[/custom_headline][line style=\"border-top: solid #999999;\"]ArrayFire performs holistic application audits that establish the current and theoretical maximum performance your application can achieve. Our methods evaluate everything from the hardware up so you can determine bottlenecks and get the maximum return on investment for future development work.\r\n\r\n[button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/consulting\" padding_top=\"40px\" padding_bottom=\"40px\"]Read More...[/button]\r\n\r\n[/column]\r\n\r\n[column type=\"one-third\" last=\"true\" ][custom_headline type=\"left\" level=\"h3\" class=\"center-text\"][image src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/09/mini-plane-01-e1412969527633.png\" class=\"mbn\"] Training [/custom_headline][line style=\"border-top: solid #999999;\"]ArrayFire trains your engineers on the latest techniques in parallel computing including CUDA or OpenCL for CPUs, GPUs, FPGAs, and other accelerators. We offer two- and four-day training sessions that are fully customizable so your team learns skills that they need to accelerate your software.\r\n\r\n[button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/training\" padding_top=\"40px\" padding_bottom=\"40px\"]Read More...[/button]\r\n\r\n[/column]\r\n\r\n[/content_band]\r\n\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n[custom_headline type=\"left\" level=\"h3\" class=\"center-text\"]ArrayFire Library[/custom_headline]\r\n\r\nArrayFire is a free, general-purpose, open-source library that simplifies the process of developing software that targets parallel and massively-parallel architectures including CPUs, GPUs, and other hardware acceleration devices. ArrayFire is used on devices from low-powered mobile phones to high-powered GPU-enabled supercomputers including CPUs from all major vendors (Intel, AMD, Arm), GPUs from the dominant manufacturers (NVIDIA, AMD, and Qualcomm), as well as a variety of other accelerator devices on Windows, Mac, and Linux. \r\n\r\n[button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/download\" padding_top=\"40px\" padding_bottom=\"40px\"]Download ArrayFire[/button]\r\n\r\n[/content_band]','Home','','inherit','closed','closed','','245-revision-v1','','','2016-08-22 15:36:40','2016-08-22 19:36:40','',245,'http://sandbox.arrayfire.com/245-revision-v1/',0,'revision','',0),(9060,18528,'2016-08-22 15:53:42','2016-08-22 19:53:42','','logo_blue_background','','inherit','open','closed','','logo_blue_background','','','2016-08-22 15:53:42','2016-08-22 19:53:42','',0,'http://sandbox.arrayfire.com/wp-content/uploads/2016/08/logo_blue_background.jpg',0,'attachment','image/jpeg',0),(9061,18528,'2016-08-26 09:56:28','2016-08-26 13:56:28','[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][column type=\"three-fifths\"][custom_headline type=\"left\" level=\"h2\"]Call the ArrayFire team[/custom_headline]\r\n\r\nHire us to accelerate your code, train your pros, or even write new code for your organization!\r\n\r\nWe’ve already helped thousands of organizations speed up their code. We’ve accelerated algorithms, sped up data analysis, and solved challenging problems of all types in the past, and we’re confident that we can accelerate your code, too.\r\n\r\nStart by setting up a free consultation to discuss your project with an ArrayFire expert today!\r\n\r\n[gap size=\"5%\"]\r\n\r\n[button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"normal\" ]Schedule a consultation[/button]\r\n\r\n[button  type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-studies\" size=\"normal\" ]Read Case Studies[/button]\r\n\r\n[/column]\r\n\r\n\r\n[column type=\"two-fifths\" last=\"true\" class=\"center-text\"][gap size=\"15%\"]<img class=\"aligncenter wp-image-462\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/Bat-signal.png\" alt=\"Bat signal\" width=\"700\" height=\"437\" />[/column][gap size=\"2%\"][/content_band]\r\n\r\n<!-- Starter Package Band -->\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n[column type=\"one-half\"] [custom_headline type=\"left\" level=\"h2\"]Starter Package ($799) [/custom_headline] Hire us for a single day. We\'ll match you with one engineer dedicated for a full day, supported by senior and test engineers throughout the day. Here\'s how it works:\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]We conduct an initial phone call.[/icon_list_item] [icon_list_item type=\"angle-double-right\"]You send us your code or algorithm. [/icon_list_item] [icon_list_item type=\"angle-double-right\"]We analyze your code for potential GPU benefit.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We accelerate as much of your code as is possible within the one-day effort, applying our extensive GPU software libraries.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We produce a final report for you, along with your optimized code.[/icon_list_item] [/icon_list] The final report outlines the best approach to follow for full GPU-acceleration of your code.\r\n\r\n[button type=\"flat\"  shape=\"rounded\" size=\"regular\" href=\"http://sandbox.arrayfire.com/product-category/starter-package/\" title=\"Starter Package\"]Get the Starter Package[/button]\r\n\r\n&nbsp;\r\n\r\n[/column][column type=\"one-half\" last=\"true\" ][gap size=\"15%\"]<img class=\"aligncenter wp-image-4962\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/02/Benchmark-guy-torso-opposite.png\" alt=\"Benchmark guy, torso opposite\" width=\"450\" height=\"397\" />[/column]\r\n<div></div>\r\n[/content_band]\r\n\r\n<!-- Software Design Horizontal Band -->\r\n[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"0px\" margin_top=\"0px\" padding_bottom=\"40px\" ]\r\n\r\n<!-- Link from home page -->\r\n<a name=\"software-design\"></a>\r\n\r\n[custom_headline type=\"left\" level=\"h2\" class=\"center-text\"]Software Design[/custom_headline]\r\n\r\nYour hardware can do anything, given the right code. Getting that code right can be tricky when your team is swamped in work or when you\'re new to parallel programming. Bring us in—our team is capable of writing custom code that\'s as unique as your work and tailored to your task. Here\'s what we bring to the table:\r\n\r\n[column type=\"one-half\"]\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]Excellence in GPU code[/icon_list_item] [icon_list_item type=\"angle-double-right\"]Well-written, efficient C, C++, Fortran, Java, or .NET [/icon_list_item] [icon_list_item type=\"angle-double-right\"]Application porting and integration[/icon_list_item][icon_list_item type=\"angle-double-right\"]Tuning software to peak hardware performance[/icon_list_item][icon_list_item type=\"angle-double-right\"]Scalability of algorithms to handle enterprise-level programs[/icon_list_item] [/icon_list]\r\n\r\nRead more about our capabilities in our <a href=\"/case-studies\">case studies</a> or check out one of our more involved projects to the right.\r\n\r\n[button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"regular\" ]Schedule a consultation[/button]\r\n[/column]\r\n\r\n[column type=\"one-half\"]\r\n[promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision functionality and three-dimentional head modeling code implemented and accelerated by ArrayFire. This code generates accurate, high-fidelity images that let a user virtually try on thousands of pairs of glasses without leaving the comfort of their own home.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-glasses-com-app-with-3dfit-technology\" size=\"regular\" ]Read the case study[/button]</p>\r\n[/promo]\r\n\r\n[/column]\r\n\r\n [/content_band]\r\n\r\n<!-- System Evaluation Horizontal Band -->\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n<!-- Link from home page -->\r\n<a name=\"system-evaluation\"></a>\r\n\r\n[custom_headline type=\"left\" level=\"h2\" class=\"center-text\"]System Evaluation[/custom_headline]\r\n\r\nGetting the maximum performance out of your system is tricky to say the least. The interplay between network communication, disk operations, and processing can be tricky to understand and even more difficult to profile correctly. Our team excels at benchmarking and we know how to find the bottleknecks in your application quickly. Hire us to evaluate sections of your code or the entire system. We do it all! Here is what we bring to the table:\r\n\r\n[column type=\"one-half\"  last=\"true\" ]\r\n\r\n[icon_list]\r\n[icon_list_item type=\"angle-double-right\"]System architecture and design expertise\r\n[/icon_list_item]\r\n\r\n[icon_list_item type=\"angle-double-right\"]In-depth knowledge and a plethora of field experience optimizing applications and processes for CPUs, GPUs, and FPGAs.[/icon_list_item]\r\n\r\n[icon_list_item type=\"angle-double-right\"]Awareness of the latest industry trends and tools[/icon_list_item]\r\n\r\n[icon_list_item type=\"angle-double-right\"]Hands on experience auditing on large, complicated systems.[/icon_list_item]\r\n\r\n[/icon_list][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"regular\" ]Schedule a consultation[/button][/column]\r\n\r\n[column type=\"one-half\"]\r\n\r\n[promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/08/pT5oEjE8c-1024x240.jpg\" alt=\"San Fransisco Skyline\"]A Fortune 200 Insurance Company contacted ArrayFire to conduct an audit of their system in nine key areas. Two of these were scalability and optimization techniques. Through our comprehensive review ArrayFire located key bottleknecks that, once corrected, decreased total nightly runtime by 39% without any major code or system modifications.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-fortune-200-insurance-company\" size=\"regular\" ]Read the case study[/button]</p>\r\n[/promo]\r\n\r\n[/column]\r\n\r\n[/content_band]','Consulting','','inherit','closed','closed','','6634-autosave-v1','','','2016-08-26 09:56:28','2016-08-26 13:56:28','',6634,'http://sandbox.arrayfire.com/6634-autosave-v1/',0,'revision','',0),(9062,18528,'2016-08-23 09:30:53','2016-08-23 13:30:53','[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][column type=\"one-half\"][custom_headline type=\"left\" level=\"h2\"]Call the ArrayFire team[/custom_headline]\r\n\r\nHire us to accelerate your code, train your pros, or even write new code for your organization!\r\n\r\nWe’ve already helped thousands of organizations speed up their code. We’ve accelerated algorithms, sped up data analysis, and solved challenging problems of all types in the past, and we’re confident that we can accelerate your code, too.\r\n\r\nStart by setting up a free consultation to discuss your project with an ArrayFire expert today!\r\n\r\n[gap size=\"5%\"][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"normal\" ]Schedule a consultation[/button][/column][column type=\"one-half\" last=\"true\" class=\"center-text\"][gap size=\"15%\"]<img class=\"aligncenter wp-image-462\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/Bat-signal.png\" alt=\"Bat signal\" width=\"700\" height=\"437\" />[/column][gap size=\"2%\"][/content_band][content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n[column type=\"one-half\"] [custom_headline type=\"left\" level=\"h2\"]Starter Package ($799) [/custom_headline] Hire us for a single day. We\'ll match you with one engineer dedicated for a full day, supported by senior and test engineers throughout the day. Here\'s how it works:\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]We conduct an initial phone call.[/icon_list_item] [icon_list_item type=\"angle-double-right\"]You send us your code or algorithm. [/icon_list_item] [icon_list_item type=\"angle-double-right\"]We analyze your code for potential GPU benefit.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We accelerate as much of your code as is possible within the one-day effort, applying our extensive GPU software libraries.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We produce a final report for you, along with your optimized code.[/icon_list_item] [/icon_list] The final report outlines the best approach to follow for full GPU-acceleration of your code.\r\n\r\n[button type=\"flat\"  shape=\"rounded\" size=\"regular\" href=\"http://sandbox.arrayfire.com/product-category/starter-package/\" title=\"Starter Package\"]Get the Starter Package[/button]\r\n\r\n&nbsp;\r\n\r\n[/column][column type=\"one-half\" last=\"true\" ][gap size=\"15%\"]<img class=\"aligncenter wp-image-4962\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/02/Benchmark-guy-torso-opposite.png\" alt=\"Benchmark guy, torso opposite\" width=\"450\" height=\"397\" />[/column]\r\n<div></div>\r\n[/content_band]\r\n\r\n[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\" ]\r\n\r\n[column type=\"one-half\"]\r\n\r\n&nbsp;\r\n\r\n[gap size=\"12%\"]\r\n\r\n<img class=\"aligncenter size-large wp-image-5100\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/Triumvirate_Exported-1024x599.png\" alt=\"Triumvirate_Exported\" width=\"742\" height=\"434\" />[/column]\r\n\r\n[column type=\"one-half\"  last=\"true\" ]\r\n<!-- Link from front page -->\r\n<a name=\"software-design\"></a>\r\n[custom_headline type=\"left\" level=\"h2\" ]Custom coding[/custom_headline]\r\n\r\nYour hardware can do anything, given the right code. Getting that code right can be tricky when your team is swamped in work or when you\'re new to parallel programming. Bring us in—our team is capable of writing custom code that\'s as unique as your work and tailored to your task. Here\'s what we bring to the table:\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]Excellence in GPU code[/icon_list_item] [icon_list_item type=\"angle-double-right\"]Well-written, efficient C, C++, Fortran, Java, or .NET [/icon_list_item] [icon_list_item type=\"angle-double-right\"]Application porting and integration[/icon_list_item][icon_list_item type=\"angle-double-right\"]Tuning software to peak hardware performance[/icon_list_item][icon_list_item type=\"angle-double-right\"]Scalability of algorithms to handle enterprise-level programs[/icon_list_item] [/icon_list][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"regular\" ]Schedule a consultation[/button][/column] [/content_band]\r\n\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\"  level=\"h2\" ]Case studies[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision to recognize the features of a user’s face. The application then generates an accurate, high-fidelity, three-dimensional model of that face, and virtually places selected frames on the image.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-glasses-com-app-with-3dfit-technology/\" size=\"regular\" ]Read the case study[/button][/promo][/column]</p>\r\n[column type=\"one-half\" last=\"true\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/reveal-logo-promo-01.png\" alt=\"Reveal Imaging\"]Reveal Imaging, an SAIC company, uses ArrayFire in developing threat-detection products for transportation systems—such as cargo and baggage screening in airports—and in securing facilities and public events.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-reveal-imaging/\" size=\"regular\" ]Read the case study[/button][/promo][/column][/content_band]</p>','Consulting','','inherit','closed','closed','','6634-revision-v1','','','2016-08-23 09:30:53','2016-08-23 13:30:53','',6634,'http://sandbox.arrayfire.com/6634-revision-v1/',0,'revision','',0),(9063,18528,'2016-08-23 09:31:26','2016-08-23 13:31:26','[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][column type=\"one-half\"][custom_headline type=\"left\" level=\"h2\"]Call the ArrayFire team[/custom_headline]\r\n\r\nHire us to accelerate your code, train your pros, or even write new code for your organization!\r\n\r\nWe’ve already helped thousands of organizations speed up their code. We’ve accelerated algorithms, sped up data analysis, and solved challenging problems of all types in the past, and we’re confident that we can accelerate your code, too.\r\n\r\nStart by setting up a free consultation to discuss your project with an ArrayFire expert today!\r\n\r\n[gap size=\"5%\"][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"normal\" ]Schedule a consultation[/button][/column][column type=\"one-half\" last=\"true\" class=\"center-text\"][gap size=\"15%\"]<img class=\"aligncenter wp-image-462\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/Bat-signal.png\" alt=\"Bat signal\" width=\"700\" height=\"437\" />[/column][gap size=\"2%\"][/content_band][content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n[column type=\"one-half\"] [custom_headline type=\"left\" level=\"h2\"]Starter Package ($799) [/custom_headline] Hire us for a single day. We\'ll match you with one engineer dedicated for a full day, supported by senior and test engineers throughout the day. Here\'s how it works:\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]We conduct an initial phone call.[/icon_list_item] [icon_list_item type=\"angle-double-right\"]You send us your code or algorithm. [/icon_list_item] [icon_list_item type=\"angle-double-right\"]We analyze your code for potential GPU benefit.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We accelerate as much of your code as is possible within the one-day effort, applying our extensive GPU software libraries.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We produce a final report for you, along with your optimized code.[/icon_list_item] [/icon_list] The final report outlines the best approach to follow for full GPU-acceleration of your code.\r\n\r\n[button type=\"flat\"  shape=\"rounded\" size=\"regular\" href=\"http://sandbox.arrayfire.com/product-category/starter-package/\" title=\"Starter Package\"]Get the Starter Package[/button]\r\n\r\n&nbsp;\r\n\r\n[/column][column type=\"one-half\" last=\"true\" ][gap size=\"15%\"]<img class=\"aligncenter wp-image-4962\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/02/Benchmark-guy-torso-opposite.png\" alt=\"Benchmark guy, torso opposite\" width=\"450\" height=\"397\" />[/column]\r\n<div></div>\r\n[/content_band]\r\n\r\n[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\" ]\r\n\r\n[column type=\"one-half\"]\r\n\r\n&nbsp;\r\n\r\n[gap size=\"12%\"]\r\n\r\n<img class=\"aligncenter size-large wp-image-5100\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/Triumvirate_Exported-1024x599.png\" alt=\"Triumvirate_Exported\" width=\"742\" height=\"434\" />[/column]\r\n\r\n<!-- Link from front page -->\r\n<a name=\"software-design\"></a>\r\n\r\n[column type=\"one-half\"  last=\"true\" ]\r\n[custom_headline type=\"left\" level=\"h2\" ]Custom coding[/custom_headline]\r\n\r\nYour hardware can do anything, given the right code. Getting that code right can be tricky when your team is swamped in work or when you\'re new to parallel programming. Bring us in—our team is capable of writing custom code that\'s as unique as your work and tailored to your task. Here\'s what we bring to the table:\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]Excellence in GPU code[/icon_list_item] [icon_list_item type=\"angle-double-right\"]Well-written, efficient C, C++, Fortran, Java, or .NET [/icon_list_item] [icon_list_item type=\"angle-double-right\"]Application porting and integration[/icon_list_item][icon_list_item type=\"angle-double-right\"]Tuning software to peak hardware performance[/icon_list_item][icon_list_item type=\"angle-double-right\"]Scalability of algorithms to handle enterprise-level programs[/icon_list_item] [/icon_list][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"regular\" ]Schedule a consultation[/button][/column] [/content_band]\r\n\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\"  level=\"h2\" ]Case studies[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision to recognize the features of a user’s face. The application then generates an accurate, high-fidelity, three-dimensional model of that face, and virtually places selected frames on the image.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-glasses-com-app-with-3dfit-technology/\" size=\"regular\" ]Read the case study[/button][/promo][/column]</p>\r\n[column type=\"one-half\" last=\"true\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/reveal-logo-promo-01.png\" alt=\"Reveal Imaging\"]Reveal Imaging, an SAIC company, uses ArrayFire in developing threat-detection products for transportation systems—such as cargo and baggage screening in airports—and in securing facilities and public events.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-reveal-imaging/\" size=\"regular\" ]Read the case study[/button][/promo][/column][/content_band]</p>','Consulting','','inherit','closed','closed','','6634-revision-v1','','','2016-08-23 09:31:26','2016-08-23 13:31:26','',6634,'http://sandbox.arrayfire.com/6634-revision-v1/',0,'revision','',0),(9064,18528,'2016-08-23 09:32:08','2016-08-23 13:32:08','[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"40px\" padding_bottom=\"10px\"][column type=\"two-fifths\"]\r\n\r\n[custom_headline type=\"left\" level=\"h3\"]If you want faster code, you\'ve come to the right place.[/custom_headline][gap size=\"3%\"][button  type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/download\" size=\"x-large\" block=\"true\"]Download ArrayFire[/button]\r\n\r\n[gap size=\"5%\"]\r\n\r\n[button  type=\"flat\" block=\"true\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/consulting/\" size=\"x-large\" ]Schedule a consultation[/button][gap size=\"2%\"]\r\n\r\n[/column][column type=\"three-fifths\" last=\"true\"][gap size=\"7%\"]\r\n<div id=\"wistia_rj2bar3xxp\" class=\"wistia_embed\" style=\"width: 640px; height: 388px;\"></div>\r\n<script src=\"//fast.wistia.com/assets/external/E-v1.js\" charset=\"ISO-8859-1\"></script><script>// <![CDATA[\r\nwistiaEmbed = Wistia.embed(\"rj2bar3xxp\");\r\n// ]]></script>\r\n[/column]\r\n<div id=\"arrayfire\"></div>\r\n[/content_band]\r\n\r\n\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n[custom_headline type=\"left\" level=\"h3\" class=\"center-text\"]Services[/custom_headline]\r\n\r\nArrayFire specializes in developing accelerated, scalable computing solutions on modern computational platforms for our clients. As an industry leader in high performance computing for nearly 10 years, ArrayFire continues to drive innovation in all areas of accelerated computing, ranging from apps deployed on low-powered and mobile platforms to scientific simulations on high-end supercomputers.\r\n\r\n[/content_band]\r\n\r\n[content_band bg_color=\"#ffffff\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"40px\" padding_bottom=\"10px\"]\r\n\r\n[column type=\"one-third\" ][custom_headline type=\"left\" level=\"h3\" class=\"center-text\"][image src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/car-e1412967813807.png\" class=\"mbn\"] Software Design[/custom_headline]\r\n\r\n[line style=\"border-top: solid #999999;\"]ArrayFire has worked with hundreds of companies and entrepreneurs to develop custom, high performance software solutions for their unique problems. We use the latest software development methods, profiling tools, and deployment methods to deliver scalable solutions for your present and future business goals.\r\n\r\n[button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/consulting#software-design\" padding_top=\"40px\" padding_bottom=\"40px\"]Read more...[/button]\r\n[/column]\r\n\r\n[column type=\"one-third\" ][custom_headline type=\"left\" level=\"h3\" class=\"center-text\"][image src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/09/mini-motorcycle-01-e1412969290876.png\" class=\"mbn\"] System Assessment[/custom_headline][line style=\"border-top: solid #999999;\"]ArrayFire performs holistic application audits that establish the current and theoretical maximum performance your application can achieve. Our methods evaluate everything from the hardware up so you can determine bottlenecks and get the maximum return on investment for future development work.\r\n\r\n[button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/consulting\" padding_top=\"40px\" padding_bottom=\"40px\"]Read More...[/button]\r\n\r\n[/column]\r\n\r\n[column type=\"one-third\" last=\"true\" ][custom_headline type=\"left\" level=\"h3\" class=\"center-text\"][image src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/09/mini-plane-01-e1412969527633.png\" class=\"mbn\"] Training [/custom_headline][line style=\"border-top: solid #999999;\"]ArrayFire trains your engineers on the latest techniques in parallel computing including CUDA or OpenCL for CPUs, GPUs, FPGAs, and other accelerators. We offer two- and four-day training sessions that are fully customizable so your team learns skills that they need to accelerate your software.\r\n\r\n[button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/training\" padding_top=\"40px\" padding_bottom=\"40px\"]Read More...[/button]\r\n\r\n[/column]\r\n\r\n[/content_band]\r\n\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n[custom_headline type=\"left\" level=\"h3\" class=\"center-text\"]ArrayFire Library[/custom_headline]\r\n\r\nArrayFire is a free, general-purpose, open-source library that simplifies the process of developing software that targets parallel and massively-parallel architectures including CPUs, GPUs, and other hardware acceleration devices. ArrayFire is used on devices from low-powered mobile phones to high-powered GPU-enabled supercomputers including CPUs from all major vendors (Intel, AMD, Arm), GPUs from the dominant manufacturers (NVIDIA, AMD, and Qualcomm), as well as a variety of other accelerator devices on Windows, Mac, and Linux. \r\n\r\n[button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/download\" padding_top=\"40px\" padding_bottom=\"40px\"]Download ArrayFire[/button]\r\n\r\n[/content_band]','Home','','inherit','closed','closed','','245-revision-v1','','','2016-08-23 09:32:08','2016-08-23 13:32:08','',245,'http://sandbox.arrayfire.com/245-revision-v1/',0,'revision','',0),(9065,18528,'2016-08-23 09:34:50','2016-08-23 13:34:50','[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][column type=\"one-half\"][custom_headline type=\"left\" level=\"h2\"]Call the ArrayFire team[/custom_headline]\r\n\r\nHire us to accelerate your code, train your pros, or even write new code for your organization!\r\n\r\nWe’ve already helped thousands of organizations speed up their code. We’ve accelerated algorithms, sped up data analysis, and solved challenging problems of all types in the past, and we’re confident that we can accelerate your code, too.\r\n\r\nStart by setting up a free consultation to discuss your project with an ArrayFire expert today!\r\n\r\n[gap size=\"5%\"][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"normal\" ]Schedule a consultation[/button][/column][column type=\"one-half\" last=\"true\" class=\"center-text\"][gap size=\"15%\"]<img class=\"aligncenter wp-image-462\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/Bat-signal.png\" alt=\"Bat signal\" width=\"700\" height=\"437\" />[/column][gap size=\"2%\"][/content_band][content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n[column type=\"one-half\"] [custom_headline type=\"left\" level=\"h2\"]Starter Package ($799) [/custom_headline] Hire us for a single day. We\'ll match you with one engineer dedicated for a full day, supported by senior and test engineers throughout the day. Here\'s how it works:\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]We conduct an initial phone call.[/icon_list_item] [icon_list_item type=\"angle-double-right\"]You send us your code or algorithm. [/icon_list_item] [icon_list_item type=\"angle-double-right\"]We analyze your code for potential GPU benefit.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We accelerate as much of your code as is possible within the one-day effort, applying our extensive GPU software libraries.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We produce a final report for you, along with your optimized code.[/icon_list_item] [/icon_list] The final report outlines the best approach to follow for full GPU-acceleration of your code.\r\n\r\n[button type=\"flat\"  shape=\"rounded\" size=\"regular\" href=\"http://sandbox.arrayfire.com/product-category/starter-package/\" title=\"Starter Package\"]Get the Starter Package[/button]\r\n\r\n&nbsp;\r\n\r\n[/column][column type=\"one-half\" last=\"true\" ][gap size=\"15%\"]<img class=\"aligncenter wp-image-4962\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/02/Benchmark-guy-torso-opposite.png\" alt=\"Benchmark guy, torso opposite\" width=\"450\" height=\"397\" />[/column]\r\n<div></div>\r\n[/content_band]\r\n\r\n[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\" ]\r\n\r\n[column type=\"one-half\"]\r\n\r\n&nbsp;\r\n\r\n[gap size=\"12%\"]\r\n\r\n<img class=\"aligncenter size-large wp-image-5100\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/Triumvirate_Exported-1024x599.png\" alt=\"Triumvirate_Exported\" width=\"742\" height=\"434\" />[/column]\r\n\r\n<!-- Link from front page -->\r\n<a name=\"software-design\"></a>\r\n\r\n[column type=\"one-half\"  last=\"true\" ]\r\n[custom_headline type=\"left\" level=\"h2\" ]Software Design[/custom_headline]\r\n\r\nYour hardware can do anything, given the right code. Getting that code right can be tricky when your team is swamped in work or when you\'re new to parallel programming. Bring us in—our team is capable of writing custom code that\'s as unique as your work and tailored to your task. Here\'s what we bring to the table:\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]Excellence in GPU code[/icon_list_item] [icon_list_item type=\"angle-double-right\"]Well-written, efficient C, C++, Fortran, Java, or .NET [/icon_list_item] [icon_list_item type=\"angle-double-right\"]Application porting and integration[/icon_list_item][icon_list_item type=\"angle-double-right\"]Tuning software to peak hardware performance[/icon_list_item][icon_list_item type=\"angle-double-right\"]Scalability of algorithms to handle enterprise-level programs[/icon_list_item] [/icon_list][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"regular\" ]Schedule a consultation[/button][/column] [/content_band]\r\n\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\"  level=\"h2\" ]Case studies[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision to recognize the features of a user’s face. The application then generates an accurate, high-fidelity, three-dimensional model of that face, and virtually places selected frames on the image.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-glasses-com-app-with-3dfit-technology/\" size=\"regular\" ]Read the case study[/button][/promo][/column]</p>\r\n[column type=\"one-half\" last=\"true\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/reveal-logo-promo-01.png\" alt=\"Reveal Imaging\"]Reveal Imaging, an SAIC company, uses ArrayFire in developing threat-detection products for transportation systems—such as cargo and baggage screening in airports—and in securing facilities and public events.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-reveal-imaging/\" size=\"regular\" ]Read the case study[/button][/promo][/column][/content_band]</p>','Consulting','','inherit','closed','closed','','6634-revision-v1','','','2016-08-23 09:34:50','2016-08-23 13:34:50','',6634,'http://sandbox.arrayfire.com/6634-revision-v1/',0,'revision','',0),(9066,18528,'2016-08-23 09:37:43','2016-08-23 13:37:43','[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][column type=\"one-half\"][custom_headline type=\"left\" level=\"h2\"]Call the ArrayFire team[/custom_headline]\r\n\r\nHire us to accelerate your code, train your pros, or even write new code for your organization!\r\n\r\nWe’ve already helped thousands of organizations speed up their code. We’ve accelerated algorithms, sped up data analysis, and solved challenging problems of all types in the past, and we’re confident that we can accelerate your code, too.\r\n\r\nStart by setting up a free consultation to discuss your project with an ArrayFire expert today!\r\n\r\n[gap size=\"5%\"][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"normal\" ]Schedule a consultation[/button][/column][column type=\"one-half\" last=\"true\" class=\"center-text\"][gap size=\"15%\"]<img class=\"aligncenter wp-image-462\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/Bat-signal.png\" alt=\"Bat signal\" width=\"700\" height=\"437\" />[/column][gap size=\"2%\"][/content_band][content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n[column type=\"one-half\"] [custom_headline type=\"left\" level=\"h2\"]Starter Package ($799) [/custom_headline] Hire us for a single day. We\'ll match you with one engineer dedicated for a full day, supported by senior and test engineers throughout the day. Here\'s how it works:\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]We conduct an initial phone call.[/icon_list_item] [icon_list_item type=\"angle-double-right\"]You send us your code or algorithm. [/icon_list_item] [icon_list_item type=\"angle-double-right\"]We analyze your code for potential GPU benefit.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We accelerate as much of your code as is possible within the one-day effort, applying our extensive GPU software libraries.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We produce a final report for you, along with your optimized code.[/icon_list_item] [/icon_list] The final report outlines the best approach to follow for full GPU-acceleration of your code.\r\n\r\n[button type=\"flat\"  shape=\"rounded\" size=\"regular\" href=\"http://sandbox.arrayfire.com/product-category/starter-package/\" title=\"Starter Package\"]Get the Starter Package[/button]\r\n\r\n&nbsp;\r\n\r\n[/column][column type=\"one-half\" last=\"true\" ][gap size=\"15%\"]<img class=\"aligncenter wp-image-4962\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/02/Benchmark-guy-torso-opposite.png\" alt=\"Benchmark guy, torso opposite\" width=\"450\" height=\"397\" />[/column]\r\n<div></div>\r\n[/content_band]\r\n\r\n[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\" ]\r\n\r\n[column type=\"one-half\"]\r\n\r\n<!-- Link from front page -->\r\n<a name=\"software-design\"></a>\r\n\r\n&nbsp;\r\n\r\n[gap size=\"12%\"]\r\n\r\n<img class=\"aligncenter size-large wp-image-5100\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/Triumvirate_Exported-1024x599.png\" alt=\"Triumvirate_Exported\" width=\"742\" height=\"434\" />\r\n\r\n[/column]\r\n\r\n[column type=\"one-half\"  last=\"true\" ]\r\n[custom_headline type=\"left\" level=\"h2\" ]Software Design[/custom_headline]\r\n\r\nYour hardware can do anything, given the right code. Getting that code right can be tricky when your team is swamped in work or when you\'re new to parallel programming. Bring us in—our team is capable of writing custom code that\'s as unique as your work and tailored to your task. Here\'s what we bring to the table:\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]Excellence in GPU code[/icon_list_item] [icon_list_item type=\"angle-double-right\"]Well-written, efficient C, C++, Fortran, Java, or .NET [/icon_list_item] [icon_list_item type=\"angle-double-right\"]Application porting and integration[/icon_list_item][icon_list_item type=\"angle-double-right\"]Tuning software to peak hardware performance[/icon_list_item][icon_list_item type=\"angle-double-right\"]Scalability of algorithms to handle enterprise-level programs[/icon_list_item] [/icon_list][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"regular\" ]Schedule a consultation[/button][/column] [/content_band]\r\n\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\"  level=\"h2\" ]Case studies[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision to recognize the features of a user’s face. The application then generates an accurate, high-fidelity, three-dimensional model of that face, and virtually places selected frames on the image.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-glasses-com-app-with-3dfit-technology/\" size=\"regular\" ]Read the case study[/button][/promo][/column]</p>\r\n[column type=\"one-half\" last=\"true\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/reveal-logo-promo-01.png\" alt=\"Reveal Imaging\"]Reveal Imaging, an SAIC company, uses ArrayFire in developing threat-detection products for transportation systems—such as cargo and baggage screening in airports—and in securing facilities and public events.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-reveal-imaging/\" size=\"regular\" ]Read the case study[/button][/promo][/column][/content_band]</p>','Consulting','','inherit','closed','closed','','6634-revision-v1','','','2016-08-23 09:37:43','2016-08-23 13:37:43','',6634,'http://sandbox.arrayfire.com/6634-revision-v1/',0,'revision','',0),(9068,18528,'2016-08-23 10:03:02','2016-08-23 14:03:02','','machine-line','','inherit','open','closed','','machine-line','','','2016-08-23 10:03:02','2016-08-23 14:03:02','',6634,'http://sandbox.arrayfire.com/wp-content/uploads/2014/11/machine-line.png',0,'attachment','image/png',0),(9069,18528,'2016-08-23 11:58:11','2016-08-23 15:58:11','[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][column type=\"one-half\"][custom_headline type=\"left\" level=\"h2\"]Call the ArrayFire team[/custom_headline]\r\n\r\nHire us to accelerate your code, train your pros, or even write new code for your organization!\r\n\r\nWe’ve already helped thousands of organizations speed up their code. We’ve accelerated algorithms, sped up data analysis, and solved challenging problems of all types in the past, and we’re confident that we can accelerate your code, too.\r\n\r\nStart by setting up a free consultation to discuss your project with an ArrayFire expert today!\r\n\r\n[gap size=\"5%\"][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"normal\" ]Schedule a consultation[/button][/column][column type=\"one-half\" last=\"true\" class=\"center-text\"][gap size=\"15%\"]<img class=\"aligncenter wp-image-462\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/Bat-signal.png\" alt=\"Bat signal\" width=\"700\" height=\"437\" />[/column][gap size=\"2%\"][/content_band]\r\n\r\n<!-- Starter Package Band -->\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n[column type=\"one-half\"] [custom_headline type=\"left\" level=\"h2\"]Starter Package ($799) [/custom_headline] Hire us for a single day. We\'ll match you with one engineer dedicated for a full day, supported by senior and test engineers throughout the day. Here\'s how it works:\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]We conduct an initial phone call.[/icon_list_item] [icon_list_item type=\"angle-double-right\"]You send us your code or algorithm. [/icon_list_item] [icon_list_item type=\"angle-double-right\"]We analyze your code for potential GPU benefit.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We accelerate as much of your code as is possible within the one-day effort, applying our extensive GPU software libraries.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We produce a final report for you, along with your optimized code.[/icon_list_item] [/icon_list] The final report outlines the best approach to follow for full GPU-acceleration of your code.\r\n\r\n[button type=\"flat\"  shape=\"rounded\" size=\"regular\" href=\"http://sandbox.arrayfire.com/product-category/starter-package/\" title=\"Starter Package\"]Get the Starter Package[/button]\r\n\r\n&nbsp;\r\n\r\n[/column][column type=\"one-half\" last=\"true\" ][gap size=\"15%\"]<img class=\"aligncenter wp-image-4962\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/02/Benchmark-guy-torso-opposite.png\" alt=\"Benchmark guy, torso opposite\" width=\"450\" height=\"397\" />[/column]\r\n<div></div>\r\n[/content_band]\r\n\r\n<!-- Software Design Horizontal Band -->\r\n[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\" ]\r\n\r\n[column type=\"one-half\"]\r\n\r\n<!-- Link from home page -->\r\n<a name=\"software-design\"></a>\r\n\r\n&nbsp;\r\n\r\n[gap size=\"12%\"]\r\n\r\n<img class=\"aligncenter size-large wp-image-5100\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/Triumvirate_Exported-1024x599.png\" alt=\"Triumvirate_Exported\" width=\"742\" height=\"434\" />\r\n\r\n[/column]\r\n\r\n[column type=\"one-half\"  last=\"true\" ]\r\n[custom_headline type=\"left\" level=\"h2\" ]Software Design[/custom_headline]\r\n\r\nYour hardware can do anything, given the right code. Getting that code right can be tricky when your team is swamped in work or when you\'re new to parallel programming. Bring us in—our team is capable of writing custom code that\'s as unique as your work and tailored to your task. Here\'s what we bring to the table:\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]Excellence in GPU code[/icon_list_item] [icon_list_item type=\"angle-double-right\"]Well-written, efficient C, C++, Fortran, Java, or .NET [/icon_list_item] [icon_list_item type=\"angle-double-right\"]Application porting and integration[/icon_list_item][icon_list_item type=\"angle-double-right\"]Tuning software to peak hardware performance[/icon_list_item][icon_list_item type=\"angle-double-right\"]Scalability of algorithms to handle enterprise-level programs[/icon_list_item] [/icon_list][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"regular\" ]Schedule a consultation[/button][/column] [/content_band]\r\n\r\n<!-- System Evaluation Horizontal Band -->\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n<!-- Link from home page -->\r\n<a name=\"system-evaluation\"></a>\r\n\r\n[column type=\"one-half\"  last=\"true\" ]\r\n[custom_headline type=\"left\" level=\"h2\" ]System Evaluation[/custom_headline]\r\n\r\nGetting the maximum performance out of your system is tricky to say the least. The interplay between network communication, disk operations, and processing can be tricky to understand and even more difficult to profile correctly. Our team excels at benchmarking and we know how to find the bottleknecks in your application quickly. Hire us to evaluate sections of your code or the entire system. We do it all! Here is what we bring to the table:\r\n\r\n&nbsp;\r\n\r\n[icon_list]\r\n[icon_list_item type=\"angle-double-right\"]System architecture and design expertise\r\n[/icon_list_item]\r\n\r\n[icon_list_item type=\"angle-double-right\"]In-depth knowledge of optimization processes for CPUs, GPUs, and FPGAs[/icon_list_item]\r\n\r\n[icon_list_item type=\"angle-double-right\"]Awareness of the latest industry trends and tools[/icon_list_item]\r\n\r\n[icon_list_item type=\"angle-double-right\"]Hands on experience auditing on large, complicated systems.[/icon_list_item]\r\n\r\n[/icon_list][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"regular\" ]Schedule a consultation[/button][/column]\r\n\r\n[column type=\"one-half\"]\r\n[gap size=\"12%\"]\r\n\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/11/machine-line.png\"><img class=\"aligncenter size-large wp-image-9068\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/11/machine-line-1024x588.png\" alt=\"machine-line\" width=\"742\" height=\"426\" /></a>\r\n\r\n[/column]\r\n\r\n[/content_band]\r\n\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\"  level=\"h2\" ]Case studies[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision to recognize the features of a user’s face. The application then generates an accurate, high-fidelity, three-dimensional model of that face, and virtually places selected frames on the image.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-glasses-com-app-with-3dfit-technology/\" size=\"regular\" ]Read the case study[/button][/promo][/column]</p>\r\n[column type=\"one-half\" last=\"true\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/reveal-logo-promo-01.png\" alt=\"Reveal Imaging\"]Reveal Imaging, an SAIC company, uses ArrayFire in developing threat-detection products for transportation systems—such as cargo and baggage screening in airports—and in securing facilities and public events.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-reveal-imaging/\" size=\"regular\" ]Read the case study[/button][/promo][/column][/content_band]</p>','Consulting','','inherit','closed','closed','','6634-revision-v1','','','2016-08-23 11:58:11','2016-08-23 15:58:11','',6634,'http://sandbox.arrayfire.com/6634-revision-v1/',0,'revision','',0),(9070,18528,'2016-08-23 11:59:36','2016-08-23 15:59:36','[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"40px\" padding_bottom=\"10px\"][column type=\"two-fifths\"]\r\n\r\n[custom_headline type=\"left\" level=\"h3\"]If you want faster code, you\'ve come to the right place.[/custom_headline][gap size=\"3%\"][button  type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/download\" size=\"x-large\" block=\"true\"]Download ArrayFire[/button]\r\n\r\n[gap size=\"5%\"]\r\n\r\n[button  type=\"flat\" block=\"true\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/consulting/\" size=\"x-large\" ]Schedule a consultation[/button][gap size=\"2%\"]\r\n\r\n[/column][column type=\"three-fifths\" last=\"true\"][gap size=\"7%\"]\r\n<div id=\"wistia_rj2bar3xxp\" class=\"wistia_embed\" style=\"width: 640px; height: 388px;\"></div>\r\n<script src=\"//fast.wistia.com/assets/external/E-v1.js\" charset=\"ISO-8859-1\"></script><script>// <![CDATA[\r\nwistiaEmbed = Wistia.embed(\"rj2bar3xxp\");\r\n// ]]></script>\r\n[/column]\r\n<div id=\"arrayfire\"></div>\r\n[/content_band]\r\n\r\n\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n[custom_headline type=\"left\" level=\"h3\" class=\"center-text\"]Services[/custom_headline]\r\n\r\nArrayFire specializes in developing accelerated, scalable computing solutions on modern computational platforms for our clients. As an industry leader in high performance computing for nearly 10 years, ArrayFire continues to drive innovation in all areas of accelerated computing, ranging from apps deployed on low-powered and mobile platforms to scientific simulations on high-end supercomputers.\r\n\r\n[/content_band]\r\n\r\n[content_band bg_color=\"#ffffff\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"40px\" padding_bottom=\"10px\"]\r\n\r\n[column type=\"one-third\" ][custom_headline type=\"left\" level=\"h3\" class=\"center-text\"][image src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/car-e1412967813807.png\" class=\"mbn\"] Software Design[/custom_headline]\r\n\r\n[line style=\"border-top: solid #999999;\"]ArrayFire has worked with hundreds of companies and entrepreneurs to develop custom, high performance software solutions for their unique problems. We use the latest software development methods, profiling tools, and deployment methods to deliver scalable solutions for your present and future business goals.\r\n\r\n[button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/consulting#software-design\" padding_top=\"40px\" padding_bottom=\"40px\"]Read more...[/button]\r\n[/column]\r\n\r\n[column type=\"one-third\" ][custom_headline type=\"left\" level=\"h3\" class=\"center-text\"][image src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/09/mini-motorcycle-01-e1412969290876.png\" class=\"mbn\"] System Assessment[/custom_headline][line style=\"border-top: solid #999999;\"]ArrayFire performs holistic application audits that establish the current and theoretical maximum performance your application can achieve. Our methods evaluate everything from the hardware up so you can determine bottlenecks and get the maximum return on investment for future development work.\r\n\r\n[button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/consulting#system-evaluation\" padding_top=\"40px\" padding_bottom=\"40px\"]Read More...[/button]\r\n\r\n[/column]\r\n\r\n[column type=\"one-third\" last=\"true\" ][custom_headline type=\"left\" level=\"h3\" class=\"center-text\"][image src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/09/mini-plane-01-e1412969527633.png\" class=\"mbn\"] Training [/custom_headline][line style=\"border-top: solid #999999;\"]ArrayFire trains your engineers on the latest techniques in parallel computing including CUDA or OpenCL for CPUs, GPUs, FPGAs, and other accelerators. We offer two- and four-day training sessions that are fully customizable so your team learns skills that they need to accelerate your software.\r\n\r\n[button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/training\" padding_top=\"40px\" padding_bottom=\"40px\"]Read More...[/button]\r\n\r\n[/column]\r\n\r\n[/content_band]\r\n\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n[custom_headline type=\"left\" level=\"h3\" class=\"center-text\"]ArrayFire Library[/custom_headline]\r\n\r\nArrayFire is a free, general-purpose, open-source library that simplifies the process of developing software that targets parallel and massively-parallel architectures including CPUs, GPUs, and other hardware acceleration devices. ArrayFire is used on devices from low-powered mobile phones to high-powered GPU-enabled supercomputers including CPUs from all major vendors (Intel, AMD, Arm), GPUs from the dominant manufacturers (NVIDIA, AMD, and Qualcomm), as well as a variety of other accelerator devices on Windows, Mac, and Linux. \r\n\r\n[button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/download\" padding_top=\"40px\" padding_bottom=\"40px\"]Download ArrayFire[/button]\r\n\r\n[/content_band]','Home','','inherit','closed','closed','','245-revision-v1','','','2016-08-23 11:59:36','2016-08-23 15:59:36','',245,'http://sandbox.arrayfire.com/245-revision-v1/',0,'revision','',0),(9071,18528,'2016-08-23 13:48:17','2016-08-23 17:48:17','Learn how ArrayFire has worked in real code, including applications in academia, finance, government, life sciences, manufacturing, media, and oil & gas. With ArrayFire, you get the best in accelerated computing, ensuring real success in your business and research objectives. Below we show some of our favorite projects we\'ve worked on in the past including:\r\n\r\n<ul>\r\n<li><a href=\"#computer-vision\">Computer Vision</a></li>\r\n<li><a href=\"#defense\">Defense</a></li>\r\n<li><a href=\"#finance\">Finance</a></li>\r\n<li><a href=\"#biomedical\">Biomedical Applications</a></li>\r\n</ul>\r\n\r\n\r\n<a name=\"computer-vision\"></a>\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\" level=\"h2\" ]Computer Vision[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"https://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision to recognize the features of a user’s face. The application then generates an accurate, high-fidelity, three-dimensional model of that face, and virtually places selected frames on the image.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"https://sandbox.arrayfire.com/case-study-glasses-com-app-with-3dfit-technology/\" size=\"regular\" ]Read the case study[/button][/promo][/column]</p>\r\n[/content_band]</p>\r\n\r\n<a name=\"defense\"></a>\r\n[content_band bg_color=\"#ffffff\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\" level=\"h2\" ]Defense[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\" last=\"true\"][promo image=\"https://sandbox.arrayfire.com/wp-content/uploads/2014/10/reveal-logo-promo-01.png\" alt=\"Reveal Imaging\"]Reveal Imaging, an SAIC company, uses ArrayFire in developing threat-detection products for transportation systems—such as cargo and baggage screening in airports—and in securing facilities and public events.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"https://sandbox.arrayfire.com/case-study-reveal-imaging/\" size=\"regular\" ]Read the case study[/button][/promo][/column][/content_band]</p>\r\n\r\n<a name=\"finance\"></a>\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\" level=\"h2\" ]Financial Services[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"https://sandbox.arrayfire.com/wp-content/uploads/2015/04/philadelphia-skyline.png\" alt=\"Fortune 300 Financial Services Company\"]\r\nArrayFire evaluated the performance of a hedge platform implemented in CUDA. Our final deliverable consisted of a 100 page report discussing the code base, performance and optimization, fault tolerance, scalability, compatibility with emerging trends, and  disaster recovery options. Our suggestions resulted in a 20% decrease in production runtimes.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"https://sandbox.arrayfire.com/case-study-fortune-300-financial-company\" size=\"regular\" ]Read this case study[/button][/promo][/column]</p>\r\n\r\n[column type=\"one-half\"][promo image=\"https://sandbox.arrayfire.com/wp-content/uploads/2016/08/pT5oEjE8c.jpg\" alt=\"Fortune 200 Insurance Company\"]\r\nArrayFire was hired to conduct a comprehensive audit of two hedging platforms. Our final deliverable was a 160 page technical report, a middle-management report, and five executive summaries detailing our findings. ArrayFire located key bottleknecks that, once corrected, decreased the total nightly runtime by 39% without any major code or system modifications.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"https://sandbox.arrayfire.com/case-study-fortune-200-insurance-company\" size=\"regular\" ]Read this case study[/button][/promo][/column]</p>\r\n[/content_band]\r\n\r\n<a name=\"biomedical\"></a>\r\n[content_band bg_color=\"#ffffff\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\" level=\"h2\" ]Biomedical Services[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"https://sandbox.arrayfire.com/wp-content/uploads/2016/08/watermark-sleepmed-logo.png\" alt=\"SleepMed\"]\r\nSleepMed is the nation leader in diagnosing and treating sleep disorders in the United States. SleepMed contracted with ArrayFire to develop a detailed test suite and refactor their code to permit easier addition of new hardware. Through aggressive testing and modularization, ArrayFire reduced their code length by nearly 40% while providing a comprehensive set of tests for each module.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"https://sandbox.arrayfire.com/case-study-sleepmed/\" size=\"regular\" ]Read this case study[/button][/promo][/column]</p>\r\n\r\n[/content_band]\r\n\r\n','Case Studies','','publish','closed','closed','','case-studies','','','2018-06-26 15:40:32','2018-06-26 19:40:32','',0,'http://sandbox.arrayfire.com/?page_id=9071',0,'page','',0),(9072,18528,'2016-08-23 13:05:28','2016-08-23 17:05:28','','Case Studies','','inherit','closed','closed','','9071-revision-v1','','','2016-08-23 13:05:28','2016-08-23 17:05:28','',9071,'http://sandbox.arrayfire.com/9071-revision-v1/',0,'revision','',0),(9073,18528,'2016-08-23 13:07:17','2016-08-23 17:07:17','[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\" level=\"h2\" ]Software Development[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision to recognize the features of a user’s face. The application then generates an accurate, high-fidelity, three-dimensional model of that face, and virtually places selected frames on the image.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-glasses-com-app-with-3dfit-technology/\" size=\"regular\" ]Read the case study[/button][/promo][/column]</p>\r\n\r\n[column type=\"one-half\" last=\"true\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/reveal-logo-promo-01.png\" alt=\"Reveal Imaging\"]Reveal Imaging, an SAIC company, uses ArrayFire in developing threat-detection products for transportation systems—such as cargo and baggage screening in airports—and in securing facilities and public events.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-reveal-imaging/\" size=\"regular\" ]Read the case study[/button][/promo][/column][/content_band]','Case Studies','','inherit','closed','closed','','9071-revision-v1','','','2016-08-23 13:07:17','2016-08-23 17:07:17','',9071,'http://sandbox.arrayfire.com/9071-revision-v1/',0,'revision','',0),(9074,18528,'2016-08-23 13:47:16','2016-08-23 17:47:16','[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][column type=\"one-half\"][custom_headline type=\"left\" level=\"h2\"]Call the ArrayFire team[/custom_headline]\r\n\r\nHire us to accelerate your code, train your pros, or even write new code for your organization!\r\n\r\nWe’ve already helped thousands of organizations speed up their code. We’ve accelerated algorithms, sped up data analysis, and solved challenging problems of all types in the past, and we’re confident that we can accelerate your code, too.\r\n\r\nStart by setting up a free consultation to discuss your project with an ArrayFire expert today!\r\n\r\n[gap size=\"5%\"][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"normal\" ]Schedule a consultation[/button][/column][column type=\"one-half\" last=\"true\" class=\"center-text\"][gap size=\"15%\"]<img class=\"aligncenter wp-image-462\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/01/Bat-signal.png\" alt=\"Bat signal\" width=\"700\" height=\"437\" />[/column][gap size=\"2%\"][/content_band]\r\n\r\n<!-- Starter Package Band -->\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n[column type=\"one-half\"] [custom_headline type=\"left\" level=\"h2\"]Starter Package ($799) [/custom_headline] Hire us for a single day. We\'ll match you with one engineer dedicated for a full day, supported by senior and test engineers throughout the day. Here\'s how it works:\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]We conduct an initial phone call.[/icon_list_item] [icon_list_item type=\"angle-double-right\"]You send us your code or algorithm. [/icon_list_item] [icon_list_item type=\"angle-double-right\"]We analyze your code for potential GPU benefit.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We accelerate as much of your code as is possible within the one-day effort, applying our extensive GPU software libraries.[/icon_list_item][icon_list_item type=\"angle-double-right\"]We produce a final report for you, along with your optimized code.[/icon_list_item] [/icon_list] The final report outlines the best approach to follow for full GPU-acceleration of your code.\r\n\r\n[button type=\"flat\"  shape=\"rounded\" size=\"regular\" href=\"http://sandbox.arrayfire.com/product-category/starter-package/\" title=\"Starter Package\"]Get the Starter Package[/button]\r\n\r\n&nbsp;\r\n\r\n[/column][column type=\"one-half\" last=\"true\" ][gap size=\"15%\"]<img class=\"aligncenter wp-image-4962\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/02/Benchmark-guy-torso-opposite.png\" alt=\"Benchmark guy, torso opposite\" width=\"450\" height=\"397\" />[/column]\r\n<div></div>\r\n[/content_band]\r\n\r\n<!-- Software Design Horizontal Band -->\r\n[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"0px\" margin_top=\"0px\" padding_bottom=\"40px\" ]\r\n\r\n<!-- Link from home page -->\r\n<a name=\"software-design\"></a>\r\n\r\n[custom_headline type=\"left\" level=\"h2\" class=\"center-text\"]Software Design[/custom_headline]\r\n\r\nYour hardware can do anything, given the right code. Getting that code right can be tricky when your team is swamped in work or when you\'re new to parallel programming. Bring us in—our team is capable of writing custom code that\'s as unique as your work and tailored to your task. Here\'s what we bring to the table:\r\n\r\n[column type=\"one-half\"]\r\n\r\n[icon_list] [icon_list_item type=\"angle-double-right\"]Excellence in GPU code[/icon_list_item] [icon_list_item type=\"angle-double-right\"]Well-written, efficient C, C++, Fortran, Java, or .NET [/icon_list_item] [icon_list_item type=\"angle-double-right\"]Application porting and integration[/icon_list_item][icon_list_item type=\"angle-double-right\"]Tuning software to peak hardware performance[/icon_list_item][icon_list_item type=\"angle-double-right\"]Scalability of algorithms to handle enterprise-level programs[/icon_list_item] [/icon_list]\r\n\r\nRead more about our capabilities in our <a href=\"/case-studies\">case studies</a> or check out one of our more involved projects to the right.\r\n\r\n[button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"regular\" ]Schedule a consultation[/button]\r\n[/column]\r\n\r\n[column type=\"one-half\"]\r\n[promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision functionality and three-dimentional head modeling code implemented and accelerated by ArrayFire. This code generates accurate, high-fidelity images that let a user virtually try on thousands of pairs of glasses without leaving the comfort of their own home.\r\n\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-studies\" size=\"regular\" ]Read the case study[/button]</p>\r\n[/promo]\r\n\r\n[/column]\r\n\r\n [/content_band]\r\n\r\n<!-- System Evaluation Horizontal Band -->\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"]\r\n\r\n<!-- Link from home page -->\r\n<a name=\"system-evaluation\"></a>\r\n\r\n[column type=\"one-half\"  last=\"true\" ]\r\n[custom_headline type=\"left\" level=\"h2\" ]System Evaluation[/custom_headline]\r\n\r\nGetting the maximum performance out of your system is tricky to say the least. The interplay between network communication, disk operations, and processing can be tricky to understand and even more difficult to profile correctly. Our team excels at benchmarking and we know how to find the bottleknecks in your application quickly. Hire us to evaluate sections of your code or the entire system. We do it all! Here is what we bring to the table:\r\n\r\n&nbsp;\r\n\r\n[icon_list]\r\n[icon_list_item type=\"angle-double-right\"]System architecture and design expertise\r\n[/icon_list_item]\r\n\r\n[icon_list_item type=\"angle-double-right\"]In-depth knowledge of optimization processes for CPUs, GPUs, and FPGAs[/icon_list_item]\r\n\r\n[icon_list_item type=\"angle-double-right\"]Awareness of the latest industry trends and tools[/icon_list_item]\r\n\r\n[icon_list_item type=\"angle-double-right\"]Hands on experience auditing on large, complicated systems.[/icon_list_item]\r\n\r\n[/icon_list][button  type=\"flat\" shape=\"rounded\" href=\"http://meetme.so/arrayfire\" size=\"regular\" ]Schedule a consultation[/button][/column]\r\n\r\n[column type=\"one-half\"]\r\n[gap size=\"12%\"]\r\n\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/11/machine-line.png\"><img class=\"aligncenter size-large wp-image-9068\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/11/machine-line-1024x588.png\" alt=\"machine-line\" width=\"742\" height=\"426\" /></a>\r\n\r\n[/column]\r\n\r\n[/content_band]','Consulting','','inherit','closed','closed','','6634-revision-v1','','','2016-08-23 13:47:16','2016-08-23 17:47:16','',6634,'http://sandbox.arrayfire.com/6634-revision-v1/',0,'revision','',0),(9075,18528,'2016-08-23 13:48:36','2016-08-23 17:48:36','[content_band bg_color=\"#ffffff\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\" level=\"h2\" ]Software Development[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision to recognize the features of a user’s face. The application then generates an accurate, high-fidelity, three-dimensional model of that face, and virtually places selected frames on the image.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-glasses-com-app-with-3dfit-technology/\" size=\"regular\" ]Read the case study[/button][/promo][/column]</p>\r\n\r\n[column type=\"one-half\" last=\"true\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/reveal-logo-promo-01.png\" alt=\"Reveal Imaging\"]Reveal Imaging, an SAIC company, uses ArrayFire in developing threat-detection products for transportation systems—such as cargo and baggage screening in airports—and in securing facilities and public events.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-reveal-imaging/\" size=\"regular\" ]Read the case study[/button][/promo][/column][/content_band]','Case Studies','','inherit','closed','closed','','9071-revision-v1','','','2016-08-23 13:48:36','2016-08-23 17:48:36','',9071,'http://sandbox.arrayfire.com/9071-revision-v1/',0,'revision','',0),(9076,18528,'2016-08-26 14:15:56','2016-08-26 18:15:56','Learn how ArrayFire has worked in real code, including applications in academia, finance, government, life sciences, manufacturing, media, and oil & gas. With ArrayFire, you get the best in accelerated computing, ensuring real success in your business and research objectives. Below we show some of our favorite projects we\'ve worked on in the past including:\r\n\r\n<ul>\r\n<li><a href=\"#computer-vision\">Computer Vision</a></li>\r\n<li><a href=\"#defense\">Defense</a></li>\r\n<li><a href=\"#finance\">Finance</a></li>\r\n<li><a href=\"#biomedical\">Biomedical Applications</a></li>\r\n</ul>\r\n\r\n\r\n<a name=\"computer-vision\"></a>\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\" level=\"h2\" ]Computer Vision[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision to recognize the features of a user’s face. The application then generates an accurate, high-fidelity, three-dimensional model of that face, and virtually places selected frames on the image.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-glasses-com-app-with-3dfit-technology/\" size=\"regular\" ]Read the case study[/button][/promo][/column]</p>\r\n[/content_band]</p>\r\n\r\n<a name=\"defense\"></a>\r\n[content_band bg_color=\"#ffffff\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\" level=\"h2\" ]Defense[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\" last=\"true\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/reveal-logo-promo-01.png\" alt=\"Reveal Imaging\"]Reveal Imaging, an SAIC company, uses ArrayFire in developing threat-detection products for transportation systems—such as cargo and baggage screening in airports—and in securing facilities and public events.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-reveal-imaging/\" size=\"regular\" ]Read the case study[/button][/promo][/column][/content_band]</p>\r\n\r\n<a name=\"finance\"></a>\r\n[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\" level=\"h2\" ]Financial Services[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/04/philadelphia-skyline.png\" alt=\"Fortune 300 Financial Services Company\"]\r\nArrayFire evaluated the performance of a hedge platform implemented in CUDA. Our final deliverable consisted of a 100 page report discussing the code base, performance and optimization, fault tolerance, scalability, compatibility with emerging trends, and  disaster recovery options. Our suggestions resulted in a 20% decrease in production runtimes.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-fortune-300-financial-company\" size=\"regular\" ]Read this case study[/button][/promo][/column]</p>\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/08/pT5oEjE8c.jpg\" alt=\"Fortune 200 Insurance Company\"]\r\nArrayFire was hired to conduct a comprehensive audit of two hedging platforms. Our final deliverable was a 160 page technical report, a middle-management report, and five executive summaries detailing our findings. ArrayFire located key bottleknecks that, once corrected, decreased the total nightly runtime by 39% without any major code or system modifications.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-fortune-200-insurance-company\" size=\"regular\" ]Read this case study[/button][/promo][/column]</p>\r\n[/content_band]\r\n\r\n<a name=\"biomedical\"></a>\r\n[content_band bg_color=\"#ffffff\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\" level=\"h2\" ]Biomedical Services[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2016/08/watermark-sleepmed-logo.png\" alt=\"SleepMed\"]\r\nSleepMed is the nation leader in diagnosing and treating sleep disorders in the United States. SleepMed contracted with ArrayFire to develop a detailed test suite and refactor their code to permit easier addition of new hardware. Through aggressive testing and modularization, ArrayFire reduced their code length by nearly 40% while providing a comprehensive set of tests for each module.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-sleepmed/\" size=\"regular\" ]Read this case study[/button][/promo][/column]</p>\r\n\r\n[/content_band]\r\n\r\n','Case Studies','','inherit','closed','closed','','9071-autosave-v1','','','2016-08-26 14:15:56','2016-08-26 18:15:56','',9071,'http://sandbox.arrayfire.com/9071-autosave-v1/',0,'revision','',0),(9077,18528,'2016-08-23 13:50:07','2016-08-23 17:50:07','Below we show some of our favorite projects we\'ve worked on in the past. We\'ve worked with clients from the financial sector, academia, entertainment, and defense sectors.\r\n\r\n[content_band bg_color=\"#ffffff\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\" level=\"h2\" ]Software Development[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision to recognize the features of a user’s face. The application then generates an accurate, high-fidelity, three-dimensional model of that face, and virtually places selected frames on the image.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-glasses-com-app-with-3dfit-technology/\" size=\"regular\" ]Read the case study[/button][/promo][/column]</p>\r\n\r\n[column type=\"one-half\" last=\"true\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/reveal-logo-promo-01.png\" alt=\"Reveal Imaging\"]Reveal Imaging, an SAIC company, uses ArrayFire in developing threat-detection products for transportation systems—such as cargo and baggage screening in airports—and in securing facilities and public events.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-reveal-imaging/\" size=\"regular\" ]Read the case study[/button][/promo][/column][/content_band]','Case Studies','','inherit','closed','closed','','9071-revision-v1','','','2016-08-23 13:50:07','2016-08-23 17:50:07','',9071,'http://sandbox.arrayfire.com/9071-revision-v1/',0,'revision','',0),(9078,18528,'2016-08-23 13:50:24','2016-08-23 17:50:24','We\'ve worked with clients from the financial sector, academia, entertainment, and defense sectors. Below we show some of our favorite projects we\'ve worked on in the past.\r\n\r\n[content_band bg_color=\"#ffffff\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\" level=\"h2\" ]Software Development[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision to recognize the features of a user’s face. The application then generates an accurate, high-fidelity, three-dimensional model of that face, and virtually places selected frames on the image.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-glasses-com-app-with-3dfit-technology/\" size=\"regular\" ]Read the case study[/button][/promo][/column]</p>\r\n\r\n[column type=\"one-half\" last=\"true\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/reveal-logo-promo-01.png\" alt=\"Reveal Imaging\"]Reveal Imaging, an SAIC company, uses ArrayFire in developing threat-detection products for transportation systems—such as cargo and baggage screening in airports—and in securing facilities and public events.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-reveal-imaging/\" size=\"regular\" ]Read the case study[/button][/promo][/column][/content_band]','Case Studies','','inherit','closed','closed','','9071-revision-v1','','','2016-08-23 13:50:24','2016-08-23 17:50:24','',9071,'http://sandbox.arrayfire.com/9071-revision-v1/',0,'revision','',0),(9079,18528,'2016-08-23 13:50:52','2016-08-23 17:50:52','We\'ve worked with clients from the financial sector, academia, entertainment, and defense sectors. Below we show some of our favorite projects we\'ve worked on in the past.\r\n\r\n[content_band bg_color=\"#ffffff\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"10px\" padding_bottom=\"40px\"][custom_headline type=\"left\" level=\"h2\" ]Computer Vision[/custom_headline][gap size=\"4%\"]\r\n\r\n[column type=\"one-half\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/glasses-logo-promo-01.png\" alt=\"Glasses.com\"]The Glasses.com app relies on computer vision to recognize the features of a user’s face. The application then generates an accurate, high-fidelity, three-dimensional model of that face, and virtually places selected frames on the image.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-glasses-com-app-with-3dfit-technology/\" size=\"regular\" ]Read the case study[/button][/promo][/column]</p>\r\n\r\n[column type=\"one-half\" last=\"true\"][promo image=\"http://sandbox.arrayfire.com/wp-content/uploads/2014/10/reveal-logo-promo-01.png\" alt=\"Reveal Imaging\"]Reveal Imaging, an SAIC company, uses ArrayFire in developing threat-detection products for transportation systems—such as cargo and baggage screening in airports—and in securing facilities and public events.\r\n<p style=\"text-align: center;\">[button type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/case-study-reveal-imaging/\" size=\"regular\" ]Read the case study[/button][/promo][/column][/content_band]','Case Studies','','inherit','closed','closed','','9071-revision-v1','','','2016-08-23 13:50:52','2016-08-23 17:50:52','',9071,'http://sandbox.arrayfire.com/9071-revision-v1/',0,'revision','',0),(9081,18528,'2016-08-23 15:49:21','2016-08-23 19:49:21','','philadelphia-skyline','','inherit','open','closed','','philadelphia-skyline','','','2016-08-23 15:49:21','2016-08-23 19:49:21','',6928,'http://sandbox.arrayfire.com/wp-content/uploads/2015/04/philadelphia-skyline.png',0,'attachment','image/png',0),(9082,18528,'2016-08-23 15:49:32','2016-08-23 19:49:32','[content_band inner_container=\"true\" no_margin=\"true\" border=\"top\" padding_top=\"40px\" padding_bottom=\"40px\"][column type=\"one-fifth\"].[/column][column type=\"three-fifths\"][custom_headline type=\"left\" level=\"h3\"]Fortune 300 Financial Company[/custom_headline][/column][column type=\"one-fifth\" last=\"true\"].[/column][gap size=\"3%\"]\r\n\r\n[column type=\"one-fifth\"].[/column][column type=\"three-fifths\"]\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/04/philadelphia-skyline.png\"><img class=\"aligncenter size-full wp-image-9081\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/04/philadelphia-skyline.png\" alt=\"philadelphia-skyline\" width=\"720\" height=\"160\" /></a>\r\n\r\nA Fortune 300 Financial Company (F3F Company herafter) ported their CPU code (C/C++) to CUDA and this enabled them to speed up the necessary financial calculations. Their primary objective was to reduce the time taken to run this code. Before porting to CUDA, they required ten to twelve hours to run the entire code. After porting to CUDA, they were able to do the same work in about 30 minutes.\r\n\r\nThe F3F Company has several C/C++ programmers in their team and they trained many of them to use CUDA. Their code used CUDA to speed up a calculation using Monte Carlo methods to analyze various scenarios in their hedge-fund projection system (HPS). The major portion of their calculations were carried out on independent policies and thus the entire process was ideal for parallel programming (no communication bottlenecks).\r\n<h4>Mission</h4>\r\nThe CPU code was slow and this was holding them back. Because the code took the entire night to run, they were not able to run several different scenarios and take corrective action based on the results of the code. The primary reason to move to GPUs was to speed up the calculations.\r\n\r\nThe F3F Company invested heavily into building CPU+GPU clusters relying on AMAX. They had the code running on four compute nodes, with four GPUs on each node. Each GPU was a NVIDIA K20X. The code ran on 16 GPUs. They were in the process of installing an even bigger system, with 64 total GPUs.\r\n<h4>Action</h4>\r\nOur initial plan was adjusted as the project progressed, and we identified key areas that needed improvement. The first couple of weeks were somewhat tricky because we were not able to get a working version of the codebase that was representative of the code they were actually running. This was because the code was in a very active state of development and integration on their side.\r\n\r\nWe made several suggestions to improve the efficiency of the codebase, but most of these were minor improvements. There were two levels of parallelism in the code—at the kernel level (GPU CUDA code) and the cluster level (MPI). One of the really useful suggestions we made was relevant at the MPI level, where we suggested they organize their policies in a random manner to distribute the computing load in a more uniform manner. This led to a major efficiency increase. This suggestion was immediately implemented by their engineers. Another useful contribution we made was to stress-test their code to get an estimate of how many more policies they could handle. This was really simple to do, but was a big hit within the company.\r\n\r\nIn the begging of the project, we were unable to access a working version of their code. Additionally, we were not able to access their machines from our laptops. Both of these challenges were overcome in the following week and no significant adjustments to the original plan were required.\r\n<h4>Results</h4>\r\nThe final deliverable consisted of a detailed technical report covering six modules of our assessment of F3F Company\'s HPS, including the following system reviews: code base, performance and optimization, fault tolerance, scalability, compatibility with emerging CUDA trends, and disaster recovery. We also delivered an executive summary of our findings suitable for higher management.\r\n\r\nThe F3F Company had already developed the code base for their HPS. They engaged ArrayFire to obtain an expert assessment of their work, and to get a \"stamp of approval\" that the code will work as intended and is of sufficiently good quality. We successfully delivered on all objectives. Our assessment and findings were fully documented in nearly 100 pages of detailed technical reports and slide modules. These contained a wealth of significant benchmarks and visuals related to the code base and our assessment of their HPS.\r\n\r\nThe F3F Company was extremely satisfied with our input and suggestions. We met or exceeded their expectations in all project objectives and deliverables.\r\n<h6>About Our Client</h6>\r\nHeadquartered in the Philadelphia region, the Fortune 300 Financial Company offers a diverse range of financial services and solutions. With a strong focus on four core business areas — life insurance, annuities, retirement plan services, and group protection — their business is built around supporting, preserving, and enhancing our customer\'s lifestyles and providing better retirement outcomes. Led by over 9,000 employees, the F3FC provides the tools and advice to help individuals take charge of their futures.[/column][column type=\"one-fifth\" last=\"true\"].[/column][/content_band]','Case Study: Fortune 300 Financial Company','','inherit','closed','closed','','6928-revision-v1','','','2016-08-23 15:49:32','2016-08-23 19:49:32','',6928,'http://sandbox.arrayfire.com/6928-revision-v1/',0,'revision','',0),(9083,18528,'2016-08-23 15:53:01','2016-08-23 19:53:01','[content_band inner_container=\"true\" no_margin=\"true\" border=\"top\" padding_top=\"40px\" padding_bottom=\"40px\"][column type=\"one-fifth\"].[/column][column type=\"three-fifths\"][custom_headline type=\"left\" level=\"h3\"]Fortune 300 Financial Company[/custom_headline][/column][column type=\"one-fifth\" last=\"true\"].[/column][gap size=\"3%\"]\r\n\r\n[column type=\"one-fifth\"].[/column][column type=\"three-fifths\"]\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/04/philadelphia-skyline.png\"><img class=\"aligncenter size-full wp-image-9081\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/04/philadelphia-skyline.png\" alt=\"philadelphia-skyline\" width=\"720\" height=\"160\" /></a>\r\n\r\nA Fortune 300 Financial Company (F3F Company herafter) ported their CPU code (C/C++) to CUDA and this enabled them to speed up the necessary financial calculations. Their primary objective was to reduce the time taken to run this code. Before porting to CUDA, they required ten to twelve hours to run the entire code. After porting to CUDA, they were able to do the same work in about 30 minutes.\r\n\r\nThe F3F Company has several C/C++ programmers in their team and they trained many of them to use CUDA. Their code used CUDA to speed up a calculation using Monte Carlo methods to analyze various scenarios in their hedge-fund projection system (HPS). The major portion of their calculations were carried out on independent policies and thus the entire process was ideal for parallel programming (no communication bottlenecks).\r\n<h4>Mission</h4>\r\nThe CPU code was slow and this was holding them back. Because the code took the entire night to run, they were not able to run several different scenarios and take corrective action based on the results of the code. The primary reason to move to GPUs was to speed up the calculations.\r\n\r\nThe F3F Company invested heavily into building CPU+GPU clusters relying on AMAX. They had the code running on four compute nodes, with four GPUs on each node. Each GPU was a NVIDIA K20X. The code ran on 16 GPUs. They were in the process of installing an even bigger system, with 64 total GPUs.\r\n<h4>Action</h4>\r\nOur initial plan was adjusted as the project progressed, and we identified key areas that needed improvement. The first couple of weeks were somewhat tricky because we were not able to get a working version of the codebase that was representative of the code they were actually running. This was because the code was in a very active state of development and integration on their side.\r\n\r\nWe made several suggestions to improve the efficiency of the codebase, but most of these were minor improvements. There were two levels of parallelism in the code—at the kernel level (GPU CUDA code) and the cluster level (MPI). One of the really useful suggestions we made was relevant at the MPI level, where we suggested they organize their policies in a random manner to distribute the computing load in a more uniform manner. This led to a major efficiency increase. This suggestion was immediately implemented by their engineers. Another useful contribution we made was to stress-test their code to get an estimate of how many more policies they could handle. This was really simple to do, but was a big hit within the company.\r\n\r\nIn the begging of the project, we were unable to access a working version of their code. Additionally, we were not able to access their machines from our laptops. Both of these challenges were overcome in the following week and no significant adjustments to the original plan were required.\r\n<h4>Results</h4>\r\nThe final deliverable consisted of a detailed technical report covering six modules of our assessment of F3F Company\'s HPS, including the following system reviews: code base, performance and optimization, fault tolerance, scalability, compatibility with emerging CUDA trends, and disaster recovery. We also delivered an executive summary of our findings suitable for higher management.\r\n\r\nThe F3F Company had already developed the code base for their HPS. They engaged ArrayFire to obtain an expert assessment of their work, and to get a \"stamp of approval\" that the code will work as intended and is of sufficiently good quality. We successfully delivered on all objectives. Our assessment and findings were fully documented in nearly 100 pages of detailed technical reports and slide modules. These contained a wealth of significant benchmarks and visuals related to the code base and our assessment of their HPS.\r\n\r\nThe F3F Company was extremely satisfied with our input and suggestions. We met or exceeded their expectations in all project objectives and deliverables.\r\n<h6>About Our Client</h6>\r\nHeadquartered in the Philadelphia region, the Fortune 300 Financial Company offers a diverse range of financial services and solutions. With a strong focus on four core business areas — life insurance, annuities, retirement plan services, and group protection — their business is built around supporting, preserving, and enhancing our customer\'s lifestyles and providing better retirement outcomes. Led by over 9,000 employees, the F3FC provides the tools and advice to help individuals take charge of their futures.[/column][column type=\"one-fifth\" last=\"true\"].[/column][/content_band]\r\n\r\nGraphics credit <a href=\"http://cliparts.co/clipart/2385767\">cliparts.co</a>','Case Study: Fortune 300 Financial Company','','inherit','closed','closed','','6928-revision-v1','','','2016-08-23 15:53:01','2016-08-23 19:53:01','',6928,'http://sandbox.arrayfire.com/6928-revision-v1/',0,'revision','',0),(9084,18528,'2016-08-23 16:08:46','2016-08-23 20:08:46','[content_band inner_container=\"true\" no_margin=\"true\" border=\"top\" padding_top=\"40px\" padding_bottom=\"40px\"][column type=\"one-fifth\"].[/column][column type=\"three-fifths\"][custom_headline type=\"left\" level=\"h3\"]Fortune 300 Financial Company[/custom_headline][/column][column type=\"one-fifth\" last=\"true\"].[/column][gap size=\"3%\"]\r\n\r\n[column type=\"one-fifth\"].[/column][column type=\"three-fifths\"]\r\n<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/04/philadelphia-skyline.png\"><img class=\"aligncenter size-full wp-image-9081\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/04/philadelphia-skyline.png\" alt=\"philadelphia-skyline\" width=\"720\" height=\"160\" /></a>\r\n\r\nA Fortune 300 Financial Company located in the North East ported their CPU code (C/C++) to CUDA and this enabled them to speed up the necessary financial calculations. Their primary objective was to reduce the time taken to run this code. Before porting to CUDA, they required ten to twelve hours to run the entire code. After porting to CUDA, they were able to do the same work in about 30 minutes.\r\n\r\nThe Client has several C/C++ programmers in their team and they trained many of them to use CUDA. Their code used CUDA to speed up a calculation using Monte Carlo methods to analyze various scenarios in their hedge-fund projection system (HPS). The major portion of their calculations were carried out on independent policies and thus the entire process was ideal for parallel programming (no communication bottlenecks).\r\n<h4>Mission</h4>\r\nThe CPU code was slow and this was holding them back. Because the code took the entire night to run, they were not able to run several different scenarios and take corrective action based on the results of the code. The primary reason to move to GPUs was to speed up the calculations.\r\n\r\nThe Client invested heavily into building CPU+GPU clusters relying on AMAX. They had the code running on four compute nodes, with four GPUs on each node. Each GPU was a NVIDIA K20X. The code ran on 16 GPUs. They were in the process of installing an even bigger system, with 64 total GPUs.\r\n<h4>Action</h4>\r\nOur initial plan was adjusted as the project progressed, and we identified key areas that needed improvement. The first couple of weeks were somewhat tricky because we were not able to get a working version of the codebase that was representative of the code they were actually running. This was because the code was in a very active state of development and integration on their side.\r\n\r\nWe made several suggestions to improve the efficiency of the codebase, but most of these were minor improvements. There were two levels of parallelism in the code—at the kernel level (GPU CUDA code) and the cluster level (MPI). One of the really useful suggestions we made was relevant at the MPI level, where we suggested they organize their policies in a random manner to distribute the computing load in a more uniform manner. This led to a major efficiency increase. This suggestion was immediately implemented by their engineers. Another useful contribution we made was to stress-test their code to get an estimate of how many more policies they could handle. This was really simple to do, but was a big hit within the company.\r\n\r\nIn the begging of the project, we were unable to access a working version of their code. Additionally, we were not able to access their machines from our laptops. Both of these challenges were overcome in the following week and no significant adjustments to the original plan were required.\r\n<h4>Results</h4>\r\nThe final deliverable consisted of a detailed technical report covering six modules of our assessment of Client\'s HPS, including the following system reviews: code base, performance and optimization, fault tolerance, scalability, compatibility with emerging CUDA trends, and disaster recovery. We also delivered an executive summary of our findings suitable for higher management.\r\n\r\nThe Client had already developed the code base for their HPS. They engaged ArrayFire to obtain an expert assessment of their work, and to get a \"stamp of approval\" that the code will work as intended and is of sufficiently good quality. We successfully delivered on all objectives. Our assessment and findings were fully documented in nearly 100 pages of detailed technical reports and slide modules. These contained a wealth of significant benchmarks and visuals related to the code base and our assessment of their HPS.\r\n\r\nThe Client was extremely satisfied with our input and suggestions. We met or exceeded their expectations in all project objectives and deliverables.\r\n[/column][column type=\"one-fifth\" last=\"true\"].[/column][/content_band]\r\n\r\nGraphics credit <a href=\"http://cliparts.co/clipart/2385767\">cliparts.co</a>','Case Study: Fortune 300 Financial Company','','inherit','closed','closed','','6928-autosave-v1','','','2016-08-23 16:08:46','2016-08-23 20:08:46','',6928,'http://sandbox.arrayfire.com/6928-autosave-v1/',0,'revision','',0),