(7946,18132,'2015-02-26 16:16:20','2015-02-26 16:16:20','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\n\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\n\n<h3>Background</h3>\n\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\n\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\n\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\n\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\n\n<h3>Build instructions for x86</h3>\n\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\n\n<ol>\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\n<li><p>Install required build packages on the instance.\n    sudo apt-get update\n    sudo apt-get install build-essential git</p></li>\n<li>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.\n    wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\n    chmod +x clone.sh\n    ./clone.sh # will require a few minutes to finish\n...this might take some time...</li>\n</ol>\n\n<div style=\"text-align: center;\"><img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" /></div>\n\n<ol>\n<li>Take Cling for a spin!</li>\n</ol>\n\n<h3>Build instructions for ARM</h3>\n\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\n\n<ol>\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\n<li><p>Install ARM hard-float compilation tools.</p>\n\n<pre><code># add Embedian as an installation source\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main &gt; /etc/apt/sources.list.d/crosstools.list\'\nsudo apt-get install -y curl\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\n\n# add arm hard-float as a supported architecture\nsudo dpkg --add-architecture armhf\nsudo apt-get update\n\n# install an ARM targeted cross compiler\nsudo apt-get install crossbuild-essential-armhf\n</code></pre></li>\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\n\n<pre><code># install QEMU emulation for ARM executables\nsudo apt-get install qemu binfmt-support qemu-user-static\nsudo update-binfmts --display\nsudo apt-get install libc6:armhf\n\n# compile an ARM executable\ncat &gt; hello.c &gt;&gt; EOF\n\n#include &lt;stdio.h&gt;\nint main(void) { return printf(\"Hello ARM!\\n\"); }\nEOF\narm-linux-gnueabihf-gcc -static -ohello hello.c\n\n# the following should indicate an ARM exe\nfile hello\n\n# running the executable with no fanfare should \n# invoke QEMU transparently to print \"Hello ARM!\"\n./hello\n</code></pre>\n\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\n<li><p>Install build tools: cmake and ninja.</p>\n\n<pre><code># install cmake\nsudo apt-get install cmake\n\n# ninja requires a build\ngit clone git://github.com/martine/ninja.git &amp;&amp; cd ninja\ngit checkout release\n./configure.py --bootstrap\nchmod +x ninja build.ninja\nsudo cp ninja build.ninja /usr/bin\n</code></pre></li>\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\n\n<pre><code># the following steps aasume this is done in the home directory\n# and therefore yielding ~/llvm\n\ngit clone http://root.cern.ch/git/llvm.git src\ncd src\ngit checkout cling-patches\ncd tools\ngit clone http://root.cern.ch/git/cling.git\ngit clone http://root.cern.ch/git/clang.git\ncd clang git checkout cling-patches\n</code></pre></li>\n<li><p>Configure a build in the new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\n\n<pre><code>mkdir -p build &amp;&amp; cd build\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_SYSTEM_PROCESSOR=armv7 -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -DCMAKE_INSTALL_PREFIX=/home/admin/build/install -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf -DLLVM_TARGET_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=ARM -DCMAKE_CXX_FLAGS=\'-mcpu=cortex-a9 -I/usr/include/arm-linux-gnueabihf/c++/4.9 -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include -mfloat-abi=hard\'\n</code></pre>\n\n<p></pre></p></li>\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\n\n<pre><code>ninja install    \n</code></pre></li>\n<li><p>Fire up Cling!</p></li>\n</ol>\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 16:16:20','2015-02-26 16:16:20','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7947,18132,'2015-02-26 16:30:43','2015-02-26 16:30:43','<p><!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>backup</title><style></style></head><body></p>\n\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\n\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM&#39;s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling&#39;s innards push C++ code along.</p>\n\n<h3 id=\"background\">Background</h3>\n\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you&#39;re interested in sticking to C++ for speed and efficiency, you&#39;re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\n\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\n\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\"></p>\n\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\n\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\n\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\n\n<ol>\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p>\n</li>\n<li><p>Boot the instance and login as <strong>admin</strong>.</p>\n</li>\n<li><p>Install required build packages on the instance.</p>\n<pre><code>sudo apt-get update\nsudo apt-get install build-essential git\n</code></pre></li>\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\nchmod +x clone.sh\n./clone.sh # will require a few minutes to finish\n</code></pre><p>...this might take some time...</p>\n<p><div style=&quot;text-align: center;&quot;><img width=&quot;75%&quot; style=&quot;padding: 20px;&quot; src=&quot;https://dl.dropboxusercontent.com/u/96059047/cling_build.png&quot; alt=&quot;Building cling on an x86 EC2 instance&quot; /></div>\n</p>\n</li>\n<li><p>Take Cling for a spin!</p>\n</li>\n</ol>\n\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\n\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\n\n<ol>\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p>\n</li>\n<li><p>Install ARM hard-float compilation tools.</p>\n<pre><code># add Embedian as an installation source\nsudo bash -c &#39;echo deb http://emdebian.org/tools/debian/ jessie main > /etc/apt/sources.list.d/crosstools.list&#39;\nsudo apt-get install -y curl\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\n\n# add arm hard-float as a supported architecture\nsudo dpkg --add-architecture armhf\nsudo apt-get update\n\n# install an ARM targeted cross compiler\nsudo apt-get install crossbuild-essential-armhf\n</code></pre></li>\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\n<pre><code># install QEMU emulation for ARM executables\nsudo apt-get install qemu binfmt-support qemu-user-static\nsudo update-binfmts --display\nsudo apt-get install libc6:armhf\n\n# compile an ARM executable\ncat > hello.c >> EOF\n\n#include <stdio.h>\nint main(void) { return printf(&quot;Hello ARM!\\n&quot;); }\nEOF\narm-linux-gnueabihf-gcc -static -ohello hello.c\n\n# the following should indicate an ARM exe\nfile hello\n\n# running the executable with no fanfare should\n# invoke QEMU transparently to print &quot;Hello ARM!&quot;\n./hello\n</code></pre><p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p>\n</li>\n<li><p>Install build tools: cmake and ninja.</p>\n<pre><code> # install cmake\n sudo apt-get install cmake\n\n # ninja requires a build\n git clone git://github.com/martine/ninja.git &amp;&amp; cd ninja\n git checkout release\n ./configure.py --bootstrap\n chmod +x ninja build.ninja\n sudo cp ninja build.ninja /usr/bin\n</code></pre></li>\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you&#39;re following these steps in the order of the blog post.</p>\n<pre><code># the following steps aasume this is done in the home directory\n# and therefore yielding ~/llvm\n\ngit clone http://root.cern.ch/git/llvm.git src\ncd src\ngit checkout cling-patches\ncd tools\ngit clone http://root.cern.ch/git/cling.git\ngit clone http://root.cern.ch/git/clang.git\ncd clang git checkout cling-patches\n</code></pre></li>\n<li><p>Configure a build in the new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\n<pre><code>mkdir -p build &amp;&amp; cd build\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_SYSTEM_PROCESSOR=armv7 -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -DCMAKE_INSTALL_PREFIX=/home/admin/build/install -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf -DLLVM_TARGET_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=ARM -DCMAKE_CXX_FLAGS=&#39;-mcpu=cortex-a9 -I/usr/include/arm-linux-gnueabihf/c++/4.9 -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include -mfloat-abi=hard&#39;\n</code></pre><p></pre></p>\n</li>\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\n<pre><code>ninja install\n</code></pre></li>\n<li><p>Fire up Cling!</p>\n</li>\n</ol>\n\n<p></body></html></p>\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 16:30:43','2015-02-26 16:30:43','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7948,18132,'2015-02-26 16:32:53','2015-02-26 16:32:53','<p><!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>backup</title><style></style></head><body></p>\n\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\n\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM&#39;s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling&#39;s innards push C++ code along.</p>\n\n<h3 id=\"background\">Background</h3>\n\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you&#39;re interested in sticking to C++ for speed and efficiency, you&#39;re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\n\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\n\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\"></p>\n\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\n\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\n\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\n\n<ol>\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p>\n</li>\n<li><p>Boot the instance and login as <strong>admin</strong>.</p>\n</li>\n<li><p>Install required build packages on the instance.</p>\n<pre><code>sudo apt-get update\nsudo apt-get install build-essential git\n</code></pre></li>\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\nchmod +x clone.sh\n./clone.sh # will require a few minutes to finish\n</code></pre><p>...this might take some time...</p>\n<p><div style=\"text-align: center;\"><img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" /></div>\n</p>\n</li>\n<li><p>Take Cling for a spin!</p>\n</li>\n</ol>\n\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\n\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\n\n<ol>\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p>\n</li>\n<li><p>Install ARM hard-float compilation tools.</p>\n<pre><code># add Embedian as an installation source\nsudo bash -c &#39;echo deb http://emdebian.org/tools/debian/ jessie main > /etc/apt/sources.list.d/crosstools.list&#39;\nsudo apt-get install -y curl\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\n\n# add arm hard-float as a supported architecture\nsudo dpkg --add-architecture armhf\nsudo apt-get update\n\n# install an ARM targeted cross compiler\nsudo apt-get install crossbuild-essential-armhf\n</code></pre></li>\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\n<pre><code># install QEMU emulation for ARM executables\nsudo apt-get install qemu binfmt-support qemu-user-static\nsudo update-binfmts --display\nsudo apt-get install libc6:armhf\n\n# compile an ARM executable\ncat > hello.c >> EOF\n\n#include <stdio.h>\nint main(void) { return printf(\"Hello ARM!\\n\"); }\nEOF\narm-linux-gnueabihf-gcc -static -ohello hello.c\n\n# the following should indicate an ARM exe\nfile hello\n\n# running the executable with no fanfare should\n# invoke QEMU transparently to print \"Hello ARM!\"\n./hello\n</code></pre><p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p>\n</li>\n<li><p>Install build tools: cmake and ninja.</p>\n<pre><code> # install cmake\n sudo apt-get install cmake\n\n # ninja requires a build\n git clone git://github.com/martine/ninja.git &amp;&amp; cd ninja\n git checkout release\n ./configure.py --bootstrap\n chmod +x ninja build.ninja\n sudo cp ninja build.ninja /usr/bin\n</code></pre></li>\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you&#39;re following these steps in the order of the blog post.</p>\n<pre><code># the following steps aasume this is done in the home directory\n# and therefore yielding ~/llvm\n\ngit clone http://root.cern.ch/git/llvm.git src\ncd src\ngit checkout cling-patches\ncd tools\ngit clone http://root.cern.ch/git/cling.git\ngit clone http://root.cern.ch/git/clang.git\ncd clang git checkout cling-patches\n</code></pre></li>\n<li><p>Configure a build in the new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\n<pre><code>mkdir -p build &amp;&amp; cd build\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_SYSTEM_PROCESSOR=armv7 -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -DCMAKE_INSTALL_PREFIX=/home/admin/build/install -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf -DLLVM_TARGET_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=ARM -DCMAKE_CXX_FLAGS=&#39;-mcpu=cortex-a9 -I/usr/include/arm-linux-gnueabihf/c++/4.9 -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include -mfloat-abi=hard&#39;\n</code></pre><p></pre></p>\n</li>\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\n<pre><code>ninja install\n</code></pre></li>\n<li><p>Fire up Cling!</p>\n</li>\n</ol>\n\n<p></body></html></p>\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 16:32:53','2015-02-26 16:32:53','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7949,18132,'2015-02-26 16:34:53','2015-02-26 16:34:53','<p><!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>backup</title><style></style></head><body></p>\n\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\n\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\n\n<h3 id=\"background\">Background</h3>\n\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\n\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\n\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\"></p>\n\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\n\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\n\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\n\n<ol>\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p>\n</li>\n<li><p>Boot the instance and login as <strong>admin</strong>.</p>\n</li>\n<li><p>Install required build packages on the instance.</p>\n<pre><code>sudo apt-get update\nsudo apt-get install build-essential git\n</code></pre></li>\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\nchmod +x clone.sh\n./clone.sh # will require a few minutes to finish\n</code></pre><p>...this might take some time...</p>\n<p><div style=\"text-align: center;\"><img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" /></div>\n</p>\n</li>\n<li><p>Take Cling for a spin!</p>\n</li>\n</ol>\n\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\n\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\n\n<ol>\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p>\n</li>\n<li><p>Install ARM hard-float compilation tools.</p>\n<pre><code># add Embedian as an installation source\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > /etc/apt/sources.list.d/crosstools.list\'\nsudo apt-get install -y curl\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\n\n# add arm hard-float as a supported architecture\nsudo dpkg --add-architecture armhf\nsudo apt-get update\n\n# install an ARM targeted cross compiler\nsudo apt-get install crossbuild-essential-armhf\n</code></pre></li>\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\n<pre><code># install QEMU emulation for ARM executables\nsudo apt-get install qemu binfmt-support qemu-user-static\nsudo update-binfmts --display\nsudo apt-get install libc6:armhf\n\n# compile an ARM executable\ncat > hello.c >> EOF\n\n#include <stdio.h>\nint main(void) { return printf(\"Hello ARM!\\n\"); }\nEOF\narm-linux-gnueabihf-gcc -static -ohello hello.c\n\n# the following should indicate an ARM exe\nfile hello\n\n# running the executable with no fanfare should\n# invoke QEMU transparently to print \"Hello ARM!\"\n./hello\n</code></pre><p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p>\n</li>\n<li><p>Install build tools: cmake and ninja.</p>\n<pre><code> # install cmake\n sudo apt-get install cmake\n\n # ninja requires a build\n git clone git://github.com/martine/ninja.git &amp;&amp; cd ninja\n git checkout release\n ./configure.py --bootstrap\n chmod +x ninja build.ninja\n sudo cp ninja build.ninja /usr/bin\n</code></pre></li>\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\n<pre><code># the following steps aasume this is done in the home directory\n# and therefore yielding ~/llvm\n\ngit clone http://root.cern.ch/git/llvm.git src\ncd src\ngit checkout cling-patches\ncd tools\ngit clone http://root.cern.ch/git/cling.git\ngit clone http://root.cern.ch/git/clang.git\ncd clang git checkout cling-patches\n</code></pre></li>\n<li><p>Configure a build in the new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\n<pre><code>mkdir -p build &amp;&amp; cd build\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_SYSTEM_PROCESSOR=armv7 -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -DCMAKE_INSTALL_PREFIX=/home/admin/build/install -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf -DLLVM_TARGET_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=ARM -DCMAKE_CXX_FLAGS=\'-mcpu=cortex-a9 -I/usr/include/arm-linux-gnueabihf/c++/4.9 -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include -mfloat-abi=hard\'\n</code></pre><p></pre></p>\n</li>\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\n<pre><code>ninja install\n</code></pre></li>\n<li><p>Fire up Cling!</p>\n</li>\n</ol>\n\n<p></body></html></p>\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 16:34:53','2015-02-26 16:34:53','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7950,18132,'2015-02-26 16:34:53','2015-02-26 16:34:53','<p><!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>backup</title><style></style></head><body></p>\n\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\n\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\n\n<h3 id=\"background\">Background</h3>\n\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\n\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\n\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\"></p>\n\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\n\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\n\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\n\n<ol>\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p>\n</li>\n<li><p>Boot the instance and login as <strong>admin</strong>.</p>\n</li>\n<li><p>Install required build packages on the instance.</p>\n<pre><code>sudo apt-get update\nsudo apt-get install build-essential git\n</code></pre></li>\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\nchmod +x clone.sh\n./clone.sh # will require a few minutes to finish\n</code></pre><p>...this might take some time...</p>\n<p><div style=\"text-align: center;\"><img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" /></div>\n</p>\n</li>\n<li><p>Take Cling for a spin!</p>\n</li>\n</ol>\n\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\n\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\n\n<ol>\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p>\n</li>\n<li><p>Install ARM hard-float compilation tools.</p>\n<pre><code># add Embedian as an installation source\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > /etc/apt/sources.list.d/crosstools.list\'\nsudo apt-get install -y curl\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\n\n# add arm hard-float as a supported architecture\nsudo dpkg --add-architecture armhf\nsudo apt-get update\n\n# install an ARM targeted cross compiler\nsudo apt-get install crossbuild-essential-armhf\n</code></pre></li>\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\n<pre><code># install QEMU emulation for ARM executables\nsudo apt-get install qemu binfmt-support qemu-user-static\nsudo update-binfmts --display\nsudo apt-get install libc6:armhf\n\n# compile an ARM executable\ncat > hello.c >> EOF\n\n#include <stdio.h>\nint main(void) { return printf(\"Hello ARM!\\n\"); }\nEOF\narm-linux-gnueabihf-gcc -static -ohello hello.c\n\n# the following should indicate an ARM exe\nfile hello\n\n# running the executable with no fanfare should\n# invoke QEMU transparently to print \"Hello ARM!\"\n./hello\n</code></pre><p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p>\n</li>\n<li><p>Install build tools: cmake and ninja.</p>\n<pre><code> # install cmake\n sudo apt-get install cmake\n\n # ninja requires a build\n git clone git://github.com/martine/ninja.git &amp;&amp; cd ninja\n git checkout release\n ./configure.py --bootstrap\n chmod +x ninja build.ninja\n sudo cp ninja build.ninja /usr/bin\n</code></pre></li>\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\n<pre><code># the following steps aasume this is done in the home directory\n# and therefore yielding ~/llvm\n\ngit clone http://root.cern.ch/git/llvm.git src\ncd src\ngit checkout cling-patches\ncd tools\ngit clone http://root.cern.ch/git/cling.git\ngit clone http://root.cern.ch/git/clang.git\ncd clang git checkout cling-patches\n</code></pre></li>\n<li><p>Configure a build in the new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\n<pre><code>mkdir -p build &amp;&amp; cd build\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True -DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_VERSION=1 -DCMAKE_SYSTEM_PROCESSOR=armv7 -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ -DCMAKE_INSTALL_PREFIX=/home/admin/build/install -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf -DLLVM_TARGET_ARCH=ARM -DLLVM_TARGETS_TO_BUILD=ARM -DCMAKE_CXX_FLAGS=\'-mcpu=cortex-a9 -I/usr/include/arm-linux-gnueabihf/c++/4.9 -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include -mfloat-abi=hard\'\n</code></pre><p></pre></p>\n</li>\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\n<pre><code>ninja install\n</code></pre></li>\n<li><p>Fire up Cling!</p>\n</li>\n</ol>\n\n<p></body></html></p>\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 16:34:53','2015-02-26 16:34:53','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7951,18132,'2015-02-26 17:06:16','2015-02-26 17:06:16','<p></p>\n\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p></p>\n\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\n\n<h3 id=\"background\">Background</h3>\n\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\n\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\n\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\n\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\n\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\n\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\n\n<ol>\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\n<li><p>Install required build packages on the instance.</p>\n\n<pre><code>sudo apt-get update\nsudo apt-get install build-essential git\n</code></pre></li>\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\n\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\nchmod +x clone.sh\n./clone.sh           # will require a few minutes to finish\n</code></pre>\n\n<p>...this might take some time...</p>\n\n<div style=\"text-align: center;\">\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\n</div></li>\n<li><p>Take Cling for a spin!</p></li>\n</ol>\n\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\n\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\n\n<ol>\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\n<li><p>Install ARM hard-float compilation tools.</p>\n\n<pre><code># add Embedian as an installation source\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main &gt; /etc/apt/sources.list.d/crosstools.list\'\nsudo apt-get install -y curl\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\n\n# add arm hard-float as a supported architecture\nsudo dpkg --add-architecture armhf\nsudo apt-get update\n\n# install an ARM targeted cross compiler\nsudo apt-get install crossbuild-essential-armhf\n</code></pre></li>\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\n\n<pre><code># install QEMU emulation for ARM executables\nsudo apt-get install qemu binfmt-support qemu-user-static\nsudo update-binfmts --display\nsudo apt-get install libc6:armhf\n\n# compile an ARM executable\ncat &gt; hello.c &gt;&gt; EOF\n\n#include &lt;stdio.h&gt;\nint main(void) { return printf(\"Hello ARM!\\n\"); }\nEOF\narm-linux-gnueabihf-gcc -static -ohello hello.c\n\n# the following should indicate an ARM exe\nfile hello\n\n# running the executable with no fanfare should\n# invoke QEMU transparently to print \"Hello ARM!\"\n./hello\n</code></pre>\n\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\n<li><p>Install build tools: cmake and ninja.</p>\n\n<pre><code> # install cmake\n sudo apt-get install cmake\n\n # ninja requires a build\n git clone git://github.com/martine/ninja.git &amp;&amp; cd ninja\n git checkout release\n ./configure.py --bootstrap\n chmod +x ninja build.ninja\n sudo cp ninja build.ninja /usr/bin\n</code></pre></li>\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\n\n<pre><code># the following steps aasume this is done in the home directory\n# and therefore yielding ~/llvm\n\ngit clone http://root.cern.ch/git/llvm.git src\ncd src\ngit checkout cling-patches\ncd tools\ngit clone http://root.cern.ch/git/cling.git\ngit clone http://root.cern.ch/git/clang.git\ncd clang git checkout cling-patches\n</code></pre></li>\n<li><p>Configure a build in the new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\n\n<pre><code>mkdir -p build &amp;&amp; cd build\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\n                  -DCMAKE_SYSTEM_NAME=Linux \\\n                  -DCMAKE_SYSTEM_VERSION=1 \\\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\n                  -DLLVM_TARGET_ARCH=ARM \\\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\n                  -DCMAKE_CXX_FLAGS= \\\n                      \"-mcpu=cortex-a9 \\       \n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\n                      -mfloat-abi=hard\"\n</code></pre></li>\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\n\n<pre><code>ninja install\n</code></pre></li>\n<li><p>Fire up Cling!</p></li>\n</ol>\n\n<p></body></html></p>\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 17:06:16','2015-02-26 17:06:16','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7952,18132,'2015-02-26 17:07:21','2015-02-26 17:07:21','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\n\n<p></p></p>\n\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\n\n<h3 id=\"background\">Background</h3>\n\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\n\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\n\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\n\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\n\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\n\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\n\n<ol>\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\n<li><p>Install required build packages on the instance.</p>\n\n<pre><code>sudo apt-get update\nsudo apt-get install build-essential git\n</code></pre></li>\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\n\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\nchmod +x clone.sh\n./clone.sh           # will require a few minutes to finish\n</code></pre>\n\n<p>...this might take some time...</p>\n\n<div style=\"text-align: center;\">\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\n</div></li>\n<li><p>Take Cling for a spin!</p></li>\n</ol>\n\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\n\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\n\n<ol>\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\n<li><p>Install ARM hard-float compilation tools.</p>\n\n<pre><code># add Embedian as an installation source\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main &gt; /etc/apt/sources.list.d/crosstools.list\'\nsudo apt-get install -y curl\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\n\n# add arm hard-float as a supported architecture\nsudo dpkg --add-architecture armhf\nsudo apt-get update\n\n# install an ARM targeted cross compiler\nsudo apt-get install crossbuild-essential-armhf\n</code></pre></li>\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\n\n<pre><code># install QEMU emulation for ARM executables\nsudo apt-get install qemu binfmt-support qemu-user-static\nsudo update-binfmts --display\nsudo apt-get install libc6:armhf\n\n# compile an ARM executable\ncat &gt; hello.c &gt;&gt; EOF\n\n#include &lt;stdio.h&gt;\nint main(void) { return printf(\"Hello ARM!\\n\"); }\nEOF\narm-linux-gnueabihf-gcc -static -ohello hello.c\n\n# the following should indicate an ARM exe\nfile hello\n\n# running the executable with no fanfare should\n# invoke QEMU transparently to print \"Hello ARM!\"\n./hello\n</code></pre>\n\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\n<li><p>Install build tools: cmake and ninja.</p>\n\n<pre><code> # install cmake\n sudo apt-get install cmake\n\n # ninja requires a build\n git clone git://github.com/martine/ninja.git &amp;&amp; cd ninja\n git checkout release\n ./configure.py --bootstrap\n chmod +x ninja build.ninja\n sudo cp ninja build.ninja /usr/bin\n</code></pre></li>\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\n\n<pre><code># the following steps aasume this is done in the home directory\n# and therefore yielding ~/llvm\n\ngit clone http://root.cern.ch/git/llvm.git src\ncd src\ngit checkout cling-patches\ncd tools\ngit clone http://root.cern.ch/git/cling.git\ngit clone http://root.cern.ch/git/clang.git\ncd clang git checkout cling-patches\n</code></pre></li>\n<li><p>Configure a build in the new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\n\n<pre><code>mkdir -p build &amp;&amp; cd build\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\n                  -DCMAKE_SYSTEM_NAME=Linux \\\n                  -DCMAKE_SYSTEM_VERSION=1 \\\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\n                  -DLLVM_TARGET_ARCH=ARM \\\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\n                  -DCMAKE_CXX_FLAGS= \\\n                      \"-mcpu=cortex-a9 \\       \n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\n                      -mfloat-abi=hard\"\n</code></pre></li>\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\n\n<pre><code>ninja install\n</code></pre></li>\n<li><p>Fire up Cling!</p></li>\n</ol>\n\n<p></body></html></p>\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 17:07:21','2015-02-26 17:07:21','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7953,18132,'2015-02-26 17:08:43','2015-02-26 17:08:43','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\n\n<p></p></p>\n\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\n\n<h3 id=\"background\">Background</h3>\n\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\n\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\n\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\n\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\n\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\n\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\n\n<ol>\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\n<li><p>Install required build packages on the instance.</p>\n\n<pre><code>sudo apt-get update\nsudo apt-get install build-essential git\n</code></pre></li>\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\n\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\nchmod +x clone.sh\n./clone.sh           # will require a few minutes to finish\n</code></pre>\n\n<p>...this might take some time...</p>\n\n<div style=\"text-align: center;\">\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\n</div></li>\n<li><p>Take Cling for a spin!</p></li>\n</ol>\n\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\n\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\n\n<ol>\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\n<li><p>Install ARM hard-float compilation tools.</p>\n\n<pre><code># add Embedian as an installation source\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main &gt; /etc/apt/sources.list.d/crosstools.list\'\nsudo apt-get install -y curl\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\n\n# add arm hard-float as a supported architecture\nsudo dpkg --add-architecture armhf\nsudo apt-get update\n\n# install an ARM targeted cross compiler\nsudo apt-get install crossbuild-essential-armhf\n</code></pre></li>\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\n\n<pre><code># install QEMU emulation for ARM executables\nsudo apt-get install qemu binfmt-support qemu-user-static\nsudo update-binfmts --display\nsudo apt-get install libc6:armhf\n\n# compile an ARM executable\ncat &gt; hello.c &gt;&gt; EOF\n\n#include &lt;stdio.h&gt;\nint main(void) { return printf(\"Hello ARM!\\n\"); }\nEOF\narm-linux-gnueabihf-gcc -static -ohello hello.c\n\n# the following should indicate an ARM exe\nfile hello\n\n# running the executable with no fanfare should\n# invoke QEMU transparently to print \"Hello ARM!\"\n./hello\n</code></pre>\n\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\n<li><p>Install build tools: cmake and ninja.</p>\n\n<pre><code> # install cmake\n sudo apt-get install cmake\n\n # ninja requires a build\n git clone git://github.com/martine/ninja.git &amp;&amp; cd ninja\n git checkout release\n ./configure.py --bootstrap\n chmod +x ninja build.ninja\n sudo cp ninja build.ninja /usr/bin\n</code></pre></li>\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\n\n<pre><code># the following steps aasume this is done in the home directory\n# and therefore yielding ~/llvm\n\ngit clone http://root.cern.ch/git/llvm.git src\ncd src\ngit checkout cling-patches\ncd tools\ngit clone http://root.cern.ch/git/cling.git\ngit clone http://root.cern.ch/git/clang.git\ncd clang git checkout cling-patches\n</code></pre></li>\n<li><p>Configure a build in the new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\n\n<pre><code>mkdir -p build &amp;amp;&amp;amp; cd build\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\n                  -DCMAKE_SYSTEM_NAME=Linux \\\n                  -DCMAKE_SYSTEM_VERSION=1 \\\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\n                  -DLLVM_TARGET_ARCH=ARM \\\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\n                  -DCMAKE_CXX_FLAGS= \\\n                      \"-mcpu=cortex-a9 \\       \n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\n                      -mfloat-abi=hard\"\n</code></pre></li>\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\n\n<pre><code>ninja install\n</code></pre></li>\n<li><p>Fire up Cling!</p></li>\n</ol>\n\n<p></body></html></p>\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 17:08:43','2015-02-26 17:08:43','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7954,18132,'2015-02-26 17:09:16','2015-02-26 17:09:16','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\n\n<p></p></p>\n\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\n\n<h3 id=\"background\">Background</h3>\n\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\n\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\n\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\n\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\n\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\n\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\n\n<ol>\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\n<li><p>Install required build packages on the instance.</p>\n\n<pre><code>sudo apt-get update\nsudo apt-get install build-essential git\n</code></pre></li>\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\n\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\nchmod +x clone.sh\n./clone.sh           # will require a few minutes to finish\n</code></pre>\n\n<p>...this might take some time...</p>\n\n<div style=\"text-align: center;\">\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\n</div></li>\n<li><p>Take Cling for a spin!</p></li>\n</ol>\n\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\n\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\n\n<ol>\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\n<li><p>Install ARM hard-float compilation tools.</p>\n\n<pre><code># add Embedian as an installation source\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main &gt; /etc/apt/sources.list.d/crosstools.list\'\nsudo apt-get install -y curl\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\n\n# add arm hard-float as a supported architecture\nsudo dpkg --add-architecture armhf\nsudo apt-get update\n\n# install an ARM targeted cross compiler\nsudo apt-get install crossbuild-essential-armhf\n</code></pre></li>\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\n\n<pre><code># install QEMU emulation for ARM executables\nsudo apt-get install qemu binfmt-support qemu-user-static\nsudo update-binfmts --display\nsudo apt-get install libc6:armhf\n\n# compile an ARM executable\ncat &gt; hello.c &gt;&gt; EOF\n\n#include &lt;stdio.h&gt;\nint main(void) { return printf(\"Hello ARM!\\n\"); }\nEOF\narm-linux-gnueabihf-gcc -static -ohello hello.c\n\n# the following should indicate an ARM exe\nfile hello\n\n# running the executable with no fanfare should\n# invoke QEMU transparently to print \"Hello ARM!\"\n./hello\n</code></pre>\n\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\n<li><p>Install build tools: cmake and ninja.</p>\n\n<pre><code> # install cmake\n sudo apt-get install cmake\n\n # ninja requires a build\n git clone git://github.com/martine/ninja.git &amp;&amp; cd ninja\n git checkout release\n ./configure.py --bootstrap\n chmod +x ninja build.ninja\n sudo cp ninja build.ninja /usr/bin\n</code></pre></li>\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\n\n<pre><code># the following steps aasume this is done in the home directory\n# and therefore yielding ~/llvm\n\ngit clone http://root.cern.ch/git/llvm.git src\ncd src\ngit checkout cling-patches\ncd tools\ngit clone http://root.cern.ch/git/cling.git\ngit clone http://root.cern.ch/git/clang.git\ncd clang git checkout cling-patches\n</code></pre></li>\n<li><p>Configure a build in the new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\n\n<pre><code>mkdir -p build; cd build\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\n                  -DCMAKE_SYSTEM_NAME=Linux \\\n                  -DCMAKE_SYSTEM_VERSION=1 \\\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\n                  -DLLVM_TARGET_ARCH=ARM \\\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\n                  -DCMAKE_CXX_FLAGS= \\\n                      \"-mcpu=cortex-a9 \\       \n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\n                      -mfloat-abi=hard\"\n</code></pre></li>\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\n\n<pre><code>ninja install\n</code></pre></li>\n<li><p>Fire up Cling!</p></li>\n</ol>\n\n<p></body></html></p>\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 17:09:16','2015-02-26 17:09:16','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7955,18132,'2015-02-26 17:09:52','2015-02-26 17:09:52','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\n\n<p></p></p>\n\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\n\n<h3 id=\"background\">Background</h3>\n\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\n\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\n\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\n\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\n\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\n\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\n\n<ol>\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\n<li><p>Install required build packages on the instance.</p>\n\n<pre><code>sudo apt-get update\nsudo apt-get install build-essential git\n</code></pre></li>\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\n\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\nchmod +x clone.sh\n./clone.sh           # will require a few minutes to finish\n</code></pre>\n\n<p>...this might take some time...</p>\n\n<div style=\"text-align: center;\">\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\n</div></li>\n<li><p>Take Cling for a spin!</p></li>\n</ol>\n\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\n\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\n\n<ol>\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\n<li><p>Install ARM hard-float compilation tools.</p>\n\n<pre><code># add Embedian as an installation source\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main &gt; /etc/apt/sources.list.d/crosstools.list\'\nsudo apt-get install -y curl\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\n\n# add arm hard-float as a supported architecture\nsudo dpkg --add-architecture armhf\nsudo apt-get update\n\n# install an ARM targeted cross compiler\nsudo apt-get install crossbuild-essential-armhf\n</code></pre></li>\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\n\n<pre><code># install QEMU emulation for ARM executables\nsudo apt-get install qemu binfmt-support qemu-user-static\nsudo update-binfmts --display\nsudo apt-get install libc6:armhf\n\n# compile an ARM executable\ncat &gt; hello.c &gt;&gt; EOF\n\n#include &lt;stdio.h&gt;\nint main(void) { return printf(\"Hello ARM!\\n\"); }\nEOF\narm-linux-gnueabihf-gcc -static -ohello hello.c\n\n# the following should indicate an ARM exe\nfile hello\n\n# running the executable with no fanfare should\n# invoke QEMU transparently to print \"Hello ARM!\"\n./hello\n</code></pre>\n\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\n<li><p>Install build tools: cmake and ninja.</p>\n\n<pre><code> # install cmake\n sudo apt-get install cmake\n\n # ninja requires a build\n git clone git://github.com/martine/ninja.git &amp;&amp; cd ninja\n git checkout release\n ./configure.py --bootstrap\n chmod +x ninja build.ninja\n sudo cp ninja build.ninja /usr/bin\n</code></pre></li>\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\n\n<pre><code># the following steps aasume this is done in the home directory\n# and therefore yielding ~/llvm\n\ngit clone http://root.cern.ch/git/llvm.git src\ncd src\ngit checkout cling-patches\ncd tools\ngit clone http://root.cern.ch/git/cling.git\ngit clone http://root.cern.ch/git/clang.git\ncd clang git checkout cling-patches\n</code></pre></li>\n<li><p>Configure a build in the new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\n\n<pre><code>mkdir -p build; cd build\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\n                  -DCMAKE_SYSTEM_NAME=Linux \\\n                  -DCMAKE_SYSTEM_VERSION=1 \\\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\n                  -DLLVM_TARGET_ARCH=ARM \\\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\n                  -DCMAKE_CXX_FLAGS= \\\n                      \"-mcpu=cortex-a9 \\       \n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\n                      -mfloat-abi=hard\"\n</code></pre></li>\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\n\n<pre><code>ninja install\n</code></pre></li>\n<li><p>Fire up Cling!</p></li>\n</ol>\n\n<p></body></html></p>\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 17:09:52','2015-02-26 17:09:52','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7957,18132,'2015-02-26 21:42:48','2015-02-26 21:42:48','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\n\n<p></p></p>\n\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\n\n<h3 id=\"background\">Background</h3>\n\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\n\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\n\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\n\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\n\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\n\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\n\n<ol>\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\n<li><p>Install required build packages on the instance.</p>\n\n<pre><code>sudo apt-get update\nsudo apt-get install build-essential git\n</code></pre></li>\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\n\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\nchmod +x clone.sh\n./clone.sh           # will require a few minutes to finish\n</code></pre>\n\n<p>...this might take some time...</p>\n\n<div style=\"text-align: center;\">\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\n</div></li>\n<li><p>Take Cling for a spin!</p></li>\n</ol>\n\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\n\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\n\n<ol>\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\n<li><p>Install ARM hard-float compilation tools.</p>\n\n<pre><code># add Embedian as an installation source\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main &amp;gt; /etc/apt/sources.list.d/crosstools.list\'\nsudo apt-get install -y curl\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\n\n# add arm hard-float as a supported architecture\nsudo dpkg --add-architecture armhf\nsudo apt-get update\n\n# install an ARM targeted cross compiler\nsudo apt-get install crossbuild-essential-armhf\n</code></pre></li>\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\n\n<pre><code># install QEMU emulation for ARM executables\nsudo apt-get install qemu binfmt-support qemu-user-static\nsudo update-binfmts --display\nsudo apt-get install libc6:armhf\n\n# compile an ARM executable\ncat &amp;gt; hello.c &amp;gt;&amp;gt; EOF\n\n#include &amp;lt;stdio.h&amp;gt;\nint main(void) { return printf(\"Hello ARM!\\n\"); }\nEOF\narm-linux-gnueabihf-gcc -static -ohello hello.c\n\n# the following should indicate an ARM exe\nfile hello\n\n# running the executable with no fanfare should\n# invoke QEMU transparently to print \"Hello ARM!\"\n./hello\n</code></pre>\n\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\n<li><p>Install build tools: cmake and ninja.</p>\n\n<pre><code> # install cmake\n sudo apt-get install cmake\n\n # ninja requires a build\n git clone git://github.com/martine/ninja.git &amp;amp;&amp;amp; cd ninja\n git checkout release\n ./configure.py --bootstrap\n chmod +x ninja build.ninja\n sudo cp ninja build.ninja /usr/bin\n</code></pre></li>\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\n\n<pre><code># the following steps assume this is done in the home directory\n# and therefore yielding ~/llvm\n\ngit clone http://root.cern.ch/git/llvm.git\ncd llvm\ngit checkout cling-patches\ncd tools\ngit clone http://root.cern.ch/git/cling.git\ngit clone http://root.cern.ch/git/clang.git\ncd clang \ngit checkout cling-patches\n</code></pre></li>\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em> Also, note that the following assumes that the prior step was run in <code>~/</code> resulting in an <code>~/llvm</code> directory.</p>\n\n<pre><code>mkdir -p build; cd build\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\n                  -DCMAKE_SYSTEM_NAME=Linux \\\n                  -DCMAKE_SYSTEM_VERSION=1 \\\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\n                  -DLLVM_TARGET_ARCH=ARM \\\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\n                  -DCMAKE_CXX_FLAGS= \\\n                      \"-mcpu=cortex-a9 \\       \n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\n                      -mfloat-abi=hard\"\n</code></pre></li>\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\n\n<pre><code>ninja install\n</code></pre></li>\n<li><p>Fire up Cling!</p></li>\n</ol>\n\n<p></body></html></p>\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 21:42:48','2015-02-26 21:42:48','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7958,18132,'2015-02-26 21:43:32','2015-02-26 21:43:32','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\n\n<p></p></p>\n\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\n\n<h3 id=\"background\">Background</h3>\n\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\n\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\n\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\n\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\n\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\n\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\n\n<ol>\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\n<li><p>Install required build packages on the instance.</p>\n\n<pre><code>sudo apt-get update\nsudo apt-get install build-essential git\n</code></pre></li>\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\n\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\nchmod +x clone.sh\n./clone.sh           # will require a few minutes to finish\n</code></pre>\n\n<p>...this might take some time...</p>\n\n<div style=\"text-align: center;\">\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\n</div></li>\n<li><p>Take Cling for a spin!</p></li>\n</ol>\n\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\n\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\n\n<ol>\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\n<li><p>Install ARM hard-float compilation tools.</p>\n\n<pre><code># add Embedian as an installation source\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main &gt; /etc/apt/sources.list.d/crosstools.list\'\nsudo apt-get install -y curl\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\n\n# add arm hard-float as a supported architecture\nsudo dpkg --add-architecture armhf\nsudo apt-get update\n\n# install an ARM targeted cross compiler\nsudo apt-get install crossbuild-essential-armhf\n</code></pre></li>\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\n\n<pre><code># install QEMU emulation for ARM executables\nsudo apt-get install qemu binfmt-support qemu-user-static\nsudo update-binfmts --display\nsudo apt-get install libc6:armhf\n\n# compile an ARM executable\ncat &amp;gt; hello.c &amp;gt;&amp;gt; EOF\n\n#include &amp;lt;stdio.h&amp;gt;\nint main(void) { return printf(\"Hello ARM!\\n\"); }\nEOF\narm-linux-gnueabihf-gcc -static -ohello hello.c\n\n# the following should indicate an ARM exe\nfile hello\n\n# running the executable with no fanfare should\n# invoke QEMU transparently to print \"Hello ARM!\"\n./hello\n</code></pre>\n\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\n<li><p>Install build tools: cmake and ninja.</p>\n\n<pre><code> # install cmake\n sudo apt-get install cmake\n\n # ninja requires a build\n git clone git://github.com/martine/ninja.git &amp;amp;&amp;amp; cd ninja\n git checkout release\n ./configure.py --bootstrap\n chmod +x ninja build.ninja\n sudo cp ninja build.ninja /usr/bin\n</code></pre></li>\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\n\n<pre><code># the following steps assume this is done in the home directory\n# and therefore yielding ~/llvm\n\ngit clone http://root.cern.ch/git/llvm.git\ncd llvm\ngit checkout cling-patches\ncd tools\ngit clone http://root.cern.ch/git/cling.git\ngit clone http://root.cern.ch/git/clang.git\ncd clang \ngit checkout cling-patches\n</code></pre></li>\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em> Also, note that the following assumes that the prior step was run in <code>~/</code> resulting in an <code>~/llvm</code> directory.</p>\n\n<pre><code>mkdir -p build; cd build\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\n                  -DCMAKE_SYSTEM_NAME=Linux \\\n                  -DCMAKE_SYSTEM_VERSION=1 \\\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\n                  -DLLVM_TARGET_ARCH=ARM \\\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\n                  -DCMAKE_CXX_FLAGS= \\\n                      \"-mcpu=cortex-a9 \\       \n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\n                      -mfloat-abi=hard\"\n</code></pre></li>\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\n\n<pre><code>ninja install\n</code></pre></li>\n<li><p>Fire up Cling!</p></li>\n</ol>\n\n<p></body></html></p>\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 21:43:32','2015-02-26 21:43:32','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7959,17728,'2015-02-26 21:49:54','2015-02-26 21:49:54','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p></p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code># add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c >> EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done in the home directory\r\n# and therefore yielding ~/llvm\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em> Also, note that the following assumes that the prior step was run in <code>~/</code> resulting in an <code>~/llvm</code> directory.</p>\r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS= \\\r\n                      \"-mcpu=cortex-a9 \\       \r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code>ninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 21:49:54','2015-02-26 21:49:54','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7960,18132,'2015-02-26 21:54:43','2015-02-26 21:54:43','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p></p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>\r\nsudo apt-get update       # just in case\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c >> EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done in the home directory\r\n# and therefore yielding ~/llvm\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em> Also, note that the following assumes that the prior step was run in <code>~/</code> resulting in an <code>~/llvm</code> directory.</p>\r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS= \\\r\n                      \"-mcpu=cortex-a9 \\       \r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code>ninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 21:54:43','2015-02-26 21:54:43','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7961,18132,'2015-02-26 21:55:31','2015-02-26 21:55:31','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p></p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c >> EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done in the home directory\r\n# and therefore yielding ~/llvm\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em> Also, note that the following assumes that the prior step was run in <code>~/</code> resulting in an <code>~/llvm</code> directory.</p>\r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS= \\\r\n                      \"-mcpu=cortex-a9 \\       \r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code>ninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 21:55:31','2015-02-26 21:55:31','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7962,18132,'2015-02-26 21:59:24','2015-02-26 21:59:24','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p></p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c >> EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done in the home directory\r\n# and therefore yielding ~/llvm\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em> Also, note that the following assumes that the prior step was run in <code>~/</code> resulting in an <code>~/llvm</code> directory.</p>\r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS= \\\r\n                      \"-mcpu=cortex-a9 \\       \r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code>ninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 21:59:24','2015-02-26 21:59:24','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7963,18132,'2015-02-26 22:03:15','2015-02-26 22:03:15','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p></p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done in the home directory\r\n# and therefore yielding ~/llvm\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em> Also, note that the following assumes that the prior step was run in <code>~/</code> resulting in an <code>~/llvm</code> directory.</p>\r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS= \\\r\n                      \"-mcpu=cortex-a9 \\       \r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code>ninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 22:03:15','2015-02-26 22:03:15','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7964,18132,'2015-02-26 22:06:28','2015-02-26 22:06:28','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p></p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done in the home directory\r\n# and therefore yielding ~/llvm\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em> Also, note that the following assumes that the prior step was run in <code>~/</code> resulting in an <code>~/llvm</code> directory.</p> Indeed, the following block assumes that it is run in <code>~/</code>, as well.\r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS= \\\r\n                      \"-mcpu=cortex-a9 \\       \r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code>ninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 22:06:28','2015-02-26 22:06:28','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7965,18132,'2015-02-26 22:09:04','2015-02-26 22:09:04','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p></p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done in the home directory\r\n# and therefore yielding ~/llvm\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em> Also, note that the following assumes that the prior step was run in <code>~/</code> resulting in an <code>~/llvm</code> directory.Indeed, the following block assumes that it is run in <code>~/</code>, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja ~/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/home/admin/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS= \\\r\n                      \"-mcpu=cortex-a9 \\       \r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code>ninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 22:09:04','2015-02-26 22:09:04','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7966,18132,'2015-02-26 22:11:07','2015-02-26 22:11:07','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p></p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS= \\\r\n                      \"-mcpu=cortex-a9 \\       \r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code>ninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 22:11:07','2015-02-26 22:11:07','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7967,18132,'2015-02-26 22:14:19','2015-02-26 22:14:19','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p></p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\\\r\n                      \"-mcpu=cortex-a9 \\       \r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code>ninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 22:14:19','2015-02-26 22:14:19','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7968,18132,'2015-02-26 22:18:14','2015-02-26 22:18:14','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p></p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\       \r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code>ninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 22:18:14','2015-02-26 22:18:14','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7969,18132,'2015-02-26 22:25:18','2015-02-26 22:25:18','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p></p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code>ninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 22:25:18','2015-02-26 22:25:18','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7970,18132,'2015-02-26 22:28:49','2015-02-26 22:28:49','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code>ninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 22:28:49','2015-02-26 22:28:49','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7971,18132,'2015-02-26 22:35:54','2015-02-26 22:35:54','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need LLVM and Clang as they provide utilities for compilation: llvm-tblgen-3.5 and clang-tblgen-3.5.</p>\r\n\r\n<pre><code>sudo apt-get install llvm clang</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code>ninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 22:35:54','2015-02-26 22:35:54','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7972,18132,'2015-02-26 22:37:03','2015-02-26 22:37:03','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need LLVM and Clang as they provide utilities for compilation: llvm-tblgen-3.5 and clang-tblgen-3.5.</p>\r\n\r\n<pre><code>sudo apt-get install llvm clang\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# invoke QEMU transparently to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-26 22:37:03','2015-02-26 22:37:03','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7973,18132,'2015-02-27 05:31:53','2015-02-27 05:31:53','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n[\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need the newest LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen. To do so, perform a build of the current llvm git mirror,</p>\r\n\r\n<pre><code>\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post.</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout cling-patches\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout cling-patches\r\n</code></pre></li>\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling!</p></li>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-02-27 05:31:53','2015-02-27 05:31:53','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7977,18132,'2015-03-02 14:34:51','2015-03-02 14:34:51','This past week marked the passage of Leonard Nimoy. Here at ArrayFire, we are deeply saddened and touched by his departure. While Mr. Nimoy was anything but a scientist, mathematician, or programmer, he portrayed a character that embodied the best of all of those professions.\r\n\r\nWhereas Mr. Nimoy has had a send off on major news outlets regarding his amazing career throughout his entire life, we would rather like to express how he specifically inspired us to ultimately pursue our careers and why we toil under the ArrayFire banner.\r\n\r\nAs everyone (hopefully) knows, Leonard Nimoy portrayed the character of Spock on Star Trek. Logical, brilliant, and supposedly emotionless, Spock served as friend and counter-balance to Kirk - the brash, head-strong, yet charming captain of the starship Enterprise. Moreover, Spock was a supreme scientist, mathematician, and programmer; professions that we all here at ArrayFire hold in the deepest regard.\r\n\r\nThroughout the series, episodes examined the balance between Kirk and Spock and in so doing, played out the competitive use of charisma and daring against that of logic and science. Interestingly, whereas each episode picked a different balance of these tools, both where always used. Just as the resulting symbiosis in strategy came together for success, an obvious friendship was forged between Kirk and Spock. Each represented a different side of the same victorious coin and although pulling in opposite directions, the pair kept the Enterprise afloat.\r\n\r\nWhereas Kirk seemingly played an invincible captain, the science portrayed by Spock was just as astounding. Backed by communicators, talking computers, sensors, tricorders, and much more, Spock manipulated technology to win out against all odds. In pre-WW2 times, he built a super-computer out of \"stone knives and bear skins\" to give Kirk the information he needed to save the future. Spiraling down towards a collapsing planet, Spock utilized a theoretical formula to restart cold warp-engines and save the ship. In almost every episode, he was almost always the first to be asked \"what the hell is that?\" (I might have paraphrased that quote).\r\n\r\nAt this point, you might assume that we are enamored by Spock and script writers - not Mr. Nimoy.\r\n\r\nNo.\r\n\r\nWhereas Mr. Nimoy could have simply read a script and continued on his way, through his amazing talent, he made Spock a believable character and competitive friend to Kirk. In so doing, he made the science of the show believable and something to aspire to create. Everything going on beyond the science and with regards to Spock himself (through Mr. Nimoy\'s genius) cast aside any doubts. Without the skillful acting, the fictitious science would have come across as simple magic thrown in as plot devices. (Of course, some episodes were written as such, but there was enough in the show to amazingly inspire).\r\n\r\nAt ArrayFire, we like to think of ourselves as helping to push our bleeding edge technology as hard as it can go to serve science and mathematics. On a couple of occasions, we consider ourselves to have built supercomputers out of \"stone knives and bear skins.\" At each step, we are attempting to come up with an epic hack to make our poor computers do something nuts and save the day. All the while, we are interfacing with external clients and trying to come across as \"logically\" as we can.\r\n\r\nWe know we\'ll never single-handedly invent the tricorder, but we were inspired by a great actor to help with such endeavors as best we can. \r\n\r\nSo, we\'re here.\r\n\r\nThe death of Mr. Nimoy leaves us with regret due to memories of the past and ambitions of the present, but more so of the need for inspiration in the future. We\'ll all be watching Star Trek in the next few days with our sons and daughters (if they put up with it), but we are left hoping for the emergence of a similar scientific motivator for our children.\r\n\r\nRIP, Leonard Nimoy.','RIP, Leonard Nimoy','','publish','open','open','','rip-leonard-nimoy','','','2015-03-02 14:34:51','2015-03-02 14:34:51','',0,'http://sandbox.arrayfire.com/?p=7977',0,'post','',0),(7978,18132,'2015-03-01 17:00:12','2015-03-01 17:00:12','This past week marked the passage of Leonard Nimoy. Here at ArrayFire, we are deeply saddened and touched by his departure. While Mr. Nimoy was anything but a scientist, mathematician, or programmer, he portrayed a character that embodied the best of all of those professions. Whereas Mr. Nimoy has had a send off on major news outlets regarding his amazing career throughout his entire life, we would rather like to express how he specifically inspired us to ultimately pursue our careers and why we toil under the ArrayFire banner.\r\n\r\nAs everyone (hopefully) knows, Leonard Nimoy portrayed the character of Spock on Star Trek. Logical, brilliant, and supposedly emotionless, Spock served as friend and counter-balance to Kirk - the brash, head-strong, yet charming captain of the starship Enterprise. Moreover, Spock was a supreme scientist, mathematician, and programmer; professions that we all here at ArrayFire hold in the deepest regard.\r\n\r\nThroughout the series, episodes examined the balance between Kirk and Spock and in so doing, played out the competitive use of charisma and daring against that of logic and science. Interestingly, whereas each episode picked a different balance of these tools, both where always used. Just as the resulting symbiosis in strategy came together for success, an obvious friendship was forged between Kirk and Spock. Each represented a different side of the same victorious coin and although pulling in opposite directions, the pair kept the Enterprise afloat.\r\n\r\n\r\n\r\n\r\n\r\nNot only did their characters hold a special friendship, each represented  \r\n\r\noutline - - \r\n\r\n * nimoy played spock\r\n\r\n * inspired us to pursue our careers - - helping to push our bleeding edge technology as hard as it can go to serve science and mathematics','Leonard Nimoy RIP','','inherit','open','open','','7977-revision-v1','','','2015-03-01 17:00:12','2015-03-01 17:00:12','',7977,'http://sandbox.arrayfire.com/7977-revision-v1/',0,'revision','',0),(7979,18132,'2015-03-01 17:30:33','2015-03-01 17:30:33','This past week marked the passage of Leonard Nimoy. Here at ArrayFire, we are deeply saddened and touched by his departure. While Mr. Nimoy was anything but a scientist, mathematician, or programmer, he portrayed a character that embodied the best of all of those professions. Whereas Mr. Nimoy has had a send off on major news outlets regarding his amazing career throughout his entire life, we would rather like to express how he specifically inspired us to ultimately pursue our careers and why we toil under the ArrayFire banner.\r\n\r\nAs everyone (hopefully) knows, Leonard Nimoy portrayed the character of Spock on Star Trek. Logical, brilliant, and supposedly emotionless, Spock served as friend and counter-balance to Kirk - the brash, head-strong, yet charming captain of the starship Enterprise. Moreover, Spock was a supreme scientist, mathematician, and programmer; professions that we all here at ArrayFire hold in the deepest regard.\r\n\r\nThroughout the series, episodes examined the balance between Kirk and Spock and in so doing, played out the competitive use of charisma and daring against that of logic and science. Interestingly, whereas each episode picked a different balance of these tools, both where always used. Just as the resulting symbiosis in strategy came together for success, an obvious friendship was forged between Kirk and Spock. Each represented a different side of the same victorious coin and although pulling in opposite directions, the pair kept the Enterprise afloat.\r\n\r\nWhereas Kirk seemingly played an invincible captain, the science portrayed by Spock was just as astounding. Backed by communicators, talking computers, sensors, tricorders, and much more, Spock manipulated technology to win out against all odds. In pre-WW2 times, he built a super-computer out of \"stone knives and bear skins\" to give Kirk the information he needed to save the future. Spiraling down towards a collapsing planet, Spock utilized a theoretical formula to restart cold warp-engines and save the ship. In almost every episode, he was almost always the first to be asked \"what the hell is that?\" (I might have paraphrased that quote).\r\n\r\nAt this point, you might assume that we are enamored by Spock and script writers - not Mr. Nimoy.\r\n\r\nNo.\r\n\r\nWhereas Mr. Nimoy could have simply read a script and continued on his way, through his amazing talent, he made Spock a believable character and competitive friend to Kirk. In so doing, he made he science of the show believable and something to aspire to create. Without the skillful acting, the fictitious science would have come across as simple magic thrown in as plot devices. (Of course, some episodes were written as such, but there was enough in the show to amazingly inspire).\r\n\r\nAt ArrayFire, we like to think of ourselves as helping to push our bleeding edge technology as hard as it can go to serve science and mathematics. On a couple of occasions, we consider ourselves to have built supercomputers out of \"stone knives and bear skins.\" At each step, we are attempting to come up with an epic hack to make our poor computers do something nuts.\r\n\r\nAll the while, we are interfacing with external clients and trying to come across as \"logically\" as we can.\r\n\r\n','Leonard Nimoy RIP','','inherit','open','open','','7977-revision-v1','','','2015-03-01 17:30:33','2015-03-01 17:30:33','',7977,'http://sandbox.arrayfire.com/7977-revision-v1/',0,'revision','',0),(7980,18132,'2015-03-01 17:38:50','2015-03-01 17:38:50','This past week marked the passage of Leonard Nimoy. Here at ArrayFire, we are deeply saddened and touched by his departure. While Mr. Nimoy was anything but a scientist, mathematician, or programmer, he portrayed a character that embodied the best of all of those professions. Whereas Mr. Nimoy has had a send off on major news outlets regarding his amazing career throughout his entire life, we would rather like to express how he specifically inspired us to ultimately pursue our careers and why we toil under the ArrayFire banner.\r\n\r\nAs everyone (hopefully) knows, Leonard Nimoy portrayed the character of Spock on Star Trek. Logical, brilliant, and supposedly emotionless, Spock served as friend and counter-balance to Kirk - the brash, head-strong, yet charming captain of the starship Enterprise. Moreover, Spock was a supreme scientist, mathematician, and programmer; professions that we all here at ArrayFire hold in the deepest regard.\r\n\r\nThroughout the series, episodes examined the balance between Kirk and Spock and in so doing, played out the competitive use of charisma and daring against that of logic and science. Interestingly, whereas each episode picked a different balance of these tools, both where always used. Just as the resulting symbiosis in strategy came together for success, an obvious friendship was forged between Kirk and Spock. Each represented a different side of the same victorious coin and although pulling in opposite directions, the pair kept the Enterprise afloat.\r\n\r\nWhereas Kirk seemingly played an invincible captain, the science portrayed by Spock was just as astounding. Backed by communicators, talking computers, sensors, tricorders, and much more, Spock manipulated technology to win out against all odds. In pre-WW2 times, he built a super-computer out of \"stone knives and bear skins\" to give Kirk the information he needed to save the future. Spiraling down towards a collapsing planet, Spock utilized a theoretical formula to restart cold warp-engines and save the ship. In almost every episode, he was almost always the first to be asked \"what the hell is that?\" (I might have paraphrased that quote).\r\n\r\nAt this point, you might assume that we are enamored by Spock and script writers - not Mr. Nimoy.\r\n\r\nNo.\r\n\r\nWhereas Mr. Nimoy could have simply read a script and continued on his way, through his amazing talent, he made Spock a believable character and competitive friend to Kirk. In so doing, he made the science of the show believable and something to aspire to create. Everything going on beyond the science and with regards to Spock himself (through Mr. Nimoy\'s genius) cast aside any doubts. Without the skillful acting, the fictitious science would have come across as simple magic thrown in as plot devices. (Of course, some episodes were written as such, but there was enough in the show to amazingly inspire).\r\n\r\nAt ArrayFire, we like to think of ourselves as helping to push our bleeding edge technology as hard as it can go to serve science and mathematics. On a couple of occasions, we consider ourselves to have built supercomputers out of \"stone knives and bear skins.\" At each step, we are attempting to come up with an epic hack to make our poor computers do something nuts and save the day. All the while, we are interfacing with external clients and trying to come across as \"logically\" as we can.\r\n\r\nWe know we\'ll never single-handedly invent the tricorder, but we were inspired by a great actor to help with such endeavors as best we can. \r\n\r\nSo, we\'re here.\r\n\r\nThe death of Mr. Nimoy leaves us with regret due to memories of the past and ambitions of the present, but more so of the need for inspiration in the future. We\'ll all be watching Star Trek in the next few days with our sons and daughters (if they put up with it), but we are left hoping for the emergence of a similar scientific motivator for our children.\r\n\r\nRIP, Leonard Nimoy.','Leonard Nimoy RIP','','inherit','open','open','','7977-revision-v1','','','2015-03-01 17:38:50','2015-03-01 17:38:50','',7977,'http://sandbox.arrayfire.com/7977-revision-v1/',0,'revision','',0),(7981,18132,'2015-03-01 17:39:11','2015-03-01 17:39:11','This past week marked the passage of Leonard Nimoy. Here at ArrayFire, we are deeply saddened and touched by his departure. While Mr. Nimoy was anything but a scientist, mathematician, or programmer, he portrayed a character that embodied the best of all of those professions. Whereas Mr. Nimoy has had a send off on major news outlets regarding his amazing career throughout his entire life, we would rather like to express how he specifically inspired us to ultimately pursue our careers and why we toil under the ArrayFire banner.\r\n\r\nAs everyone (hopefully) knows, Leonard Nimoy portrayed the character of Spock on Star Trek. Logical, brilliant, and supposedly emotionless, Spock served as friend and counter-balance to Kirk - the brash, head-strong, yet charming captain of the starship Enterprise. Moreover, Spock was a supreme scientist, mathematician, and programmer; professions that we all here at ArrayFire hold in the deepest regard.\r\n\r\nThroughout the series, episodes examined the balance between Kirk and Spock and in so doing, played out the competitive use of charisma and daring against that of logic and science. Interestingly, whereas each episode picked a different balance of these tools, both where always used. Just as the resulting symbiosis in strategy came together for success, an obvious friendship was forged between Kirk and Spock. Each represented a different side of the same victorious coin and although pulling in opposite directions, the pair kept the Enterprise afloat.\r\n\r\nWhereas Kirk seemingly played an invincible captain, the science portrayed by Spock was just as astounding. Backed by communicators, talking computers, sensors, tricorders, and much more, Spock manipulated technology to win out against all odds. In pre-WW2 times, he built a super-computer out of \"stone knives and bear skins\" to give Kirk the information he needed to save the future. Spiraling down towards a collapsing planet, Spock utilized a theoretical formula to restart cold warp-engines and save the ship. In almost every episode, he was almost always the first to be asked \"what the hell is that?\" (I might have paraphrased that quote).\r\n\r\nAt this point, you might assume that we are enamored by Spock and script writers - not Mr. Nimoy.\r\n\r\nNo.\r\n\r\nWhereas Mr. Nimoy could have simply read a script and continued on his way, through his amazing talent, he made Spock a believable character and competitive friend to Kirk. In so doing, he made the science of the show believable and something to aspire to create. Everything going on beyond the science and with regards to Spock himself (through Mr. Nimoy\'s genius) cast aside any doubts. Without the skillful acting, the fictitious science would have come across as simple magic thrown in as plot devices. (Of course, some episodes were written as such, but there was enough in the show to amazingly inspire).\r\n\r\nAt ArrayFire, we like to think of ourselves as helping to push our bleeding edge technology as hard as it can go to serve science and mathematics. On a couple of occasions, we consider ourselves to have built supercomputers out of \"stone knives and bear skins.\" At each step, we are attempting to come up with an epic hack to make our poor computers do something nuts and save the day. All the while, we are interfacing with external clients and trying to come across as \"logically\" as we can.\r\n\r\nWe know we\'ll never single-handedly invent the tricorder, but we were inspired by a great actor to help with such endeavors as best we can. \r\n\r\nSo, we\'re here.\r\n\r\nThe death of Mr. Nimoy leaves us with regret due to memories of the past and ambitions of the present, but more so of the need for inspiration in the future. We\'ll all be watching Star Trek in the next few days with our sons and daughters (if they put up with it), but we are left hoping for the emergence of a similar scientific motivator for our children.\r\n\r\nRIP, Leonard Nimoy.','RIP, Leonard Nimoy','','inherit','open','open','','7977-revision-v1','','','2015-03-01 17:39:11','2015-03-01 17:39:11','',7977,'http://sandbox.arrayfire.com/7977-revision-v1/',0,'revision','',0),(7982,18132,'2015-03-01 17:39:47','2015-03-01 17:39:47','This past week marked the passage of Leonard Nimoy. Here at ArrayFire, we are deeply saddened and touched by his departure. While Mr. Nimoy was anything but a scientist, mathematician, or programmer, he portrayed a character that embodied the best of all of those professions.\r\n\r\nWhereas Mr. Nimoy has had a send off on major news outlets regarding his amazing career throughout his entire life, we would rather like to express how he specifically inspired us to ultimately pursue our careers and why we toil under the ArrayFire banner.\r\n\r\nAs everyone (hopefully) knows, Leonard Nimoy portrayed the character of Spock on Star Trek. Logical, brilliant, and supposedly emotionless, Spock served as friend and counter-balance to Kirk - the brash, head-strong, yet charming captain of the starship Enterprise. Moreover, Spock was a supreme scientist, mathematician, and programmer; professions that we all here at ArrayFire hold in the deepest regard.\r\n\r\nThroughout the series, episodes examined the balance between Kirk and Spock and in so doing, played out the competitive use of charisma and daring against that of logic and science. Interestingly, whereas each episode picked a different balance of these tools, both where always used. Just as the resulting symbiosis in strategy came together for success, an obvious friendship was forged between Kirk and Spock. Each represented a different side of the same victorious coin and although pulling in opposite directions, the pair kept the Enterprise afloat.\r\n\r\nWhereas Kirk seemingly played an invincible captain, the science portrayed by Spock was just as astounding. Backed by communicators, talking computers, sensors, tricorders, and much more, Spock manipulated technology to win out against all odds. In pre-WW2 times, he built a super-computer out of \"stone knives and bear skins\" to give Kirk the information he needed to save the future. Spiraling down towards a collapsing planet, Spock utilized a theoretical formula to restart cold warp-engines and save the ship. In almost every episode, he was almost always the first to be asked \"what the hell is that?\" (I might have paraphrased that quote).\r\n\r\nAt this point, you might assume that we are enamored by Spock and script writers - not Mr. Nimoy.\r\n\r\nNo.\r\n\r\nWhereas Mr. Nimoy could have simply read a script and continued on his way, through his amazing talent, he made Spock a believable character and competitive friend to Kirk. In so doing, he made the science of the show believable and something to aspire to create. Everything going on beyond the science and with regards to Spock himself (through Mr. Nimoy\'s genius) cast aside any doubts. Without the skillful acting, the fictitious science would have come across as simple magic thrown in as plot devices. (Of course, some episodes were written as such, but there was enough in the show to amazingly inspire).\r\n\r\nAt ArrayFire, we like to think of ourselves as helping to push our bleeding edge technology as hard as it can go to serve science and mathematics. On a couple of occasions, we consider ourselves to have built supercomputers out of \"stone knives and bear skins.\" At each step, we are attempting to come up with an epic hack to make our poor computers do something nuts and save the day. All the while, we are interfacing with external clients and trying to come across as \"logically\" as we can.\r\n\r\nWe know we\'ll never single-handedly invent the tricorder, but we were inspired by a great actor to help with such endeavors as best we can. \r\n\r\nSo, we\'re here.\r\n\r\nThe death of Mr. Nimoy leaves us with regret due to memories of the past and ambitions of the present, but more so of the need for inspiration in the future. We\'ll all be watching Star Trek in the next few days with our sons and daughters (if they put up with it), but we are left hoping for the emergence of a similar scientific motivator for our children.\r\n\r\nRIP, Leonard Nimoy.','RIP, Leonard Nimoy','','inherit','open','open','','7977-revision-v1','','','2015-03-01 17:39:47','2015-03-01 17:39:47','',7977,'http://sandbox.arrayfire.com/7977-revision-v1/',0,'revision','',0),(7983,18132,'2015-03-01 22:09:46','2015-03-01 22:09:46','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need the newest LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen. To do so, perform a build of the current llvm git mirror,</p>\r\n\r\n<pre><code>\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! ou can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/bin\r\n./cling\r\n</code></pre>\r\n<img>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 22:09:46','2015-03-01 22:09:46','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7984,18132,'2015-03-01 23:06:54','2015-03-01 23:06:54','<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need the newest LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen. To do so, perform a build of the current llvm git mirror,</p>\r\n\r\n<pre><code>\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! ou can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/bin\r\n./cling\r\n</code></pre>\r\n<img src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 23:06:54','2015-03-01 23:06:54','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7985,18132,'2015-03-01 23:10:12','2015-03-01 23:10:12','<div style=\"text-align: center; \r\n  display: block; \r\n  float: right;\r\n  margin-left: 20px;\r\n  margin-right: 20px;\r\n  margin-bottom: 10px;\r\n  text-align: justify;\">\r\n<img width=\"50%\" src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need the newest LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen. To do so, perform a build of the current llvm git mirror,</p>\r\n\r\n<pre><code>\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! ou can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/bin\r\n./cling\r\n</code></pre>\r\n<div style=\"text-align: center\">\r\n<img src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 23:10:12','2015-03-01 23:10:12','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7986,18132,'2015-03-01 23:11:21','2015-03-01 23:11:21','<div style=\"text-align: center; display: block; float: right;margin-left: 20px;margin-right: 20px;margin-bottom: 10px; text-align: justify;\">\r\n<img width=\"50%\" src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need the newest LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen. To do so, perform a build of the current llvm git mirror,</p>\r\n\r\n<pre><code>\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! ou can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/bin\r\n./cling\r\n</code></pre>\r\n<div style=\"text-align: center\">\r\n<img src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 23:11:21','2015-03-01 23:11:21','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7987,18132,'2015-03-01 23:11:48','2015-03-01 23:11:48','<div style=\"text-align: center; display: block; float: right;margin-left: 20px;margin-right: 20px;margin-bottom: 10px; text-align: justify;\">\r\n<img width=\"200px\" src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need the newest LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen. To do so, perform a build of the current llvm git mirror,</p>\r\n\r\n<pre><code>\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! ou can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/bin\r\n./cling\r\n</code></pre>\r\n<div style=\"text-align: center\">\r\n<img src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 23:11:48','2015-03-01 23:11:48','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7988,18132,'2015-03-01 23:12:04','2015-03-01 23:12:04','<div style=\"text-align: center; display: block; float: right;margin-left: 20px;margin-right: 20px;margin-bottom: 10px; text-align: justify;\">\r\n<img width=\"300px\" src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need the newest LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen. To do so, perform a build of the current llvm git mirror,</p>\r\n\r\n<pre><code>\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! ou can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/bin\r\n./cling\r\n</code></pre>\r\n<div style=\"text-align: center\">\r\n<img src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 23:12:04','2015-03-01 23:12:04','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7989,18132,'2015-03-01 23:14:24','2015-03-01 23:14:24','<div style=\"text-align: center; display: block; float: right;margin-left: 20px;margin-right: 20px;margin-bottom: 10px; text-align: justify;\">\r\n<img width=\"300px\" src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/>A C++ interpreter compiled for ARM running on an x86 EC2 instance after following the given instructions. As C++ becomes more mature and high-level, an interpreted workflow might lead to mainstream C++ <i>productivity</i> in addition to development!</div>\r\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need the newest LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen. To do so, perform a build of the current llvm git mirror,</p>\r\n\r\n<pre><code>\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! ou can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/bin\r\n./cling\r\n</code></pre>\r\n<div style=\"text-align: center\">\r\n<img src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 23:14:24','2015-03-01 23:14:24','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7990,18132,'2015-03-01 23:15:31','2015-03-01 23:15:31','<div style=\"text-align: center; display: block; float: right;margin-left: 20px;margin-right: 20px;margin-bottom: 10px; text-align: justify;\">/<img width=\"300px\" src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/>A C++ interpreter compiled for ARM running on an x86 EC2 instance after following the given instructions. As C++ becomes more mature and high-level, an interpreted workflow might lead to mainstream C++ <i>productivity</i> in addition to development!</div>\r\n\r\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need the newest LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen. To do so, perform a build of the current llvm git mirror,</p>\r\n\r\n<pre><code>\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! ou can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/bin\r\n./cling\r\n</code></pre>\r\n<div style=\"text-align: center\">\r\n<img src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 23:15:31','2015-03-01 23:15:31','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7991,18132,'2015-03-01 23:16:08','2015-03-01 23:16:08','<div style=\"text-align: center; display: block; float: right;margin-left: 20px;margin-right: 20px;margin-bottom: 10px; text-align: justify;\"><img width=\"300px\" src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/>A C++ interpreter compiled for ARM running on an x86 EC2 instance after following the given instructions. As C++ becomes more mature and high-level, an interpreted workflow might lead to mainstream C++ <i>productivity</i> in addition to development!</div>\r\n\r\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need the newest LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen. To do so, perform a build of the current llvm git mirror,</p>\r\n\r\n<pre><code>\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! ou can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/bin\r\n./cling\r\n</code></pre>\r\n<div style=\"text-align: center\">\r\n<img src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 23:16:08','2015-03-01 23:16:08','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7992,18132,'2015-03-01 23:18:09','2015-03-01 23:18:09','<div style=\"text-align: center; display: block; float: right;margin-left: 20px;margin-right: 20px;margin-bottom: 10px; text-align: justify; width: 300px; font-size: 13px; font-weight: bold\"><img width=\"300px\" src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/>A C++ interpreter compiled for ARM running on an x86 EC2 instance after following the given instructions. As C++ becomes more mature and high-level, an interpreted workflow might lead to mainstream C++ <i>productivity</i> in addition to development!</div>\r\n\r\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need the newest LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen. To do so, perform a build of the current llvm git mirror,</p>\r\n\r\n<pre><code>\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! ou can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/bin\r\n./cling\r\n</code></pre>\r\n<div style=\"text-align: center\">\r\n<img src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 23:18:09','2015-03-01 23:18:09','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7993,18132,'2015-03-01 23:28:15','2015-03-01 23:28:15','<div style=\"text-align: center; display: block; float: right;margin-left: 20px;margin-right: 20px;margin-bottom: 10px; text-align: justify; width: 300px; font-size: 13px; font-weight: bold\"><img width=\"300px\" src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/>A C++ interpreter compiled for ARM running on an x86 EC2 instance after following the given instructions. As C++ becomes more mature and high-level, an interpreted workflow might lead to mainstream C++ <i>productivity</i> in addition to development!</div>\r\n\r\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need the newest LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen.</p>\r\n\r\n<pre><code>sudo apt-get install llvm clang\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! ou can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/bin\r\n./cling\r\n</code></pre>\r\n<div style=\"text-align: center\">\r\n<img src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 23:28:15','2015-03-01 23:28:15','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7994,18132,'2015-03-01 23:29:49','2015-03-01 23:29:49','<div style=\"text-align: center; display: block; float: right;margin-left: 20px;margin-right: 20px;margin-bottom: 10px; text-align: justify; width: 300px; font-size: 13px; font-weight: bold\"><img width=\"300px\" src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/>A C++ interpreter compiled for ARM running on an x86 EC2 instance after following the given instructions. As C++ becomes more mature and high-level, an interpreted workflow might lead to mainstream C++ <i>productivity</i> in addition to development!</div>\r\n\r\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen.</p>\r\n\r\n<pre><code>sudo apt-get install llvm clang\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! ou can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/bin\r\n./cling\r\n</code></pre>\r\n<div style=\"text-align: center\">\r\n<img src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 23:29:49','2015-03-01 23:29:49','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7995,18132,'2015-03-01 23:31:52','2015-03-01 23:31:52','<div style=\"text-align: center; display: block; float: right;margin-left: 20px;margin-right: 20px;margin-bottom: 10px; text-align: justify; width: 300px; font-size: 13px; font-weight: bold\"><img width=\"300px\" src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/>A C++ interpreter compiled for ARM running on an x86 EC2 instance after following the given instructions. As C++ becomes more mature and high-level, an interpreted workflow might lead to mainstream C++ <i>productivity</i> in addition to development!</div>\r\n\r\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen.</p>\r\n\r\n<pre><code>sudo apt-get install llvm clang\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! You can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/bin\r\n./cling\r\n</code></pre>\r\n<div style=\"text-align: center\">\r\n<img src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 23:31:52','2015-03-01 23:31:52','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(7996,18132,'2015-03-01 23:32:33','2015-03-01 23:32:33','<div style=\"text-align: center; display: block; float: right;margin-left: 20px;margin-right: 20px;margin-bottom: 10px; text-align: justify; width: 300px; font-size: 13px; font-weight: bold\"><img width=\"300px\" src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/>A C++ interpreter compiled for ARM running on an x86 EC2 instance after following the given instructions. As C++ becomes more mature and high-level, an interpreted workflow might lead to mainstream C++ <i>productivity</i> in addition to development!</div>\r\n\r\n<p>Development through a C++ interpreter (Cling) as opposed to a standard compiler is an amazing leap in productivity and a window into the newest features of C++. This post tells you how to get your own bleeding-edge C++ interpreter built right on top of the development version of LLVM. We give you a repeatable procedure via Amazon EC2.</p>\r\n\r\n<p>With our prescribed steps in place, you can always have an up-to-date development version of Cling. This allows quick testing and investigation of LLVM\'s newest features. You will also possess a development environment as a path to contributing to Cling or learning how Cling\'s innards push C++ code along.</p>\r\n\r\n<h3 id=\"background\">Background</h3>\r\n\r\n<p>Astoundingly, there <strong>is</strong> such a thing as a C++ interpreter! Thus, if you\'re interested in sticking to C++ for speed and efficiency, you\'re not confined to the code-compile-run-debug workflow. Living outside such a workflow lends jumps in productivity and a unique angle through which to see C++.</p>\r\n\r\n<p>Development of a serious C++ interpreter <a href=\"http://www.linuxjournal.com/article/2895\">was undertaken by the wizards at CERN</a> starting at around 1995. (You might recognize this group as searchers <a href=\"http://home.web.cern.ch/topics/higgs-boson\">for the Higgs Boson</a>). The C++ interpreter was dubbed <a href=\"https://root.cern.ch/drupal/content/cint\">CINT</a> and was designed to support a major data analysis and visualization package known as <a href=\"https://root.cern.ch/drupal/\">ROOT</a> (screenshot below). The system is certainly serious as it is giving researchers a way to investigate the very fabric of the universe!</p>\r\n\r\n<p><img src=\"http://root.cern.ch/drupal/sites/default/files/images/alieve-esd-pbpb.png\" alt=\"A ROOT screenshot being driven by a C++ interpreter (CINT). CINT is not a toy implementation - rather it is used to investigate the fabric of the universe.\" /></p>\r\n\r\n<p>Over the last 20 years, CINT fell behind the evolving C++ language. In response, individuals at CERN began work on a replacement for CINT dubbed Cling with the strategy of leveraging LLVM to stay up to date with the growing C++ specification. Up until recently, the project has been rather nascent, but now it is at the point where its functionality and build system make Cling worthwhile for use and contribution.</p>\r\n\r\n<h3 id=\"build-instructions-for-x86\">Build instructions for x86</h3>\r\n\r\n<p>We present a build procedure that leverages Amazon EC2. By using the cloud, you are guaranteed to use the exact Linux version and hardware capabilities that we did in testing. We assume that you have an Amazon EC2 account. The expected compute resource cost will be around two dollars.</p>\r\n\r\n<ol>\r\n<li><p>Create an <strong>m3.xlarge</strong> instance with the <a href=\"http://thecloudmarket.com/image/ami-aae18fc2--debian-jessie-amd64-hvm-2014-12-25-13-19-ebs\">Debian Jessie AMI (ami-aae18fc2)</a>. Be sure to grab at least <strong>32Gb</strong> of storage.</p></li>\r\n<li><p>Boot the instance and login as <strong>admin</strong>.</p></li>\r\n<li><p>Install required build packages on the instance.</p>\r\n\r\n<pre><code>sudo apt-get update\r\nsudo apt-get install build-essential git\r\n</code></pre></li>\r\n<li><p>Use <a href=\"https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\">the distributed build script</a> from the Cling project to clone required source code and build an x86 version of Cling with all available cores.</p>\r\n\r\n<pre><code>wget https://raw.githubusercontent.com/karies/cling-all-in-one/master/clone.sh\r\nchmod +x clone.sh\r\n./clone.sh           # will require a few minutes to finish\r\n</code></pre>\r\n\r\n<p>...this might take some time...</p>\r\n\r\n<div style=\"text-align: center;\">\r\n  <img width=\"75%\" style=\"padding: 20px;\" src=\"https://dl.dropboxusercontent.com/u/96059047/cling_build.png\" alt=\"Building cling on an x86 EC2 instance\" />\r\n</div></li>\r\n<li><p>Take Cling for a spin!</p></li>\r\n</ol>\r\n\r\n<h3 id=\"build-instructions-for-arm\">Build instructions for ARM</h3>\r\n\r\n<p>Whereas an x86 build is readily supported by the Cling developers, building for ARM is not a standard build path. Thus, ARM build instructions are a bit more involved.</p>\r\n\r\n<ol>\r\n<li><p>Log in as <strong>admin</strong> to the (same x86) instance described.</p></li>\r\n<li><p>First, you\'ll need LLVM and Clang as they provide utilities for compilation: llvm-tblgen and clang-tblgen.</p>\r\n\r\n<pre><code>sudo apt-get install llvm clang\r\n</code></pre>\r\n\r\n<li><p>Install ARM hard-float compilation tools.</p>\r\n\r\n<pre><code>sudo apt-get update\r\n\r\n# add Embedian as an installation source\r\nsudo bash -c \'echo deb http://emdebian.org/tools/debian/ jessie main > \\\r\n              /etc/apt/sources.list.d/crosstools.list\'\r\nsudo apt-get install -y curl\r\ncurl http://emdebian.org/tools/debian/emdebian-toolchain-archive.key | sudo apt-key add -\r\n\r\n# add arm hard-float as a supported architecture\r\nsudo dpkg --add-architecture armhf\r\nsudo apt-get update\r\n\r\n# install an ARM targeted cross compiler\r\nsudo apt-get install crossbuild-essential-armhf\r\n</code></pre></li>\r\n<li><p>Install QEMU-based ARM emulation. This is a fantastic feature of newer linux kernels: ARM executables are registered with the system so that under a normal invocation, QEMU is invoked under the hood so that it seems as though ARM binaries are native.</p>\r\n\r\n<pre><code># install QEMU emulation for ARM executables\r\nsudo apt-get install qemu binfmt-support qemu-user-static\r\nsudo update-binfmts --display\r\nsudo apt-get install libc6:armhf\r\n\r\n# compile an ARM executable\r\ncat > hello.c << EOF\r\n\r\n#include <stdio.h>\r\nint main(void) { return printf(\"Hello ARM!\\n\"); }\r\nEOF\r\narm-linux-gnueabihf-gcc -static -ohello hello.c\r\n\r\n# the following should indicate an ARM exe\r\nfile hello\r\n\r\n# running the executable with no fanfare should\r\n# transparently invoke QEMU to print \"Hello ARM!\"\r\n./hello\r\n</code></pre>\r\n\r\n<p>Having ARM emulation on our fast build machine makes debugging amazingly faster.</p></li>\r\n<li><p>Install build tools: cmake and ninja.</p>\r\n\r\n<pre><code> # install cmake\r\n sudo apt-get install cmake\r\n\r\n # ninja requires a build\r\n git clone git://github.com/martine/ninja.git && cd ninja\r\n git checkout release\r\n ./configure.py --bootstrap\r\n chmod +x ninja build.ninja\r\n sudo cp ninja build.ninja /usr/bin\r\n</code></pre></li>\r\n<li><p>Clone LLVM, Clang, and Cling to the <strong>llvm</strong> directory. This directory differs from the instructions, above, so no worries if you\'re following these steps in the order of the blog post. Note the specific SHA\'s we jump to in the repositories. As of this writing, ARM support is in and out, but will hopefully materialize for good!</p>\r\n\r\n<pre><code># the following steps assume this is done on a large volume\r\n# mounted at /mnt resulting in /mnt/llvm.\r\n\r\ngit clone http://root.cern.ch/git/llvm.git\r\ncd llvm\r\ngit checkout 88c56cd6d6aec0c44e9ca5aa96b354c1261a95aa\r\ncd tools\r\ngit clone http://root.cern.ch/git/cling.git\r\ncd cling\r\ngit checkout 899a5dde32cf670605a1478bea0b2d6fd3f95bef\r\ncd ..\r\ngit clone http://root.cern.ch/git/clang.git\r\ncd clang \r\ngit checkout d649bf1a04be728fc09222d111e696fce4b55324\r\n</code></pre></li\r\n<li><p>Configure a build in a new <strong>build</strong> directory using cmake. Note the intense and carefully crafted build flags required to do a successful cross compilation. <em>This took quite a bit of debugging to lock down.</em></p>\r\n\r\n<p>Note that the following assumes that the prior step was run in <code>/mnt</code> resulting in an <code>/mnt/llvm</code> directory. Indeed, the following block assumes that it is run in the <code>/mnt</code> directory, as well.</p> \r\n\r\n<pre><code>mkdir -p build; cd build\r\ncmake -G Ninja /mnt/llvm -DCMAKE_CROSSCOMPILING=True \\\r\n                  -DCMAKE_SYSTEM_NAME=Linux \\\r\n                  -DCMAKE_SYSTEM_VERSION=1 \\\r\n                  -DCMAKE_SYSTEM_PROCESSOR=armv7 \\\r\n                  -DCMAKE_C_COMPILER=arm-linux-gnueabihf-gcc \\\r\n                  -DCMAKE_CXX_COMPILER=arm-linux-gnueabihf-g++ \\\r\n                  -DCMAKE_INSTALL_PREFIX=/mnt/build/install \\\r\n                  -DLLVM_TABLEGEN=/usr/bin/llvm-tblgen-3.5 \\\r\n                  -DCLANG_TABLEGEN=/usr/bin/clang-tblgen-3.5 \\\r\n                  -DLLVM_DEFAULT_TARGET_TRIPLE=arm-linux-gnueabihf \\\r\n                  -DLLVM_HOST_TRIPLE=arm--linux-gnueabihf \\\r\n                  -DLLVM_TARGET_ARCH=ARM \\\r\n                  -DLLVM_TARGETS_TO_BUILD=ARM \\\r\n                  -DCMAKE_CXX_FLAGS=\"\\\r\n                      -mcpu=cortex-a9 \\\r\n                      -I/usr/include/arm-linux-gnueabihf/c++/4.9 \\\r\n                      -I/usr/lib/gcc/arm-linux-gnueabihf/4.9/include \\\r\n                      -mfloat-abi=hard\"\r\n</code></pre></li>\r\n<li><p>Do a build with ninja and install to the <strong>install</strong> subdirectory. This will take a few minutes.</p>\r\n\r\n<pre><code># from the /mnt/build directory\r\nmkdir -p install\r\nninja install\r\n</code></pre></li>\r\n<li><p>Fire up Cling! You can do this directly on your Amazon EC2 instance through QEMU, but watch out - it is a tad unstable in the case of recovering from syntax errors, etc. However, you can copy what you built to an ARM machine such as a Raspberry Pi or <a href=\"http://www.solid-run.com\">Cubox</a> to take it for a whirl there, too!</p></li>\r\n<pre><code>cd /mnt/build/install/bin\r\n./cling\r\n</code></pre>\r\n<div style=\"text-align: center\">\r\n<img src=\"https://dl.dropboxusercontent.com/u/96059047/animation.gif\"/></div>\r\n</img>\r\n</ol>\r\n\r\n<p></body></html></p>\r\n','Building a C++ Interpreter (Cling) for x86 and ARM','','inherit','open','open','','7681-revision-v1','','','2015-03-01 23:32:33','2015-03-01 23:32:33','',7681,'http://sandbox.arrayfire.com/7681-revision-v1/',0,'revision','',0),(8000,6,'2015-03-02 21:24:29','2015-03-02 21:24:29','<img class=\"aligncenter size-full wp-image-8002\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/03/GTC-15-Header.png\" alt=\"GTC 15 Header\" width=\"974\" height=\"330\" />\r\n\r\nGTC is quickly approaching and we want to see you there!\r\n\r\n<strong>When: March 17-20</strong>\r\n<strong>Where: San Jose, California</strong>\r\n<strong>ArrayFire Booth: 713</strong>\r\n\r\nGTC is the world\'s premier GPU developer conference. Connect with experts from NVIDIA and other leaders in high performance computing. At GTC you\'ll discover what\'s next in GPU breakthroughs, and gain useful insights in over 500 sessions and hands-on labs covering a diverse range of application domains.\r\n\r\nArrayFire will be out in full force at GTC, and we invite you to join us at our CUDA tutorials, hands-on lab, and talks presented by our knowledgeable and experienced GPU developers. Visit the <a href=\"https://registration.gputechconf.com/form/session-listing\">GTC Session Catalog</a> for more details—you don\'t want to miss out!\r\n<h3>ArrayFire Tutorials at GTC</h3>\r\n<h5>S5797 - Introduction to GPU Computing Using the ArrayFire Acceleration Library</h5>\r\n<h6>Presented by Umar Arshad - Tuesday March 17 at 1:00 PM</h6>\r\nNew to GPU computing and don\'t know where to start? Are you an expert in GPU computing and tired of writing your kernels from scratch? If that is the case, this tutorial is perfect for you! In this tutorial we will introduce you to a simple and intuitive API that will make GPU computing highly productive and stress free. Last November, the ArrayFire library was open-source and made available to the general public. In this talk we will walk you through the installation process, introduce the ArrayFire API, and show several applications that have been developed using the API.\r\n<h5>S5796 - Image Learning and Computer Vision in CUDA</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nAnalyzing a massive data set? Need fast results? Need computer vision algorithms? Not sure when and where to start? The answer is here and now! In this tutorial we will give you the tools to bring your favorite computer vision algorithm to life. In this tutorial we will go over key challenges for implementing computer vision and machine learning algorithms on the GPU. We will walk you through several computer vision algorithms for the GPU (ORB, Fast, SIFT) and give you the hands experience to implement you own algorithms.\r\n<h5>S5803 - Simplified Machine Learning Programming for CUDA</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 9:30 AM</h6>\r\nLooking for a simplified way to program machine learning algorithms? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated machine learning algorithms.\r\n<h5>S5804 - Application Development for Mobile Devices: A Case Study for the Tegra K1</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 2:00 PM</h6>\r\nEmbedded systems are ubiquitous in today\'s world. The Tegra K1 is a front-runner for low-power efficient high performance embedded systems. In this tutorial we will share with you our experience in developing applications for the Tegra K1. We will show how the ArrayFire library and its simple API can be used to deploy stable applications for the Tegra K1 in a quick manner. Specifically, we will cover the zero-copy capabilities of CUDA and show how ArrayFire leverages that capability to efficiently run a very large number of algorithms in real-time. Using ArrayFire\'s graphic package it is easy to create stunning visuals using Tegra\'s OpenGL 4.4 capability, this too will be discussed in today\'s tutorial.\r\n<h3>ArrayFire Hands-on Lab at GTC</h3>\r\n<h5>S5722 - Hands-on Lab: Deep Belief Networks Using ArrayFire</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 3:30 PM</h6>\r\nWorking on image processing, computer vision, or machine learning? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Deep Belief Networks are a specialized neural network that can be efficiently optimized on the GPU. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated image processing and machine learning. As we\'ll be using GPUs hosted in the cloud, all you are required to bring is a laptop with a modern browser.\r\n<h3>ArrayFire Talks at GTC</h3>\r\n<h5>S5205 - Real-Time and High Resolution Feature Tracking and Object Recognition</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nThis session will cover real-time feature tracking and object recognition in high resolution videos using GPUs and productive software libraries including ArrayFire. Feature tracking and object recognition are computer vision problems that have challenged researchers for decades. Over the last 15 years, numerous approaches were proposed to solve these problems, some of the most important being SIFT, SURF and ORB. Traditionally, these approaches are so computationally complex that processing more than a few frames per second is impossible. Using an NVIDIA K20 GPU with ORB, we are able to process about 30 frames per second on images in the order of Ultra HD resolution. Multiple quality and timing benchmarks will be presented, covering some of the most robust feature tracking methods.\r\n<h5>S5176 - Fast Triangle Counting for Social Network Analytics on the K40</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 4:30 PM</h6>\r\nIn this session we will explore a new approach for counting triangles in networks that partitions the work at multiple parallel granularties. This new approach is highly scalable and is appropriate for both sparse and dense networks.\r\n\r\n<hr />\r\n\r\n<h5>Schedule a Meeting with Us</h5>\r\nDo you want to meet with us personally? Schedule a time to sit down with ArrayFire engineers and account representatives using our <a href=\"http://www.meetme.so/arrayfire\">online scheduler</a>.\r\n<h5>Get a GTC 2015 20% Discount</h5>\r\nWe have 20% discount coupons available for GTC registrations. If you\'re interested, please contact sales@arrayfire.com for more information.\r\n\r\nWe look forward to seeing everyone at GTC!','Visit ArrayFire at GTC 2015','','publish','open','open','','visit-arrayfire-at-gtc-2015','','','2015-03-02 21:24:29','2015-03-02 21:24:29','',0,'http://sandbox.arrayfire.com/?p=8000',0,'post','',2),(8001,7,'2015-03-02 21:21:50','2015-03-02 21:21:50','<img class=\"aligncenter size-full wp-image-8002\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/03/GTC-15-Header.png\" alt=\"GTC 15 Header\" width=\"974\" height=\"330\" />\r\n\r\nGTC is quickly approaching and we want to see you there!\r\n\r\n<strong>When: March 17-20</strong>\r\n<strong>Where: San Jose, California</strong>\r\n<strong>ArrayFire Booth: 713</strong>\r\n\r\nGTC is the world\'s premier GPU developer conference. Connect with experts from NVIDIA and other leaders in high performance computing. At GTC you\'ll discover what\'s next in GPU breakthroughs, and gain useful insights in over 500 sessions and hands-on labs covering a diverse range of application domains.\r\n\r\nArrayFire will be out in full force at GTC, and we invite you to join us at our CUDA tutorials, hands-on lab, and talks presented by our knowledgeable and experienced GPU developers. Visit the <a href=\"https://registration.gputechconf.com/form/session-listing\">GTC Session Catalog</a> for more details—you don\'t want to miss out!\r\n<h3>ArrayFire Tutorials at GTC</h3>\r\n<h5>S5797 - Introduction to GPU Computing Using the ArrayFire Acceleration Library</h5>\r\n<h6>Presented by Umar Arshad - Tuesday March 17 at 1:00 PM</h6>\r\nNew to GPU computing and don\'t know where to start? Are you an expert in GPU computing and tired of writing your kernels from scratch? If that is the case, this tutorial is perfect for you! In this tutorial we will introduce you to a simple and intuitive API that will make GPU computing highly productive and stress free. Last November, the ArrayFire library was open-source and made available to the general public. In this talk we will walk you through the installation process, introduce the ArrayFire API, and show several applications that have been developed using the API.\r\n<h5>S5796 - Image Learning and Computer Vision in CUDA</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nAnalyzing a massive data set? Need fast results? Need computer vision algorithms? Not sure when and where to start? The answer is here and now! In this tutorial we will give you the tools to bring your favorite computer vision algorithm to life. In this tutorial we will go over key challenges for implementing computer vision and machine learning algorithms on the GPU. We will walk you through several computer vision algorithms for the GPU (ORB, Fast, SIFT) and give you the hands experience to implement you own algorithms.\r\n<h5>S5803 - Simplified Machine Learning Programming for CUDA</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 9:30 AM</h6>\r\nLooking for a simplified way to program machine learning algorithms? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated machine learning algorithms.\r\n<h5>S5804 - Application Development for Mobile Devices: A Case Study for the Tegra K1</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 2:00 PM</h6>\r\nEmbedded systems are ubiquitous in today\'s world. The Tegra K1 is a front-runner for low-power efficient high performance embedded systems. In this tutorial we will share with you our experience in developing applications for the Tegra K1. We will show how the ArrayFire library and its simple API can be used to deploy stable applications for the Tegra K1 in a quick manner. Specifically, we will cover the zero-copy capabilities of CUDA and show how ArrayFire leverages that capability to efficiently run a very large number of algorithms in real-time. Using ArrayFire\'s graphic package it is easy to create stunning visuals using Tegra\'s OpenGL 4.4 capability, this too will be discussed in today\'s tutorial.\r\n<h3>ArrayFire Hands-on Lab at GTC:</h3>\r\n<h5>S5722 - Hands-on Lab: Deep Belief Networks Using ArrayFire</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 3:30 PM</h6>\r\nWorking on image processing, computer vision, or machine learning? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Deep Belief Networks are a specialized neural network that can be efficiently optimized on the GPU. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated image processing and machine learning. As we\'ll be using GPUs hosted in the cloud, all you are required to bring is a laptop with a modern browser.\r\n<h3>ArrayFire Talks at GTC:</h3>\r\n<h5>S5205 - Real-Time and High Resolution Feature Tracking and Object Recognition</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nThis session will cover real-time feature tracking and object recognition in high resolution videos using GPUs and productive software libraries including ArrayFire. Feature tracking and object recognition are computer vision problems that have challenged researchers for decades. Over the last 15 years, numerous approaches were proposed to solve these problems, some of the most important being SIFT, SURF and ORB. Traditionally, these approaches are so computationally complex that processing more than a few frames per second is impossible. Using an NVIDIA K20 GPU with ORB, we are able to process about 30 frames per second on images in the order of Ultra HD resolution. Multiple quality and timing benchmarks will be presented, covering some of the most robust feature tracking methods.\r\n<h5>S5176 - Fast Triangle Counting for Social Network Analytics on the K40</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 4:30 PM</h6>\r\nIn this session we will explore a new approach for counting triangles in networks that partitions the work at multiple parallel granularties. This new approach is highly scalable and is appropriate for both sparse and dense networks.\r\n\r\n<hr />\r\n\r\n<h5>Schedule a Meeting with Us</h5>\r\nDo you want to meet with us personally? Schedule a time to sit down with ArrayFire engineers and account representatives using our <a href=\"http://www.meetme.so/arrayfire\">online scheduler</a>.\r\n<h5>Get a GTC 2015 20% Discount</h5>\r\nWe have 20% discount coupons available for GTC registrations. If you\'re interested, please contact sales@arrayfire.com for more information.\r\n\r\nWe look forward to seeing everyone at GTC!','Visit ArrayFire at GTC 2015','','inherit','open','open','','8000-autosave-v1','','','2015-03-02 21:21:50','2015-03-02 21:21:50','',8000,'http://sandbox.arrayfire.com/8000-autosave-v1/',0,'revision','',0),(8002,7,'2015-03-02 21:02:31','2015-03-02 21:02:31','','GTC 15 Header','','inherit','open','open','','gtc-15-header','','','2015-03-02 21:02:31','2015-03-02 21:02:31','',8000,'http://sandbox.arrayfire.com/wp-content/uploads/2015/03/GTC-15-Header.png',0,'attachment','image/png',0),(8003,7,'2015-03-02 21:16:44','2015-03-02 21:16:44','<img class=\"aligncenter size-full wp-image-8002\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/03/GTC-15-Header.png\" alt=\"GTC 15 Header\" width=\"974\" height=\"330\" />\r\n\r\nGTC is quickly approaching and we want to see you there!\r\n\r\n<strong>When: March 17-20</strong>\r\n<strong>Where: San Jose, California</strong>\r\n<strong>ArrayFire Booth: 713</strong>\r\n\r\nGTC is the world\'s premier GPU developer conference. Connect with experts from NVIDIA and other leaders in high performance computing. At GTC you\'ll discover what\'s next in GPU breakthroughs, and gain useful insights in over 500 sessions and hands-on labs covering a diverse range of application domains.\r\n\r\nArrayFire will be out in full force at GTC, and we invite you to join us at our CUDA tutorials, hands-on lab, and talks presented by our knowledgeable and experienced GPU developers. Visit the <a href=\"https://registration.gputechconf.com/form/session-listing\">GTC Session Catalog</a> to register—you don\'t want to miss out!\r\n<h3>ArrayFire Tutorials at GTC</h3>\r\n<h5>S5797 - Introduction to GPU Computing Using the ArrayFire Acceleration Library</h5>\r\n<h6>Presented by Umar Arshad - Tuesday March 17 at 1:00 PM</h6>\r\nNew to GPU computing and don\'t know where to start? Are you an expert in GPU computing and tired of writing your kernels from scratch? If that is the case, this tutorial is perfect for you! In this tutorial we will introduce you to a simple and intuitive API that will make GPU computing highly productive and stress free. Last November, the ArrayFire library was open-source and made available to the general public. In this talk we will walk you through the installation process, introduce the ArrayFire API, and show several applications that have been developed using the API.\r\n<h5>S5796 - Image Learning and Computer Vision in CUDA</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nAnalyzing a massive data set? Need fast results? Need computer vision algorithms? Not sure when and where to start? The answer is here and now! In this tutorial we will give you the tools to bring your favorite computer vision algorithm to life. In this tutorial we will go over key challenges for implementing computer vision and machine learning algorithms on the GPU. We will walk you through several computer vision algorithms for the GPU (ORB, Fast, SIFT) and give you the hands experience to implement you own algorithms.\r\n<h5>S5803 - Simplified Machine Learning Programming for CUDA</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 9:30 AM</h6>\r\nLooking for a simplified way to program machine learning algorithms? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated machine learning algorithms.\r\n<h5>S5804 - Application Development for Mobile Devices: A Case Study for the Tegra K1</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 2:00 PM</h6>\r\nEmbedded systems are ubiquitous in today\'s world. The Tegra K1 is a front-runner for low-power efficient high performance embedded systems. In this tutorial we will share with you our experience in developing applications for the Tegra K1. We will show how the ArrayFire library and its simple API can be used to deploy stable applications for the Tegra K1 in a quick manner. Specifically, we will cover the zero-copy capabilities of CUDA and show how ArrayFire leverages that capability to efficiently run a very large number of algorithms in real-time. Using ArrayFire\'s graphic package it is easy to create stunning visuals using Tegra\'s OpenGL 4.4 capability, this too will be discussed in today\'s tutorial.\r\n<h3>ArrayFire Hands-on Lab at GTC:</h3>\r\n<h5>S5722 - Hands-on Lab: Deep Belief Networks Using ArrayFire</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 3:30 PM</h6>\r\nWorking on image processing, computer vision, or machine learning? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Deep Belief Networks are a specialized neural network that can be efficiently optimized on the GPU. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated image processing and machine learning. As we\'ll be using GPUs hosted in the cloud, all you are required to bring is a laptop with a modern browser.\r\n<h3>ArrayFire Talks at GTC:</h3>\r\n<h5>S5205 - Real-Time and High Resolution Feature Tracking and Object Recognition</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nThis session will cover real-time feature tracking and object recognition in high resolution videos using GPUs and productive software libraries including ArrayFire. Feature tracking and object recognition are computer vision problems that have challenged researchers for decades. Over the last 15 years, numerous approaches were proposed to solve these problems, some of the most important being SIFT, SURF and ORB. Traditionally, these approaches are so computationally complex that processing more than a few frames per second is impossible. Using an NVIDIA K20 GPU with ORB, we are able to process about 30 frames per second on images in the order of Ultra HD resolution. Multiple quality and timing benchmarks will be presented, covering some of the most robust feature tracking methods.\r\n<h5>S5176 - Fast Triangle Counting for Social Network Analytics on the K40</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 4:30 PM</h6>\r\nIn this session we will explore a new approach for counting triangles in networks that partitions the work at multiple parallel granularties. This new approach is highly scalable and is appropriate for both sparse and dense networks.\r\n\r\n&nbsp;\r\n\r\n<hr />\r\n\r\n&nbsp;\r\n<h5>Schedule a Meeting with Us</h5>\r\nDo you want to meet with us personally? Schedule a time to sit down with ArrayFire engineers and account representatives using our <a href=\"http://www.meetme.so/arrayfire\">online scheduler</a>.\r\n<h5>Get a GTC 2015 20% Discount</h5>\r\nWe have 20% discount coupons available for GTC registrations. If you\'re interested, please contact sales@arrayfire.com for more information.\r\n\r\nWe look forward to seeing everyone at GTC!','Visit ArrayFire at the GPU Technology Conference','','inherit','open','open','','8000-revision-v1','','','2015-03-02 21:16:44','2015-03-02 21:16:44','',8000,'http://sandbox.arrayfire.com/8000-revision-v1/',0,'revision','',0),(8004,7,'2015-03-02 21:18:00','2015-03-02 21:18:00','<img class=\"aligncenter size-full wp-image-8002\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/03/GTC-15-Header.png\" alt=\"GTC 15 Header\" width=\"974\" height=\"330\" />\r\n\r\nGTC is quickly approaching and we want to see you there!\r\n\r\n<strong>When: March 17-20</strong>\r\n<strong>Where: San Jose, California</strong>\r\n<strong>ArrayFire Booth: 713</strong>\r\n\r\nGTC is the world\'s premier GPU developer conference. Connect with experts from NVIDIA and other leaders in high performance computing. At GTC you\'ll discover what\'s next in GPU breakthroughs, and gain useful insights in over 500 sessions and hands-on labs covering a diverse range of application domains.\r\n\r\nArrayFire will be out in full force at GTC, and we invite you to join us at our CUDA tutorials, hands-on lab, and talks presented by our knowledgeable and experienced GPU developers. Visit the <a href=\"https://registration.gputechconf.com/form/session-listing\">GTC Session Catalog</a> to register—you don\'t want to miss out!\r\n<h3>ArrayFire Tutorials at GTC</h3>\r\n<h5>S5797 - Introduction to GPU Computing Using the ArrayFire Acceleration Library</h5>\r\n<h6>Presented by Umar Arshad - Tuesday March 17 at 1:00 PM</h6>\r\nNew to GPU computing and don\'t know where to start? Are you an expert in GPU computing and tired of writing your kernels from scratch? If that is the case, this tutorial is perfect for you! In this tutorial we will introduce you to a simple and intuitive API that will make GPU computing highly productive and stress free. Last November, the ArrayFire library was open-source and made available to the general public. In this talk we will walk you through the installation process, introduce the ArrayFire API, and show several applications that have been developed using the API.\r\n<h5>S5796 - Image Learning and Computer Vision in CUDA</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nAnalyzing a massive data set? Need fast results? Need computer vision algorithms? Not sure when and where to start? The answer is here and now! In this tutorial we will give you the tools to bring your favorite computer vision algorithm to life. In this tutorial we will go over key challenges for implementing computer vision and machine learning algorithms on the GPU. We will walk you through several computer vision algorithms for the GPU (ORB, Fast, SIFT) and give you the hands experience to implement you own algorithms.\r\n<h5>S5803 - Simplified Machine Learning Programming for CUDA</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 9:30 AM</h6>\r\nLooking for a simplified way to program machine learning algorithms? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated machine learning algorithms.\r\n<h5>S5804 - Application Development for Mobile Devices: A Case Study for the Tegra K1</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 2:00 PM</h6>\r\nEmbedded systems are ubiquitous in today\'s world. The Tegra K1 is a front-runner for low-power efficient high performance embedded systems. In this tutorial we will share with you our experience in developing applications for the Tegra K1. We will show how the ArrayFire library and its simple API can be used to deploy stable applications for the Tegra K1 in a quick manner. Specifically, we will cover the zero-copy capabilities of CUDA and show how ArrayFire leverages that capability to efficiently run a very large number of algorithms in real-time. Using ArrayFire\'s graphic package it is easy to create stunning visuals using Tegra\'s OpenGL 4.4 capability, this too will be discussed in today\'s tutorial.\r\n<h3>ArrayFire Hands-on Lab at GTC:</h3>\r\n<h5>S5722 - Hands-on Lab: Deep Belief Networks Using ArrayFire</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 3:30 PM</h6>\r\nWorking on image processing, computer vision, or machine learning? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Deep Belief Networks are a specialized neural network that can be efficiently optimized on the GPU. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated image processing and machine learning. As we\'ll be using GPUs hosted in the cloud, all you are required to bring is a laptop with a modern browser.\r\n<h3>ArrayFire Talks at GTC:</h3>\r\n<h5>S5205 - Real-Time and High Resolution Feature Tracking and Object Recognition</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nThis session will cover real-time feature tracking and object recognition in high resolution videos using GPUs and productive software libraries including ArrayFire. Feature tracking and object recognition are computer vision problems that have challenged researchers for decades. Over the last 15 years, numerous approaches were proposed to solve these problems, some of the most important being SIFT, SURF and ORB. Traditionally, these approaches are so computationally complex that processing more than a few frames per second is impossible. Using an NVIDIA K20 GPU with ORB, we are able to process about 30 frames per second on images in the order of Ultra HD resolution. Multiple quality and timing benchmarks will be presented, covering some of the most robust feature tracking methods.\r\n<h5>S5176 - Fast Triangle Counting for Social Network Analytics on the K40</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 4:30 PM</h6>\r\nIn this session we will explore a new approach for counting triangles in networks that partitions the work at multiple parallel granularties. This new approach is highly scalable and is appropriate for both sparse and dense networks.\r\n\r\n&nbsp;\r\n\r\n<hr />\r\n\r\n&nbsp;\r\n<h5>Schedule a Meeting with Us</h5>\r\nDo you want to meet with us personally? Schedule a time to sit down with ArrayFire engineers and account representatives using our <a href=\"http://www.meetme.so/arrayfire\">online scheduler</a>.\r\n<h5>Get a GTC 2015 20% Discount</h5>\r\nWe have 20% discount coupons available for GTC registrations. If you\'re interested, please contact sales@arrayfire.com for more information.\r\n\r\nWe look forward to seeing everyone at GTC!','Visit ArrayFire at GTC 2015','','inherit','open','open','','8000-revision-v1','','','2015-03-02 21:18:00','2015-03-02 21:18:00','',8000,'http://sandbox.arrayfire.com/8000-revision-v1/',0,'revision','',0),(8005,7,'2015-03-02 21:19:53','2015-03-02 21:19:53','<img class=\"aligncenter size-full wp-image-8002\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/03/GTC-15-Header.png\" alt=\"GTC 15 Header\" width=\"974\" height=\"330\" />\r\n\r\nGTC is quickly approaching and we want to see you there!\r\n\r\n<strong>When: March 17-20</strong>\r\n<strong>Where: San Jose, California</strong>\r\n<strong>ArrayFire Booth: 713</strong>\r\n\r\nGTC is the world\'s premier GPU developer conference. Connect with experts from NVIDIA and other leaders in high performance computing. At GTC you\'ll discover what\'s next in GPU breakthroughs, and gain useful insights in over 500 sessions and hands-on labs covering a diverse range of application domains.\r\n\r\nArrayFire will be out in full force at GTC, and we invite you to join us at our CUDA tutorials, hands-on lab, and talks presented by our knowledgeable and experienced GPU developers. Visit the <a href=\"https://registration.gputechconf.com/form/session-listing\">GTC Session Catalog</a> for more details—you don\'t want to miss out!\r\n<h3>ArrayFire Tutorials at GTC</h3>\r\n<h5>S5797 - Introduction to GPU Computing Using the ArrayFire Acceleration Library</h5>\r\n<h6>Presented by Umar Arshad - Tuesday March 17 at 1:00 PM</h6>\r\nNew to GPU computing and don\'t know where to start? Are you an expert in GPU computing and tired of writing your kernels from scratch? If that is the case, this tutorial is perfect for you! In this tutorial we will introduce you to a simple and intuitive API that will make GPU computing highly productive and stress free. Last November, the ArrayFire library was open-source and made available to the general public. In this talk we will walk you through the installation process, introduce the ArrayFire API, and show several applications that have been developed using the API.\r\n<h5>S5796 - Image Learning and Computer Vision in CUDA</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nAnalyzing a massive data set? Need fast results? Need computer vision algorithms? Not sure when and where to start? The answer is here and now! In this tutorial we will give you the tools to bring your favorite computer vision algorithm to life. In this tutorial we will go over key challenges for implementing computer vision and machine learning algorithms on the GPU. We will walk you through several computer vision algorithms for the GPU (ORB, Fast, SIFT) and give you the hands experience to implement you own algorithms.\r\n<h5>S5803 - Simplified Machine Learning Programming for CUDA</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 9:30 AM</h6>\r\nLooking for a simplified way to program machine learning algorithms? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated machine learning algorithms.\r\n<h5>S5804 - Application Development for Mobile Devices: A Case Study for the Tegra K1</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 2:00 PM</h6>\r\nEmbedded systems are ubiquitous in today\'s world. The Tegra K1 is a front-runner for low-power efficient high performance embedded systems. In this tutorial we will share with you our experience in developing applications for the Tegra K1. We will show how the ArrayFire library and its simple API can be used to deploy stable applications for the Tegra K1 in a quick manner. Specifically, we will cover the zero-copy capabilities of CUDA and show how ArrayFire leverages that capability to efficiently run a very large number of algorithms in real-time. Using ArrayFire\'s graphic package it is easy to create stunning visuals using Tegra\'s OpenGL 4.4 capability, this too will be discussed in today\'s tutorial.\r\n<h3>ArrayFire Hands-on Lab at GTC:</h3>\r\n<h5>S5722 - Hands-on Lab: Deep Belief Networks Using ArrayFire</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 3:30 PM</h6>\r\nWorking on image processing, computer vision, or machine learning? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Deep Belief Networks are a specialized neural network that can be efficiently optimized on the GPU. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated image processing and machine learning. As we\'ll be using GPUs hosted in the cloud, all you are required to bring is a laptop with a modern browser.\r\n<h3>ArrayFire Talks at GTC:</h3>\r\n<h5>S5205 - Real-Time and High Resolution Feature Tracking and Object Recognition</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nThis session will cover real-time feature tracking and object recognition in high resolution videos using GPUs and productive software libraries including ArrayFire. Feature tracking and object recognition are computer vision problems that have challenged researchers for decades. Over the last 15 years, numerous approaches were proposed to solve these problems, some of the most important being SIFT, SURF and ORB. Traditionally, these approaches are so computationally complex that processing more than a few frames per second is impossible. Using an NVIDIA K20 GPU with ORB, we are able to process about 30 frames per second on images in the order of Ultra HD resolution. Multiple quality and timing benchmarks will be presented, covering some of the most robust feature tracking methods.\r\n<h5>S5176 - Fast Triangle Counting for Social Network Analytics on the K40</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 4:30 PM</h6>\r\nIn this session we will explore a new approach for counting triangles in networks that partitions the work at multiple parallel granularties. This new approach is highly scalable and is appropriate for both sparse and dense networks.\r\n\r\n&nbsp;\r\n\r\n<hr />\r\n\r\n&nbsp;\r\n<h5>Schedule a Meeting with Us</h5>\r\nDo you want to meet with us personally? Schedule a time to sit down with ArrayFire engineers and account representatives using our <a href=\"http://www.meetme.so/arrayfire\">online scheduler</a>.\r\n<h5>Get a GTC 2015 20% Discount</h5>\r\nWe have 20% discount coupons available for GTC registrations. If you\'re interested, please contact sales@arrayfire.com for more information.\r\n\r\nWe look forward to seeing everyone at GTC!','Visit ArrayFire at GTC 2015','','inherit','open','open','','8000-revision-v1','','','2015-03-02 21:19:53','2015-03-02 21:19:53','',8000,'http://sandbox.arrayfire.com/8000-revision-v1/',0,'revision','',0),(8006,7,'2015-03-02 21:20:55','2015-03-02 21:20:55','<img class=\"aligncenter size-full wp-image-8002\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/03/GTC-15-Header.png\" alt=\"GTC 15 Header\" width=\"974\" height=\"330\" />\r\n\r\nGTC is quickly approaching and we want to see you there!\r\n\r\n<strong>When: March 17-20</strong>\r\n<strong>Where: San Jose, California</strong>\r\n<strong>ArrayFire Booth: 713</strong>\r\n\r\nGTC is the world\'s premier GPU developer conference. Connect with experts from NVIDIA and other leaders in high performance computing. At GTC you\'ll discover what\'s next in GPU breakthroughs, and gain useful insights in over 500 sessions and hands-on labs covering a diverse range of application domains.\r\n\r\nArrayFire will be out in full force at GTC, and we invite you to join us at our CUDA tutorials, hands-on lab, and talks presented by our knowledgeable and experienced GPU developers. Visit the <a href=\"https://registration.gputechconf.com/form/session-listing\">GTC Session Catalog</a> for more details—you don\'t want to miss out!\r\n<h3>ArrayFire Tutorials at GTC</h3>\r\n<h5>S5797 - Introduction to GPU Computing Using the ArrayFire Acceleration Library</h5>\r\n<h6>Presented by Umar Arshad - Tuesday March 17 at 1:00 PM</h6>\r\nNew to GPU computing and don\'t know where to start? Are you an expert in GPU computing and tired of writing your kernels from scratch? If that is the case, this tutorial is perfect for you! In this tutorial we will introduce you to a simple and intuitive API that will make GPU computing highly productive and stress free. Last November, the ArrayFire library was open-source and made available to the general public. In this talk we will walk you through the installation process, introduce the ArrayFire API, and show several applications that have been developed using the API.\r\n<h5>S5796 - Image Learning and Computer Vision in CUDA</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nAnalyzing a massive data set? Need fast results? Need computer vision algorithms? Not sure when and where to start? The answer is here and now! In this tutorial we will give you the tools to bring your favorite computer vision algorithm to life. In this tutorial we will go over key challenges for implementing computer vision and machine learning algorithms on the GPU. We will walk you through several computer vision algorithms for the GPU (ORB, Fast, SIFT) and give you the hands experience to implement you own algorithms.\r\n<h5>S5803 - Simplified Machine Learning Programming for CUDA</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 9:30 AM</h6>\r\nLooking for a simplified way to program machine learning algorithms? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated machine learning algorithms.\r\n<h5>S5804 - Application Development for Mobile Devices: A Case Study for the Tegra K1</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 2:00 PM</h6>\r\nEmbedded systems are ubiquitous in today\'s world. The Tegra K1 is a front-runner for low-power efficient high performance embedded systems. In this tutorial we will share with you our experience in developing applications for the Tegra K1. We will show how the ArrayFire library and its simple API can be used to deploy stable applications for the Tegra K1 in a quick manner. Specifically, we will cover the zero-copy capabilities of CUDA and show how ArrayFire leverages that capability to efficiently run a very large number of algorithms in real-time. Using ArrayFire\'s graphic package it is easy to create stunning visuals using Tegra\'s OpenGL 4.4 capability, this too will be discussed in today\'s tutorial.\r\n<h3>ArrayFire Hands-on Lab at GTC:</h3>\r\n<h5>S5722 - Hands-on Lab: Deep Belief Networks Using ArrayFire</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 3:30 PM</h6>\r\nWorking on image processing, computer vision, or machine learning? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Deep Belief Networks are a specialized neural network that can be efficiently optimized on the GPU. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated image processing and machine learning. As we\'ll be using GPUs hosted in the cloud, all you are required to bring is a laptop with a modern browser.\r\n<h3>ArrayFire Talks at GTC:</h3>\r\n<h5>S5205 - Real-Time and High Resolution Feature Tracking and Object Recognition</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nThis session will cover real-time feature tracking and object recognition in high resolution videos using GPUs and productive software libraries including ArrayFire. Feature tracking and object recognition are computer vision problems that have challenged researchers for decades. Over the last 15 years, numerous approaches were proposed to solve these problems, some of the most important being SIFT, SURF and ORB. Traditionally, these approaches are so computationally complex that processing more than a few frames per second is impossible. Using an NVIDIA K20 GPU with ORB, we are able to process about 30 frames per second on images in the order of Ultra HD resolution. Multiple quality and timing benchmarks will be presented, covering some of the most robust feature tracking methods.\r\n<h5>S5176 - Fast Triangle Counting for Social Network Analytics on the K40</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 4:30 PM</h6>\r\nIn this session we will explore a new approach for counting triangles in networks that partitions the work at multiple parallel granularties. This new approach is highly scalable and is appropriate for both sparse and dense networks.\r\n\r\n<hr />\r\n\r\n<h5> Schedule a Meeting with Us</h5>\r\nDo you want to meet with us personally? Schedule a time to sit down with ArrayFire engineers and account representatives using our <a href=\"http://www.meetme.so/arrayfire\">online scheduler</a>.\r\n<h5>Get a GTC 2015 20% Discount</h5>\r\nWe have 20% discount coupons available for GTC registrations. If you\'re interested, please contact sales@arrayfire.com for more information.\r\n\r\nWe look forward to seeing everyone at GTC!','Visit ArrayFire at GTC 2015','','inherit','open','open','','8000-revision-v1','','','2015-03-02 21:20:55','2015-03-02 21:20:55','',8000,'http://sandbox.arrayfire.com/8000-revision-v1/',0,'revision','',0),(8007,7,'2015-03-02 21:21:44','2015-03-02 21:21:44','<img class=\"aligncenter size-full wp-image-8002\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/03/GTC-15-Header.png\" alt=\"GTC 15 Header\" width=\"974\" height=\"330\" />\r\n\r\nGTC is quickly approaching and we want to see you there!\r\n\r\n<strong>When: March 17-20</strong>\r\n<strong>Where: San Jose, California</strong>\r\n<strong>ArrayFire Booth: 713</strong>\r\n\r\nGTC is the world\'s premier GPU developer conference. Connect with experts from NVIDIA and other leaders in high performance computing. At GTC you\'ll discover what\'s next in GPU breakthroughs, and gain useful insights in over 500 sessions and hands-on labs covering a diverse range of application domains.\r\n\r\nArrayFire will be out in full force at GTC, and we invite you to join us at our CUDA tutorials, hands-on lab, and talks presented by our knowledgeable and experienced GPU developers. Visit the <a href=\"https://registration.gputechconf.com/form/session-listing\">GTC Session Catalog</a> for more details—you don\'t want to miss out!\r\n<h3>ArrayFire Tutorials at GTC</h3>\r\n<h5>S5797 - Introduction to GPU Computing Using the ArrayFire Acceleration Library</h5>\r\n<h6>Presented by Umar Arshad - Tuesday March 17 at 1:00 PM</h6>\r\nNew to GPU computing and don\'t know where to start? Are you an expert in GPU computing and tired of writing your kernels from scratch? If that is the case, this tutorial is perfect for you! In this tutorial we will introduce you to a simple and intuitive API that will make GPU computing highly productive and stress free. Last November, the ArrayFire library was open-source and made available to the general public. In this talk we will walk you through the installation process, introduce the ArrayFire API, and show several applications that have been developed using the API.\r\n<h5>S5796 - Image Learning and Computer Vision in CUDA</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nAnalyzing a massive data set? Need fast results? Need computer vision algorithms? Not sure when and where to start? The answer is here and now! In this tutorial we will give you the tools to bring your favorite computer vision algorithm to life. In this tutorial we will go over key challenges for implementing computer vision and machine learning algorithms on the GPU. We will walk you through several computer vision algorithms for the GPU (ORB, Fast, SIFT) and give you the hands experience to implement you own algorithms.\r\n<h5>S5803 - Simplified Machine Learning Programming for CUDA</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 9:30 AM</h6>\r\nLooking for a simplified way to program machine learning algorithms? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated machine learning algorithms.\r\n<h5>S5804 - Application Development for Mobile Devices: A Case Study for the Tegra K1</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 2:00 PM</h6>\r\nEmbedded systems are ubiquitous in today\'s world. The Tegra K1 is a front-runner for low-power efficient high performance embedded systems. In this tutorial we will share with you our experience in developing applications for the Tegra K1. We will show how the ArrayFire library and its simple API can be used to deploy stable applications for the Tegra K1 in a quick manner. Specifically, we will cover the zero-copy capabilities of CUDA and show how ArrayFire leverages that capability to efficiently run a very large number of algorithms in real-time. Using ArrayFire\'s graphic package it is easy to create stunning visuals using Tegra\'s OpenGL 4.4 capability, this too will be discussed in today\'s tutorial.\r\n<h3>ArrayFire Hands-on Lab at GTC:</h3>\r\n<h5>S5722 - Hands-on Lab: Deep Belief Networks Using ArrayFire</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 3:30 PM</h6>\r\nWorking on image processing, computer vision, or machine learning? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Deep Belief Networks are a specialized neural network that can be efficiently optimized on the GPU. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated image processing and machine learning. As we\'ll be using GPUs hosted in the cloud, all you are required to bring is a laptop with a modern browser.\r\n<h3>ArrayFire Talks at GTC:</h3>\r\n<h5>S5205 - Real-Time and High Resolution Feature Tracking and Object Recognition</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nThis session will cover real-time feature tracking and object recognition in high resolution videos using GPUs and productive software libraries including ArrayFire. Feature tracking and object recognition are computer vision problems that have challenged researchers for decades. Over the last 15 years, numerous approaches were proposed to solve these problems, some of the most important being SIFT, SURF and ORB. Traditionally, these approaches are so computationally complex that processing more than a few frames per second is impossible. Using an NVIDIA K20 GPU with ORB, we are able to process about 30 frames per second on images in the order of Ultra HD resolution. Multiple quality and timing benchmarks will be presented, covering some of the most robust feature tracking methods.\r\n<h5>S5176 - Fast Triangle Counting for Social Network Analytics on the K40</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 4:30 PM</h6>\r\nIn this session we will explore a new approach for counting triangles in networks that partitions the work at multiple parallel granularties. This new approach is highly scalable and is appropriate for both sparse and dense networks.\r\n\r\n<hr />\r\n\r\n<h5>Schedule a Meeting with Us</h5>\r\nDo you want to meet with us personally? Schedule a time to sit down with ArrayFire engineers and account representatives using our <a href=\"http://www.meetme.so/arrayfire\">online scheduler</a>.\r\n<h5>Get a GTC 2015 20% Discount</h5>\r\nWe have 20% discount coupons available for GTC registrations. If you\'re interested, please contact sales@arrayfire.com for more information.\r\n\r\nWe look forward to seeing everyone at GTC!','Visit ArrayFire at GTC 2015','','inherit','open','open','','8000-revision-v1','','','2015-03-02 21:21:44','2015-03-02 21:21:44','',8000,'http://sandbox.arrayfire.com/8000-revision-v1/',0,'revision','',0),(8008,7,'2015-03-02 21:22:38','2015-03-02 21:22:38','<img class=\"aligncenter size-full wp-image-8002\" src=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/03/GTC-15-Header.png\" alt=\"GTC 15 Header\" width=\"974\" height=\"330\" />\r\n\r\nGTC is quickly approaching and we want to see you there!\r\n\r\n<strong>When: March 17-20</strong>\r\n<strong>Where: San Jose, California</strong>\r\n<strong>ArrayFire Booth: 713</strong>\r\n\r\nGTC is the world\'s premier GPU developer conference. Connect with experts from NVIDIA and other leaders in high performance computing. At GTC you\'ll discover what\'s next in GPU breakthroughs, and gain useful insights in over 500 sessions and hands-on labs covering a diverse range of application domains.\r\n\r\nArrayFire will be out in full force at GTC, and we invite you to join us at our CUDA tutorials, hands-on lab, and talks presented by our knowledgeable and experienced GPU developers. Visit the <a href=\"https://registration.gputechconf.com/form/session-listing\">GTC Session Catalog</a> for more details—you don\'t want to miss out!\r\n<h3>ArrayFire Tutorials at GTC</h3>\r\n<h5>S5797 - Introduction to GPU Computing Using the ArrayFire Acceleration Library</h5>\r\n<h6>Presented by Umar Arshad - Tuesday March 17 at 1:00 PM</h6>\r\nNew to GPU computing and don\'t know where to start? Are you an expert in GPU computing and tired of writing your kernels from scratch? If that is the case, this tutorial is perfect for you! In this tutorial we will introduce you to a simple and intuitive API that will make GPU computing highly productive and stress free. Last November, the ArrayFire library was open-source and made available to the general public. In this talk we will walk you through the installation process, introduce the ArrayFire API, and show several applications that have been developed using the API.\r\n<h5>S5796 - Image Learning and Computer Vision in CUDA</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nAnalyzing a massive data set? Need fast results? Need computer vision algorithms? Not sure when and where to start? The answer is here and now! In this tutorial we will give you the tools to bring your favorite computer vision algorithm to life. In this tutorial we will go over key challenges for implementing computer vision and machine learning algorithms on the GPU. We will walk you through several computer vision algorithms for the GPU (ORB, Fast, SIFT) and give you the hands experience to implement you own algorithms.\r\n<h5>S5803 - Simplified Machine Learning Programming for CUDA</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 9:30 AM</h6>\r\nLooking for a simplified way to program machine learning algorithms? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated machine learning algorithms.\r\n<h5>S5804 - Application Development for Mobile Devices: A Case Study for the Tegra K1</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 2:00 PM</h6>\r\nEmbedded systems are ubiquitous in today\'s world. The Tegra K1 is a front-runner for low-power efficient high performance embedded systems. In this tutorial we will share with you our experience in developing applications for the Tegra K1. We will show how the ArrayFire library and its simple API can be used to deploy stable applications for the Tegra K1 in a quick manner. Specifically, we will cover the zero-copy capabilities of CUDA and show how ArrayFire leverages that capability to efficiently run a very large number of algorithms in real-time. Using ArrayFire\'s graphic package it is easy to create stunning visuals using Tegra\'s OpenGL 4.4 capability, this too will be discussed in today\'s tutorial.\r\n<h3>ArrayFire Hands-on Lab at GTC</h3>\r\n<h5>S5722 - Hands-on Lab: Deep Belief Networks Using ArrayFire</h5>\r\n<h6>Presented by Umar Arshad - Wednesday March 18 at 3:30 PM</h6>\r\nWorking on image processing, computer vision, or machine learning? This tutorial will give you hands on experience implementing Deep Belief Networks using ArrayFire and other CUDA tools. Deep Belief Networks are a specialized neural network that can be efficiently optimized on the GPU. Learn the best practices for implementing parallel versions of popular algorithms on GPUs. Instead of reinventing the wheel, you will learn where to find and how to use excellent versions of these algorithms already available in CUDA and ArrayFire libraries. You will walk away equipped with the best tools and knowledge for implementing accelerated image processing and machine learning. As we\'ll be using GPUs hosted in the cloud, all you are required to bring is a laptop with a modern browser.\r\n<h3>ArrayFire Talks at GTC</h3>\r\n<h5>S5205 - Real-Time and High Resolution Feature Tracking and Object Recognition</h5>\r\n<h6>Presented by Peter Andreas Entschev - Tuesday March 17 at 3:00 PM</h6>\r\nThis session will cover real-time feature tracking and object recognition in high resolution videos using GPUs and productive software libraries including ArrayFire. Feature tracking and object recognition are computer vision problems that have challenged researchers for decades. Over the last 15 years, numerous approaches were proposed to solve these problems, some of the most important being SIFT, SURF and ORB. Traditionally, these approaches are so computationally complex that processing more than a few frames per second is impossible. Using an NVIDIA K20 GPU with ORB, we are able to process about 30 frames per second on images in the order of Ultra HD resolution. Multiple quality and timing benchmarks will be presented, covering some of the most robust feature tracking methods.\r\n<h5>S5176 - Fast Triangle Counting for Social Network Analytics on the K40</h5>\r\n<h6>Presented by Oded Green - Wednesday March 18 at 4:30 PM</h6>\r\nIn this session we will explore a new approach for counting triangles in networks that partitions the work at multiple parallel granularties. This new approach is highly scalable and is appropriate for both sparse and dense networks.\r\n\r\n<hr />\r\n\r\n<h5>Schedule a Meeting with Us</h5>\r\nDo you want to meet with us personally? Schedule a time to sit down with ArrayFire engineers and account representatives using our <a href=\"http://www.meetme.so/arrayfire\">online scheduler</a>.\r\n<h5>Get a GTC 2015 20% Discount</h5>\r\nWe have 20% discount coupons available for GTC registrations. If you\'re interested, please contact sales@arrayfire.com for more information.\r\n\r\nWe look forward to seeing everyone at GTC!','Visit ArrayFire at GTC 2015','','inherit','open','open','','8000-revision-v1','','','2015-03-02 21:22:38','2015-03-02 21:22:38','',8000,'http://sandbox.arrayfire.com/8000-revision-v1/',0,'revision','',0),(8009,7,'2015-03-02 21:49:00','2015-03-02 21:49:00','[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"40px\" padding_bottom=\"40px\"][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=\"15%\"][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=\"10%\"]\r\n\r\n[button  type=\"flat\" block=\"true\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/consulting/\" size=\"x-large\" ]Schedule a consultation[/button]\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[content_band bg_color=\"#f2f2f2\" inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"40px\" padding_bottom=\"40px\"]\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\"] Faster Code[/custom_headline][line style=\"border-top: solid #999999;\"]ArrayFire is a blazing fast software library for GPU computing. Its easy-to-use API and array-based function set make GPU programming simple. A few lines of code in ArrayFire can replace dozens of lines of raw GPU code, saving you valuable time and lowering development costs.[/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\"] Hardware Neutral[/custom_headline][line style=\"border-top: solid #999999;\"]ArrayFire supports both CUDA-capable NVIDIA GPUs and most OpenCL devices, including AMD GPUs/APUs and Intel Xeon Phi co-processors. It also supports mobile OpenCL devices from ARM, Qualcomm, and others. We want your code to run as fast as possible, regardless of the hardware.[/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\"] Open Source[/custom_headline][line style=\"border-top: solid #999999;\"]ArrayFire is open source—it\'s all there and it\'s all free. Be sure to check out all of the ArrayFire functions (and a lot more!) in our excellent <a href=\"http://www.sandbox.arrayfire.com/docs/index.htm\">documentation</a>. And don\'t forget to visit our <a href=\"http://sandbox.arrayfire.com/forums/\">forums</a> to connect with the ArrayFire community and pick up acceleration tips and innovative best practices.[/column]\r\n<p style=\"text-align: center;\">[column type=\"one-third\" class=\"center-text\"][button  type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/docs/examples.htm\"]See some examples[/button][/column]</p>\r\n<p style=\"text-align: center;\">[column type=\"one-third\" class=\"center-text\"][button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/download\"]Download ArrayFire[/button][/column]</p>\r\n<p style=\"text-align: center;\">[column type=\"one-third\" class=\"center-text\" last=\"true\"][button type=\"flat\" shape=\"rounded\" size=\"regular\" href=\"http://www.sandbox.arrayfire.com/docs/index.htm\"]View the documentation[/button][/column][gap size=\"3%\"][/content_band]</p>\r\n\r\n<div>\r\n\r\n[content_band inner_container=\"true\" no_margin=\"true\" border=\"none\" padding_top=\"40px\" padding_bottom=\"40px\"][gap size=5%]\r\n\r\n[rev_slider customers]\r\n<h3 style=\"text-align: center;\">Join the ArrayFire community</h3>\r\n&nbsp;\r\n<p style=\"text-align: center;\">[button  type=\"flat\" shape=\"rounded\" href=\"http://sandbox.arrayfire.com/download\" size=\"normal\" ]                    Get started                    [/button]</p>\r\n[/content_band]\r\n\r\n</div>','Home','','inherit','open','open','','245-revision-v1','','','2015-03-02 21:49:00','2015-03-02 21:49:00','',245,'http://sandbox.arrayfire.com/245-revision-v1/',0,'revision','',0),(8010,17728,'2015-03-04 18:25:36','2015-03-04 18:25:36','<p>Under Windows and Mac the Intel GPU drivers include OpenCL support; however, on Linux OpenCL on Intel GPUs is implemented through an open source project called <a href=\"http://www.freedesktop.org/wiki/Software/Beignet/\">Beignet</a> (pronnounced like \"ben-yay\", a type of <a href=\"http://en.wikipedia.org/wiki/Beignet\">French pastry</a> akin to a what we would call a \"fritter\" in English). Below I have written a step-by-step guide on how you can get Beignet running on an Ubuntu 14.10 system which has an Intel 3rd, 4th, or 5th <a href=\"http://ark.intel.com/\">generation Intel processor</a>. Instructions for other variants of Linux will be similar, except for the commands to install the prerequisite packages.</p>\n\n<p>There are several little caveats which need to be discussed up front. Foremost, the Beignet project supports the following hardware:</p>\n\n<ul>\n<li>3rd Generation Intel Core Processors</li>\n<li>Intel “Bay Trail” platforms with Intel HD Graphics</li>\n<li>4th Generation Intel Core Processors (requires a kernel patch be applied for shared memory!)</li>\n<li>5th Generation Intel Core Processors \"Broadwell\".</li>\n</ul>\n\n<p>There are also a few noteworthy issues of which you should be aware:</p>\n\n<ul>\n<li><p>If your computer is running a Linux kernel in the 3.15 or 3.16 branch, you will need to disable some register whitelist functionality every time you reboot your system. This can be accomplished by running <code>echo 0 > /sys/module/i915/parameters/enable_cmd_parser</code> as root.</p></li>\n<li><p>4th Generation Intel Processors (i.e. i3/5/7-4xxx) require a kernel patch for shared/local memory to function.</p></li>\n<li><p>There is no double precision support</p></li>\n<li><p>OpenGL-OpenCL interop via <code>cl_khr_gl_sharing</code> is not supported</p></li>\n</ul>\n\n<p>There are additional release notes that can be found on the <a href=\"http://www.freedesktop.org/wiki/Software/Beignet/\">Beignet</a> project page.</p>\n\n<h3>Installing prerequisites</h3>\n\n<pre><code>sudo apt-get install build-essential g++ cmake \nsudo apt-get install clang libclang-3.5-dev libclang-dev libclang1\n</code></pre>\n\n<p>Note, if you are on a Ubuntu 14.04 system, you should install <code>libclang-3.4-dev</code> instead, then run <code>update-alternatives</code> to point <code>llvm-link</code> and <code>llvm-as</code> to the correct version. The latter can be accomplished using the following commands:</p>\n\n<pre><code>sudo update-alternatives --install /usr/bin/llvm-link llvm-link /usr/bin/llvm-link-3.4 34\nsudo update-alternatives --install /usr/bin/llvm-as llvm-as /usr/bin/llvm-as-3.4 34  \n</code></pre>\n\n<p>If you want to use the standard OpenCL ICD loader, you will also need to install these packages:</p>\n\n<pre><code>sudo apt-get install opencl-headers ocl-icd-dev ocl-icd-libopencl1    \n</code></pre>\n\n<p>I would also recomment you install the <code>clinfo</code> program so that you can verify that your installation is successful:</p>\n\n<pre><code>sudo apt-get install clinfo    \n</code></pre>\n\n<h3>Check out and compile Beignet</h3>\n\n<pre><code>git clone git://anongit.freedesktop.org/beignet\ncd beignet\ngit checkout Release_v1.0.0\nmkdir build\ncd build\ncmake ..   \n</code></pre>\n\n<p>During the CMake stage, ensure that the OCL ICD header file is installed, otherwise the library will not create an installable client driver. If everything went fine, go ahead and compile the source using</p>\n\n<pre><code>make    \n</code></pre>\n\n<p>(Note, you can do make -jN with N > 1 to do a parallel build.)<br />\nNext we verify that Beignet is functioning correctly on your hardware by running unit tests. These can be found in the <code>utest</code> folder. The unit tests require some enviornmental variables be set prior to invocation:</p>\n\n<pre><code>cd utests\ncat setenv.sh\n[copy all of the export commands, run them in your shell]\n./utest_run   \n</code></pre>\n\n<p>If a significant fraction of the unit tests fail and you have a 3.15 or 3.16 kernel, you need to disable register whitelisting using a command similar to the following:</p>\n\n<pre><code>sudo su\necho 0 > /sys/module/i915/parameters/enable_cmd_parser\nexit    \n</code></pre>\n\n<p>and try re-running the tests. Please note that this change is not permanent and you will need to re-run it if you reboot your system. Alternatively, you could add this command to a startup script. The Beignet release notes mention there is a kernel patch to fix this issue which you could backport if you so desired.</p>\n\n<p>If most of the tests pass, but those that involve local memory (~20-30 of the tests) fail, you will need to apply the <a href=\"#kernel-patch\">kernel patch</a> listed below.</p>\n\n<p>If all was well, install Beignet to your system:</p>\n\n<pre><code>sudo make install   \n</code></pre>\n\n<p>You can see a list of installed software in the <code>install_manifest.txt</code> file in the build directory.</p>\n\n<h3>Verify Beignet is installed</h3>\n\n<p>In a terminal run the <code>clinfo</code> program. You should see something like this:</p>\n\n<pre><code>$ clinfo\n...      \nPlatform Name:              Intel Gen OCL Driver\nNumber of devices:          1\nDevice Type:                CL_DEVICE_TYPE_GPU\n...\nName:                       Intel(R) HD Graphics Haswell GT2 Desktop\nVendor:                     Intel\nDevice OpenCL C version:    OpenCL C 1.2 beignet 0.9.1\nDriver version:             0.9.1\nProfile:                    FULL_PROFILE\nVersion:                    OpenCL 1.2 beignet 0.9.1\nExtensions:                 cl_khr_global_int32_base_atomics \n                            cl_khr_global_int32_extended_atomics \n                            cl_khr_local_int32_base_atomics \n                            cl_khr_local_int32_extended_atomics \n                            cl_khr_byte_addressable_store cl_khr_icd   \n</code></pre>\n\n<p>Take note that the Intel OpenCL driver is loaded for a GPU device using <code>beignet</code>. This indicates the Installable Client Driver (ICD) is correctly installed. Also note the extensions listed.</p>\n\n<h3>Applying the kernel patch to enable OpenCL shared local memory.</h3>\n\n<p>If you are using Beignet on a 4th generation Intel processor, you will need to apply a kernel patch to enable shared/local memory. This is a fairly lengthy process that will require at least 70 GB of hard disk space and perhaps an hour of compilation time if the build is executed in parallel.</p>\n\n<p>In the next few paragraphs I\'ll walk you through how you can apply the kernel patch. I have based my instructions on the <a href=\"https://help.ubuntu.com/community/Kernel/Compile\">kernel compilation instructions for Ubuntu</a>. Instructions for other variants of Linux will be significantly different.</p>\n\n<p>Install prerequisites:</p>\n\n<pre><code>sudo apt-get build-dep linux-image-`uname -r`    \n</code></pre>\n\n<p>Make a working directory for the kernel somewhere and download the source</p>\n\n<pre><code>mkdir kernel\ncd kernel\napt-get source linux-image-`uname -r`    \n</code></pre>\n\n<p>Next we see if we can automatically apply the patch. First download the patch:</p>\n\n<pre><code>wget https://01.org/sites/default/files/disable-batchbuffer-security.patch    \n</code></pre>\n\n<p>Now <code>cd</code> into the kernel directory:</p>\n\n<pre><code>cd linux-3.16.0    \n</code></pre>\n\n<p>Check some details about the patch</p>\n\n<pre><code>git apply --stat ../disable-batchbuffer-security.patch    \n</code></pre>\n\n<p>Try automatically applying the patch:</p>\n\n<pre><code>git apply --check ../disable-batchbuffer-security.patch    \n</code></pre>\n\n<p>If it automatically applies with no errors, just apply it:</p>\n\n<pre><code>git apply ../disable-batchbuffer-security.patch    \n</code></pre>\n\n<p>If it did not work (as was the case on my system), the change is fairly simple. Open the <code>drivers/gpu/drm/i915/i915_gem_execbuffer.c</code> file in an editor:</p>\n\n<pre><code>gedit drivers/gpu/drm/i915/i915_gem_execbuffer.c   \n</code></pre>\n\n<p>In the <code>i915_gem_do_execbuffer</code> function, find the following code:</p>\n\n<pre><code>flags = 0;\nif (args->flags & I915_EXEC_SECURE) {\n    if (!file->is_master || !capable(CAP_SYS_ADMIN))\n        return -EPERM;    \n</code></pre>\n\n<p>And add the line <code>flags |= I915_DISPATCH_SECURE;</code> as follows:</p>\n\n<pre><code>flags = 0;\nflags |= I915_DISPATCH_SECURE;\nif (args->flags & I915_EXEC_SECURE) {\n    if (!file-&gt;is_master || !capable(CAP_SYS_ADMIN))\n        return -EPERM;  \n</code></pre>\n\n<p>This was inserted on line 998 for me. Save the file. Now we need to compile and install the modified kernel.</p>\n\n<p>Now we build the new kernel. Run the following commands from within the kernel source directory:</p>\n\n<pre><code>fakeroot debian/rules clean\nDEB_BUILD_OPTIONS=parallel=8 fakeroot debian/rules binary-headers binary-generic    \n</code></pre>\n\n<p>This will build some Debian packages and place them in the directory <em>above</em> the kernel source root.</p>\n\n<p>After the kernel has compiled, install it:</p>\n\n<pre><code>cd ../ (or go back into the kernel directory)\nsudo dpkg -i linux-headers-3.16.0-29-generic_3.16.0-29.54_amd64.deb \nsudo dpkg -i linux-image-3.16.0-29-generic_3.16.0-29.54_amd64.deb    \n</code></pre>\n\n<p>(you might have to change the numeric kernel version to match what you compiled) Now add the kernel to the boot options:</p>\n\n<pre><code>sudo update-grub\nsudo reboot    \n</code></pre>\n\n<p>Now go back and re-run the Beignet unit test framework from above. With any luck everything will work fine.</p>\n','OpenCL on Intel HD / Iris graphics on Linux','','inherit','open','open','','7739-autosave-v1','','','2015-03-04 18:25:36','2015-03-04 18:25:36','',7739,'http://sandbox.arrayfire.com/7739-autosave-v1/',0,'revision','',0),(8011,17728,'2015-03-04 18:25:51','2015-03-04 18:25:51','<p>Under Windows and Mac the Intel GPU drivers include OpenCL support; however, on Linux OpenCL on Intel GPUs is implemented through an open source project called <a href=\"http://www.freedesktop.org/wiki/Software/Beignet/\">Beignet</a> (pronnounced like \"ben-yay\", a type of <a href=\"http://en.wikipedia.org/wiki/Beignet\">French pastry</a> akin to a what we would call a \"fritter\" in English). Below I have written a step-by-step guide on how you can get Beignet running on an Ubuntu 14.10 system which has an Intel 3rd, 4th, or 5th <a href=\"http://ark.intel.com/\">generation Intel processor</a>. Instructions for other variants of Linux will be similar, except for the commands to install the prerequisite packages.</p>\r\n\r\n<p>There are several little caveats which need to be discussed up front. Foremost, the Beignet project supports the following hardware:</p>\r\n\r\n<ul>\r\n<li>3rd Generation Intel Core Processors</li>\r\n<li>Intel “Bay Trail” platforms with Intel HD Graphics</li>\r\n<li>4th Generation Intel Core Processors (requires a kernel patch be applied for shared memory!)</li>\r\n<li>5th Generation Intel Core Processors \"Broadwell\".</li>\r\n</ul>\r\n\r\n<p>There are also a few noteworthy issues of which you should be aware:</p>\r\n\r\n<ul>\r\n<li><p>If your computer is running a Linux kernel in the 3.15 or 3.16 branch, you will need to disable some register whitelist functionality every time you reboot your system. This can be accomplished by running <code>echo 0 > /sys/module/i915/parameters/enable_cmd_parser</code> as root.</p></li>\r\n<li><p>4th Generation Intel Processors (i.e. i3/5/7-4xxx) require a kernel patch for shared/local memory to function.</p></li>\r\n<li><p>There is no double precision support</p></li>\r\n<li><p>OpenGL-OpenCL interop via <code>cl_khr_gl_sharing</code> is not supported</p></li>\r\n</ul>\r\n\r\n<p>There are additional release notes that can be found on the <a href=\"http://www.freedesktop.org/wiki/Software/Beignet/\">Beignet</a> project page.</p>\r\n\r\n<h3>Installing prerequisites</h3>\r\n\r\n<pre><code>sudo apt-get install build-essential g++ cmake \r\nsudo apt-get install clang libclang-3.5-dev libclang-dev libclang1\r\n</code></pre>\r\n\r\n<p>Note, if you are on a Ubuntu 14.04 system, you should install <code>libclang-3.4-dev</code> instead, then run <code>update-alternatives</code> to point <code>llvm-link</code> and <code>llvm-as</code> to the correct version. The latter can be accomplished using the following commands:</p>\r\n\r\n<pre><code>sudo update-alternatives --install /usr/bin/llvm-link llvm-link /usr/bin/llvm-link-3.4 34\r\nsudo update-alternatives --install /usr/bin/llvm-as llvm-as /usr/bin/llvm-as-3.4 34  \r\n</code></pre>\r\n\r\n<p>If you want to use the standard OpenCL ICD loader, you will also need to install these packages:</p>\r\n\r\n<pre><code>sudo apt-get install opencl-headers ocl-icd-dev ocl-icd-libopencl1    \r\n</code></pre>\r\n\r\n<p>I would also recomment you install the <code>clinfo</code> program so that you can verify that your installation is successful:</p>\r\n\r\n<pre><code>sudo apt-get install clinfo    \r\n</code></pre>\r\n\r\n<h3>Check out and compile Beignet</h3>\r\n\r\n<pre><code>git clone git://anongit.freedesktop.org/beignet\r\ncd beignet\r\ngit checkout Release_v1.0.0\r\nmkdir build\r\ncd build\r\ncmake ..   \r\n</code></pre>\r\n\r\n<p>During the CMake stage, ensure that the OCL ICD header file is installed, otherwise the library will not create an installable client driver. If everything went fine, go ahead and compile the source using</p>\r\n\r\n<pre><code>make    \r\n</code></pre>\r\n\r\n<p>(Note, you can do make -jN with N > 1 to do a parallel build.)<br />\r\nNext we verify that Beignet is functioning correctly on your hardware by running unit tests. These can be found in the <code>utest</code> folder. The unit tests require some enviornmental variables be set prior to invocation:</p>\r\n\r\n<pre><code>cd utests\r\ncat setenv.sh\r\n[copy all of the export commands, run them in your shell]\r\n./utest_run   \r\n</code></pre>\r\n\r\n<p>If a significant fraction of the unit tests fail and you have a 3.15 or 3.16 kernel, you need to disable register whitelisting using a command similar to the following:</p>\r\n\r\n<pre><code>sudo su\r\necho 0 > /sys/module/i915/parameters/enable_cmd_parser\r\nexit    \r\n</code></pre>\r\n\r\n<p>and try re-running the tests. Please note that this change is not permanent and you will need to re-run it if you reboot your system. Alternatively, you could add this command to a startup script. The Beignet release notes mention there is a kernel patch to fix this issue which you could backport if you so desired.</p>\r\n\r\n<p>If most of the tests pass, but those that involve local memory (~20-30 of the tests) fail, you will need to apply the <a href=\"#kernel-patch\">kernel patch</a> listed below.</p>\r\n\r\n<p>If all was well, install Beignet to your system:</p>\r\n\r\n<pre><code>sudo make install   \r\n</code></pre>\r\n\r\n<p>You can see a list of installed software in the <code>install_manifest.txt</code> file in the build directory.</p>\r\n\r\n<h3>Verify Beignet is installed</h3>\r\n\r\n<p>In a terminal run the <code>clinfo</code> program. You should see something like this:</p>\r\n\r\n<pre><code>$ clinfo\r\n...      \r\nPlatform Name:              Intel Gen OCL Driver\r\nNumber of devices:          1\r\nDevice Type:                CL_DEVICE_TYPE_GPU\r\n...\r\nName:                       Intel(R) HD Graphics Haswell GT2 Desktop\r\nVendor:                     Intel\r\nDevice OpenCL C version:    OpenCL C 1.2 beignet 0.9.1\r\nDriver version:             0.9.1\r\nProfile:                    FULL_PROFILE\r\nVersion:                    OpenCL 1.2 beignet 0.9.1\r\nExtensions:                 cl_khr_global_int32_base_atomics \r\n                            cl_khr_global_int32_extended_atomics \r\n                            cl_khr_local_int32_base_atomics \r\n                            cl_khr_local_int32_extended_atomics \r\n                            cl_khr_byte_addressable_store cl_khr_icd   \r\n</code></pre>\r\n\r\n<p>Take note that the Intel OpenCL driver is loaded for a GPU device using <code>beignet</code>. This indicates the Installable Client Driver (ICD) is correctly installed. Also note the extensions listed.</p>\r\n\r\n<h3>Applying the kernel patch to enable OpenCL shared local memory.</h3>\r\n\r\n<p>If you are using Beignet on a 4th generation Intel processor, you will need to apply a kernel patch to enable shared/local memory. This is a fairly lengthy process that will require at least 70 GB of hard disk space and perhaps an hour of compilation time if the build is executed in parallel.</p>\r\n\r\n<p>In the next few paragraphs I\'ll walk you through how you can apply the kernel patch. I have based my instructions on the <a href=\"https://help.ubuntu.com/community/Kernel/Compile\">kernel compilation instructions for Ubuntu</a>. Instructions for other variants of Linux will be significantly different.</p>\r\n\r\n<p>Install prerequisites:</p>\r\n\r\n<pre><code>sudo apt-get build-dep linux-image-`uname -r`    \r\n</code></pre>\r\n\r\n<p>Make a working directory for the kernel somewhere and download the source</p>\r\n\r\n<pre><code>mkdir kernel\r\ncd kernel\r\napt-get source linux-image-`uname -r`    \r\n</code></pre>\r\n\r\n<p>Next we see if we can automatically apply the patch. First download the patch:</p>\r\n\r\n<pre><code>wget https://01.org/sites/default/files/disable-batchbuffer-security.patch    \r\n</code></pre>\r\n\r\n<p>Now <code>cd</code> into the kernel directory:</p>\r\n\r\n<pre><code>cd linux-3.16.0    \r\n</code></pre>\r\n\r\n<p>Check some details about the patch</p>\r\n\r\n<pre><code>git apply --stat ../disable-batchbuffer-security.patch    \r\n</code></pre>\r\n\r\n<p>Try automatically applying the patch:</p>\r\n\r\n<pre><code>git apply --check ../disable-batchbuffer-security.patch    \r\n</code></pre>\r\n\r\n<p>If it automatically applies with no errors, just apply it:</p>\r\n\r\n<pre><code>git apply ../disable-batchbuffer-security.patch    \r\n</code></pre>\r\n\r\n<p>If it did not work (as was the case on my system), the change is fairly simple. Open the <code>drivers/gpu/drm/i915/i915_gem_execbuffer.c</code> file in an editor:</p>\r\n\r\n<pre><code>gedit drivers/gpu/drm/i915/i915_gem_execbuffer.c   \r\n</code></pre>\r\n\r\n<p>In the <code>i915_gem_do_execbuffer</code> function, find the following code:</p>\r\n\r\n<pre><code>flags = 0;\r\nif (args->flags & I915_EXEC_SECURE) {\r\n    if (!file->is_master || !capable(CAP_SYS_ADMIN))\r\n        return -EPERM;    \r\n</code></pre>\r\n\r\n<p>And add the line <code>flags |= I915_DISPATCH_SECURE;</code> as follows:</p>\r\n\r\n<pre><code>flags = 0;\r\nflags |= I915_DISPATCH_SECURE;\r\nif (args->flags & I915_EXEC_SECURE) {\r\n    if (!file->is_master || !capable(CAP_SYS_ADMIN))\r\n        return -EPERM;  \r\n</code></pre>\r\n\r\n<p>This was inserted on line 998 for me. Save the file. Now we need to compile and install the modified kernel.</p>\r\n\r\n<p>Now we build the new kernel. Run the following commands from within the kernel source directory:</p>\r\n\r\n<pre><code>fakeroot debian/rules clean\r\nDEB_BUILD_OPTIONS=parallel=8 fakeroot debian/rules binary-headers binary-generic    \r\n</code></pre>\r\n\r\n<p>This will build some Debian packages and place them in the directory <em>above</em> the kernel source root.</p>\r\n\r\n<p>After the kernel has compiled, install it:</p>\r\n\r\n<pre><code>cd ../ (or go back into the kernel directory)\r\nsudo dpkg -i linux-headers-3.16.0-29-generic_3.16.0-29.54_amd64.deb \r\nsudo dpkg -i linux-image-3.16.0-29-generic_3.16.0-29.54_amd64.deb    \r\n</code></pre>\r\n\r\n<p>(you might have to change the numeric kernel version to match what you compiled) Now add the kernel to the boot options:</p>\r\n\r\n<pre><code>sudo update-grub\r\nsudo reboot    \r\n</code></pre>\r\n\r\n<p>Now go back and re-run the Beignet unit test framework from above. With any luck everything will work fine.</p>\r\n','OpenCL on Intel HD / Iris graphics on Linux','','inherit','open','open','','7739-revision-v1','','','2015-03-04 18:25:51','2015-03-04 18:25:51','',7739,'http://sandbox.arrayfire.com/7739-revision-v1/',0,'revision','',0),(8012,17728,'2015-03-04 18:27:09','2015-03-04 18:27:09','<p>The ArrayFire library offers JIT (Just In Time) compiling for standard arithmetic operations. This includes trigonometric functions, comparisons, and element-wise operations.</p>\r\n\r\n<p>At run-time, ArrayFire aggregates these function calls using an Abstract Syntax Tree (AST) data structure such that when ever a JIT supported function is \'\'met\'\' it is added into the AST for a given variable instance. The AST of the variable is computed if one of the following conditions is met:</p>\r\n\r\n<ul>\r\n<li>an explication evaluation is required by the programmer using the eval() function member or</li>\r\n<li>the variable is required for the computation of a different variable that is not-JIT supported it. </li>\r\n</ul>\r\n\r\n<p>When the above occurs and the variable needs to be evaluated, the functions and variables in the AST data structure are used to create a single kernel (\'\'function-call\'\'). This is done by a creating a customized kernel on-the-fly that is made up of all the functions in the AST - the customized function is then executed.</p>\r\n\r\n<p>This JIT compilation technique has multiple benefits:</p>\r\n\r\n<ul>\r\n<li>A reduced number of kernel calls - a kernel call can be a significant overhead for small data-sets. </li>\r\n<li>Better cache performance - there are many instances in which the memory required by a single element in the array can be reused multiple or the temporary value of a computation can be stored in the cache and reused by future computations. </li>\r\n<li>Temporary memory allocation and write-back can be reduced - when multiple expressions are evaluated and stored into temporary arrays, these arrays need to be allocated and the results written back to the main memory.</li>\r\n<li>Avoid computing elements that are not used - there are cases in which the AST is created for a variable, however the expression is not used later in the computation. Thus, it evaluation can be avoided.</li>\r\n<li>Better performance - all the above in fact can help reduce the total execution time.</li>\r\n</ul>\r\n\r\n<pre>// As JIT is automatically enabled in ArrayFire, this version of the function forces each expression to be evaluated.\r\n// If the eval() function calls are removed, then the execution of this code would be equivalent to the following function.\r\nstatic double pi_no_jit(array x, array y, array temp, int samples){\r\n        temp=x*x;\r\n        temp.eval();\r\n        temp+=y*y;\r\n        temp.eval();\r\n        temp=sqrt(temp);\r\n        temp.eval();\r\n        temp=temp < 1;\r\n        temp.eval();\r\n        return 4.0 sum<float>(temp)/samples;\r\n}\r\n\r\nstatic double pi_jit(array x, array y, array temp,int samples){\r\n        temp = (sqrt(x*x+y*y) < 1); \r\n        temp.eval();\r\n        return 4.0*sum<float>(temp)/samples;\r\n}\r\n</pre>\r\n\r\n<p>The above code (using ArrayFire) computes the value π using a Monte-Carlo simulation where points are randomly generated within the unit-square.Each point is then tested to see if it is within the unit-circle. The ratio of points within the circle and the point in the square approximate the value π. The accuracy of π improves as the number of samples are increased, which motivates using additional sample.</p>\r\n\r\n<p>There are two implementations in the code listing: - an implementation that takes advantage of the JIT feature (<code>pi_jit</code>) - an implementation that does not benefit from the JIT (<code>pi_no_jit</code>).</p>\r\n\r\n<p>Specifically, as JIT as an integral feature of the ArrayFire framework, it cannot simply be turned on and off. The only way for a programmer to side-step the JIT operations is to manually force the evaluation of expressions. This is done in the non-JIT supported implementation.</p>\r\n\r\n<p>[caption id=\"attachment_7740\" align=\"alignnone\" width=\"716\"] [<img src=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/02/jit_cuda1.png\" alt=\"Performance of JIT and Non-JIT implementations\" width=\"716\" height=\"371\" class=\"size-full wp-image-7740\" />]<a href=\"http://sandbox.arrayfire.com/wp-content/uploads/2015/02/jit_cuda1.png\">1</a> Performance of JIT and Non-JIT implementations[/caption]</p>\r\n\r\n<p>The above figure depicts the execution time (abscissa) as a function of the number of samples (ordinate) for the two implementations discussed above. These tests were conducted on NVIDIA K20 GPU.</p>\r\n\r\n<p>When the number of samples is considerably small, the execution time of the non-JIT supported function is dominated by the launch of multiple kernels. While the JIT supported function only has a single kernel to launch, the creation of the JIT-code dominates the execution time. Nonetheless, the JIT supported function is <strong>1.4X-2.0X</strong> than the non-JIT supported function.</p>\r\n\r\n<p>In the case of the large number of samples, both the kernel launch overhead and the JIT-code creation, are not the limiting factor - the execution time is dominated by the functionality of the kernel. Specifically, the JIT supported version is <strong>2.0X-2.7X</strong> faster than the non-JIT support function due to the reduced number of cache-misses.</p>\r\n\r\n<p>The number of applications that benefit from the JIT code generation are large. The actual performance benefits are also application dependent though we have a seen similar performance curves in the past.In a recent blog, <a href=\"http://sandbox.arrayfire.com/conways-game-of-life-using-arrayfire/\" title=\"Conway\'s Game of Life\" target=\"_blank\"> Conway\'s Game of Life</a>, we showed how to implement the \"Game\" in a handful of lines of code. Now that you know about the JIT and what to look for, can you see how JIT is applied to the Game of Life?</p>\r\n','Performance of ArrayFire JIT Code Generation','','inherit','open','open','','7702-revision-v1','','','2015-03-04 18:27:09','2015-03-04 18:27:09','',7702,'http://sandbox.arrayfire.com/7702-revision-v1/',0,'revision','',0),(8018,18132,'2015-03-09 04:00:34','0000-00-00 00:00:00','<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>Slurm_Blog_Post.md</title><style></style></head><body>\r\n<p>Whereas workstations can be quite powerful, there are a few scenarios demanding the need for separate machines linked together to enable batch-like processing through either MPI or simple scripting,</p>\r\n<pre><code>1. A simple need for horsepower.\r\n2. Resilient compute resources (via a large lack of human interaction).\r\n3. Heavy webapp hosting.\r\n4. Dev-ops.\r\n</code></pre><p>Whether one decides to build a cluster by buying cloud compute time or putting something together themselves, nevertheless, a batch job scheduler and shared filesystem must be put in place for anything to work at all!</p>\r\n<p>In the post, we show how to set up a common opensource job scheduler, SLURM, in addition to a shared filesystem via Gluster. SLURM supports GPUs and we have found through practice that whereas not the fastest filesystem, Gluster can take a lickin&#39; and keep tickin&#39; through some wholly unknown means.</p>\r\n<h2 id=\"initial-cluster-installation\">Initial Cluster Installation</h2>\r\n<p>Our instructions assume that you have already installed Debian on a set of machines attached via IP. Moreover, we assume that each machine is named <code>c000</code>, <code>c001</code>, etc. and may be pinged as such, <code>ping c000</code>, through whatever means you see fit. We also assume each machine possesses a single <strong>CUDA</strong> GPU.</p>\r\n<p>Two machines in the cluster must be treated specially as these will be Gluster servers. Install a small root partition (say, 30G) and leave the rest open with an empty directory at <code>/data/gv0/brick1</code>. A secondary disk may be preferred to mount at that point and a preferably equal amount of space should be available on each of the two machines.</p>\r\n<h2 id=\"gluster\">Gluster</h2>\r\n<p>Practical work across a cluster requires a <em>stable</em> shared filesystem. Whereas NFS and AFS are much faster than Gluster, an overloaded NFS or AFS server can screem to a halt, hanging clients and doing even worse if they are rebooted! For safety, we tend to favor Gluster as in our practice no matter how we have abused it, it has never lead to cluster-wide failure.</p>\r\n<p>In this post, we give quick instructions on how to set up a Gluster filesystem shared via two servers - - you can expand on the instructions to do more, but two servers seem fairly resilient and responsive.</p>\r\n<p>Each machine will need gluster, current time keeping, and a place to mount the gluster filesystem as native and also NFS. Whereas the former leads to faster filesystem performance, NFS allows the use of cachefiles.d - - a boon for read-heavy jobs.</p>\r\n<pre><code># gluster build req\r\napt-get install -y libfuse-dev flex bison libssl-dev xfsprogs build-essential\r\n\r\n# NTP\r\napt-get install -y ntp\r\ncat &gt;&gt; /etc/ntp.conf &lt;&lt;EOF\r\nserver 0.US.pool.ntp.org\r\nserver 1.US.pool.ntp.org\r\nEOF\r\n\r\n# binaries\r\nwget http://download.gluster.org/pub/gluster/glusterfs/3.6/3.6.2/glusterfs-3.6.2.tar.gz -Oglusterfs.tar.gz\r\ntar xzfvp glusterfs.tar.gz\r\n(\r\n  cd glusterfs-3.6.2\r\n  ./configure\r\n  make install\r\n)\r\n\r\n# mount points for the filesystem\r\nmkdir -p /mnt/gfs /mnt/nfs\r\n</code></pre><p>Assuming you named your file servers <code>c000</code> and <code>c001</code>, set up the gluster daemon to start on boot,</p>\r\n<pre><code># bring up gluster server on boot\r\nupdate-rc.d glusterd defaults\r\necho /usr/local/lib &gt;&gt; /etc/ld.so.conf\r\nldconfig\r\nservice glusterd start\r\n</code></pre><p>Get each server talking to each other,</p>\r\n<pre><code>gluster peer probe c001        # &lt;- on c000\r\ngluster peer probe c000        # &lt;- on c001\r\n</code></pre><p>On <code>c000</code>, create a volume mirrored across both servers. Note the reference to <code>/data/gv0/brick1</code> as explained in the previous section - - fileserver data is stored here.</p>\r\n<pre><code>gluster volume create gv0 replica 2 c000:/data/gv0/brick1 c001:/data/gv0/brick1 force\r\ngluster volume start gv0\r\ngluster volume info\r\n</code></pre><p>On the remaining workers in your cluster you&#39;ll need a <a href=\"http://blog.gluster.org/tag/debian-2/\">hack</a> to make sure that they all mount native Gluster on boot,</p>\r\n<pre><code># mount gluster on boot\r\ncat &gt;&gt; /etc/fstab &lt;&lt;EOF\r\nc000:/gv0 /mnt/gfs glusterfs defaults,_netdev 0 0\r\nEOF\r\n\r\n# make sure that fuse is running before local fs mount\r\nsed -i &#39;s/# Required-Start:[ \\t]+$remote_fs/# Required-Start:    $local_fs/&#39;\r\nupdate-rc.d fuse start 34 S . stop 41 0 6 .\r\n</code></pre><p>You&#39;ll also want to enable <code>cachefilesd</code> via an NFS mount to cache files locally as they are read across the network. An arbitrary amount of data is then cached clientside making I/O reads much faster and keeping load off of the fileservers,</p>\r\n<p>  sudo apt-get install cachefilesd\r\n  sed -i &#39;/RUN/ d&#39; /etc/default/cachefilesd\r\n  echo &#39;RUN=yes&#39; &gt;&gt; /etc/default/cachefilesd\r\n  service cachefilesd start   # this will fail, but it is working if <code>ps ax | grep cachefiles</code> says its running</p>\r\n\r\n</body></html>','Creating a GPU Cluster','','draft','open','open','','','','','2015-03-09 04:00:34','2015-03-09 04:00:34','',0,'http://sandbox.arrayfire.com/?p=8018',0,'post','',0),(8019,18132,'2015-03-09 04:00:34','2015-03-09 04:00:34','<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title>Slurm_Blog_Post.md</title><style></style></head><body>\r\n<p>Whereas workstations can be quite powerful, there are a few scenarios demanding the need for separate machines linked together to enable batch-like processing through either MPI or simple scripting,</p>\r\n<pre><code>1. A simple need for horsepower.\r\n2. Resilient compute resources (via a large lack of human interaction).\r\n3. Heavy webapp hosting.\r\n4. Dev-ops.\r\n</code></pre><p>Whether one decides to build a cluster by buying cloud compute time or putting something together themselves, nevertheless, a batch job scheduler and shared filesystem must be put in place for anything to work at all!</p>\r\n<p>In the post, we show how to set up a common opensource job scheduler, SLURM, in addition to a shared filesystem via Gluster. SLURM supports GPUs and we have found through practice that whereas not the fastest filesystem, Gluster can take a lickin&#39; and keep tickin&#39; through some wholly unknown means.</p>\r\n<h2 id=\"initial-cluster-installation\">Initial Cluster Installation</h2>\r\n<p>Our instructions assume that you have already installed Debian on a set of machines attached via IP. Moreover, we assume that each machine is named <code>c000</code>, <code>c001</code>, etc. and may be pinged as such, <code>ping c000</code>, through whatever means you see fit. We also assume each machine possesses a single <strong>CUDA</strong> GPU.</p>\r\n<p>Two machines in the cluster must be treated specially as these will be Gluster servers. Install a small root partition (say, 30G) and leave the rest open with an empty directory at <code>/data/gv0/brick1</code>. A secondary disk may be preferred to mount at that point and a preferably equal amount of space should be available on each of the two machines.</p>\r\n<h2 id=\"gluster\">Gluster</h2>\r\n<p>Practical work across a cluster requires a <em>stable</em> shared filesystem. Whereas NFS and AFS are much faster than Gluster, an overloaded NFS or AFS server can screem to a halt, hanging clients and doing even worse if they are rebooted! For safety, we tend to favor Gluster as in our practice no matter how we have abused it, it has never lead to cluster-wide failure.</p>\r\n<p>In this post, we give quick instructions on how to set up a Gluster filesystem shared via two servers - - you can expand on the instructions to do more, but two servers seem fairly resilient and responsive.</p>\r\n<p>Each machine will need gluster, current time keeping, and a place to mount the gluster filesystem as native and also NFS. Whereas the former leads to faster filesystem performance, NFS allows the use of cachefiles.d - - a boon for read-heavy jobs.</p>\r\n<pre><code># gluster build req\r\napt-get install -y libfuse-dev flex bison libssl-dev xfsprogs build-essential\r\n\r\n# NTP\r\napt-get install -y ntp\r\ncat &gt;&gt; /etc/ntp.conf &lt;&lt;EOF\r\nserver 0.US.pool.ntp.org\r\nserver 1.US.pool.ntp.org\r\nEOF\r\n\r\n# binaries\r\nwget http://download.gluster.org/pub/gluster/glusterfs/3.6/3.6.2/glusterfs-3.6.2.tar.gz -Oglusterfs.tar.gz\r\ntar xzfvp glusterfs.tar.gz\r\n(\r\n  cd glusterfs-3.6.2\r\n  ./configure\r\n  make install\r\n)\r\n\r\n# mount points for the filesystem\r\nmkdir -p /mnt/gfs /mnt/nfs\r\n</code></pre><p>Assuming you named your file servers <code>c000</code> and <code>c001</code>, set up the gluster daemon to start on boot,</p>\r\n<pre><code># bring up gluster server on boot\r\nupdate-rc.d glusterd defaults\r\necho /usr/local/lib &gt;&gt; /etc/ld.so.conf\r\nldconfig\r\nservice glusterd start\r\n</code></pre><p>Get each server talking to each other,</p>\r\n<pre><code>gluster peer probe c001        # &lt;- on c000\r\ngluster peer probe c000        # &lt;- on c001\r\n</code></pre><p>On <code>c000</code>, create a volume mirrored across both servers. Note the reference to <code>/data/gv0/brick1</code> as explained in the previous section - - fileserver data is stored here.</p>\r\n<pre><code>gluster volume create gv0 replica 2 c000:/data/gv0/brick1 c001:/data/gv0/brick1 force\r\ngluster volume start gv0\r\ngluster volume info\r\n</code></pre><p>On the remaining workers in your cluster you&#39;ll need a <a href=\"http://blog.gluster.org/tag/debian-2/\">hack</a> to make sure that they all mount native Gluster on boot,</p>\r\n<pre><code># mount gluster on boot\r\ncat &gt;&gt; /etc/fstab &lt;&lt;EOF\r\nc000:/gv0 /mnt/gfs glusterfs defaults,_netdev 0 0\r\nEOF\r\n\r\n# make sure that fuse is running before local fs mount\r\nsed -i &#39;s/# Required-Start:[ \\t]+$remote_fs/# Required-Start:    $local_fs/&#39;\r\nupdate-rc.d fuse start 34 S . stop 41 0 6 .\r\n</code></pre><p>You&#39;ll also want to enable <code>cachefilesd</code> via an NFS mount to cache files locally as they are read across the network. An arbitrary amount of data is then cached clientside making I/O reads much faster and keeping load off of the fileservers,</p>\r\n<p>  sudo apt-get install cachefilesd\r\n  sed -i &#39;/RUN/ d&#39; /etc/default/cachefilesd\r\n  echo &#39;RUN=yes&#39; &gt;&gt; /etc/default/cachefilesd\r\n  service cachefilesd start   # this will fail, but it is working if <code>ps ax | grep cachefiles</code> says its running</p>\r\n\r\n</body></html>','Creating a GPU Cluster','','inherit','open','open','','8018-revision-v1','','','2015-03-09 04:00:34','2015-03-09 04:00:34','',8018,'http://sandbox.arrayfire.com/8018-revision-v1/',0,'revision','',0),(8031,17728,'2015-03-10 19:39:03','2015-03-10 19:39:03','<p>Linear classifiers perform classification based on the linear combinition of the component features. Some examples of Linear Classifiers include: Naive Bayes Classifier, Linear Discriminant Analysis, Logistic Regression and Perceptrons.</p>\r\n<p>ArrayFire\'s easy to use API enables users to write such classifiers from scratch fairly easily. In this post, we show how you can map mathematical equations to ArrayFire code and implement them from scratch.</p>\r\n\r\n<ul>\r\n<li><a href=\"#naive-bayes-classifier\">Naive Bayes Classifier</a><br /></li>\r\n<li><a href=\"#perceptron\">Perceptron</a></li>\r\n</ul>\r\n\r\n<h3 id=\"naive-bayes-classifier\">Naive Bayes Classifier</h3>\r\n<p><a href=\"http://en.wikipedia.org/wiki/Naive_Bayes_classifier\">Naive bayes classifier</a> is a probabilistic classifier that assumes all the features in a feature vector are independent of each other. This assumption simplifies the bayes rule to a simple multiplication of probabilities as show below.</p>\r\n<p>First we start with the simple Baye\'s rule.</p>\r\n<p><br /><span class=\"math\">$$ p(C_k | x) = \\frac{p(C_k)}{p(x)} \\prod\\limits_{i=1}^n p(x_i | C_k) $$</span><br /></p>\r\n<p>Where:</p>\r\n<ul>\r\n<li><br /><span class=\"math\">$$ C_k \\space \\text{is class k} $$</span><br /><br /></li>\r\n<li><br /><span class=\"math\">$$ x \\space \\text{is a feature vector containing the features} \\space \\{ x_0, x_1, x_2, ... x_n \\} $$</span><br /><br /></li>\r\n<li><br /><span class=\"math\">$$ p(C_k | x) \\space \\text {is the posterior probability of class} \\space C_k \\space \\text {given feature vector} \\space x $$</span><br /><br /></li>\r\n<li><br /><span class=\"math\">$$ p(C_k) \\space \\text {is the apriori probability distribution of the class} \\space C_k $$</span><br /><br /></li>\r\n<li><br /><span class=\"math\">$$ p(x | C_k) \\space \\text {is the probability of likelyhood} \\space x \\space belongs to class \\space C_k $$</span><br /></li>\r\n</ul>\r\n<p>Since <code>p(x)</code> is the same for all classes, it can be safely ignored. The classification is then done using the following formula</p>\r\n<p><br /><span class=\"math\">$$\\newcommand{\\argmax}{\\operatornamewithlimits{argmax}}y = argmax_i(p(C_k) \\prod\\limits_{i=1}^n p(x_i | C_k))$$</span><br /></p>\r\n<p>Classification based on Naive Bayes method uses the following phases:</p>\r\n<ul>\r\n<li>Training Phase: The probability ditribution of each feature variable is modeled<br /></li>\r\n<li>Prediction Phase: The probability of a sample belonging to each class is calculated based on the distributions from Phase 1.</li>\r\n</ul>\r\n<p>In our example, we are assuming all the input features fit a normal distribution. This requires us to calculate the mean, <code>mu</code> and the variance <code>Sig2</code> in the training phase.</p>\r\n<p>The necessary ArrayFire code for the training phase can be seen below:</p>\r\n<pre><code>// Iterate through each class\r\nfor (int ii = 0; ii < num_classes; ii++) {\r\n\r\n    // train_feats is of size [num_feats, num_train]\r\n    // train_classes is of size [1, num_train]\r\n\r\n    // Get indices where train_classes matches current class\r\n    array idx = where(train_classes == ii);\r\n\r\n    // Get train_feats from the current class only\r\n    array train_feats_ii = train_feats(span, idx);\r\n\r\n    // Get the distribution parameters\r\n    mu(span, ii)  = mean(train_feats_ii, 1);\r\n    sig2(span,ii)  = var(train_feats_ii, 0, 1);\r\n\r\n    // Calculate priors\r\n    priors[ii] = (float)idx.elements() / (float)num_samples;\r\n}</code></pre>\r\n<p>With the mean and variance of each class known, we can check the probabiltiy of a sample belonging to a particular class using the CDF of the distribution. The class with the highest probability wins.</p>\r\n<p>However when working with a large number of feature variables, multiplication can lead to underflow errors. We can get around this by using <code>log</code> and <code>sum</code> instead of <code>exp</code> and <code>mul</code>.</p>\r\n<p>The prediciton phase can be seen below.</p>\r\n<pre><code>for (int ii = 0; ii < num_classes; ii++) {\r\n\r\n    // test_feats is of size [num_feats, num_test]\r\n    // mu, sig2 are of size  [num_feats, num_classes]\r\n    // mu(span, ii), sig2(span, ii) will get mean and variance of current class\r\n\r\n    // Tile the mean and variance of current class to match test_feats\r\n    array Mu  = tile(mu (span, ii), 1, num_test);\r\n    array Sig2 = tile(sig2(span, ii), 1, num_test) + 0.01; // to avoid dividing by zero\r\n\r\n    array Df = test_feats - Mu;\r\n\r\n    // CDF of normal distribution is as follows\r\n    // array P = exp(-(Df * Df) / 2 * Sig2) / sqrt(2 * af::Pi * Sig2);\r\n    // Multiply the conditional probabilities and the prior of the class\r\n    // probs(span, ii) = priors[ii] * product(P).T();\r\n\r\n    // Calculate log_P instead for numerical stability\r\n    array log_P =  (-(Df * Df) / (2 * Sig2))  - log(sqrt(2 * af::Pi * Sig2));\r\n    // Accumulate the log of conditional probabilities and the prior of the class\r\n    log_probs(span, ii) = log(priors[ii]) + sum(log_P).T();\r\n}\r\n\r\narray val; // ignored\r\narray idx; // Gets the class id\r\n\r\n// Get the class ID with maximum log_probability\r\nmax(val, idx, log_probs, 1);</code></pre>\r\n<h3 id=\"perceptron\">Perceptron</h3>\r\n<p><a href=\"http://en.wikipedia.org/wiki/Perceptron\">Perceptron</a> is one of the first classification algorithms to use supervised learning. The perceptron transforms the weighted input features into the activation in the range <code>[0, 1]</code>.</p>\r\n<figure>\r\n<img src=\"https://docs.google.com/drawings/d/1sAZyAb3Q_YlGbI8ytwjmZg91NLV2_CCH7--yxt5Z7lA/pub?w=480&amp;h=360\">\r\n<figcaption> A visual representation of a perceptron </figcaption>\r\n</figure>\r\n<p>To perform classification on <code>K</code> classes, we use <code>K</code> perceptrons and choose the class with the maximum activation. For the perceptron <code>k</code>, the activation function can be seen below:</p>\r\n<p><br /><span class=\"math\">$$ Y_k = f\\small(W_{k,i} * X_i\\small) $$</span><br /></p>\r\n<p>To get an activation function that is continuous we use sigmoid function show below:</p>\r\n<p><br /><span class=\"math\">$$ sigmoid\\small(Z\\small) = \\frac{1}{1 \\space + \\space \\exp\\small(-Z\\small)} $$</span><br /></p>\r\n\r\n<p>The equivalent ArrayFire code can be seen here:</p>\r\n<pre><code>// Activation function\r\narray sigmoid(const array &Z)\r\n{\r\n    // Transforms Z to a value between [0, 1]\r\n    return 1 / (1 + exp(-Z));\r\n}\r\n\r\n// Predict based on given parameters\r\narray predict(const array &X, const array &Weights)\r\n{\r\n    // Weighted inputs\r\n    array Z = matmul(X, Weights);\r\n    // Transform Weighted inputs to output\r\n    return sigmoid(Z);\r\n}</code></pre>\r\n<p>The weights of the perceptron are trained in an iterative process. The trained weights are then used for prediction on test data. Training a perceptron includes the following steps:</p>\r\n<ol>\r\n<li>Initialize the weights<br /></li>\r\n<li>Predict the output based on training data<br /></li>\r\n<li>Update the weights in proportion to the folloing<br /><br /><span class=\"math\">$$ W_{k,i} = W_{k, i} \\space + \\space \\alpha * \\space \\small(Y_k - T_k\\small)^T \\space * \\space X_i$$</span><br /><br /></li>\r\n<li>if error greater than treshold, go to step 2.</li>\r\n</ol>\r\n<p>The training process of the perceptron can be implemented in ArrayFire using the following code.</p>\r\n<pre><code>    for (int i = 0; i < maxiter; i++) {\r\n\r\n        // Make a prediction based on current weights\r\n        array predicted = predict(input, Weights);\r\n\r\n        // G\r\n        array err = target - predicted;\r\n\r\n        // Get the average error\r\n        float mean_abs_err = mean<float>(abs(err));\r\n        // Stop training if the error is less than specified bounds\r\n        if (mean_abs_err < maxerr) break;\r\n\r\n        // Update the weights based on the input and error\r\n        Weights = Weights + alpha * matmul(transpose(input), err);\r\n    }\r\n</code></pre>\r\n<h3 id=\"results\">Results</h3>\r\n<p>The complete source code for testing and benchmarking these algorithms can be found here:</p>\r\n<ul>\r\n<li><a href=\"https://github.com/arrayfire/arrayfire/blob/devel/examples/machine_learning/naive_bayes.cpp\">Naive Bayes Classifier</a><br /></li>\r\n<li><a href=\"https://github.com/arrayfire/arrayfire/blob/devel/examples/machine_learning/perceptron.cpp\">Peceptron</a></li>\r\n</ul>\r\n<p>We tested these algorithms on a small subset of the MNIST database with 6100 training images, 3900 testing images.</p>\r\n<p>The performance and accuracy results can be seen below:</p>\r\n<table>\r\n<thead>\r\n<tr class=\"header\">\r\n<th align=\"left\">Algorithm</th>\r\n<th align=\"left\">Hardware</th>\r\n<th align=\"left\">Accuracy</th>\r\n<th align=\"left\">Train Time</th>\r\n<th align=\"left\">Predict Time</th>\r\n</tr>\r\n</thead>\r\n<tbody>\r\n<tr class=\"odd\">\r\n<td align=\"left\">Naive Bayes</td>\r\n<td align=\"left\">NVIDIA GTX 680</td>\r\n<td align=\"left\">80.69%</td>\r\n<td align=\"left\">0.003s</td>\r\n<td align=\"left\">0.011s</td>\r\n</tr>\r\n<tr class=\"even\">\r\n<td align=\"left\">Naive Bayes</td>\r\n<td align=\"left\">AMD Radeon 7970</td>\r\n<td align=\"left\">81.19%</td>\r\n<td align=\"left\">0.007s</td>\r\n<td align=\"left\">0.007s</td>\r\n</tr>\r\n<tr class=\"odd\">\r\n<td align=\"left\">Perceptron (1000 iter)</td>\r\n<td align=\"left\">NVIDIA GTX 680</td>\r\n<td align=\"left\">83.64%</td>\r\n<td align=\"left\">2.005s</td>\r\n<td align=\"left\">0.0003s</td>\r\n</tr>\r\n<tr class=\"even\">\r\n<td align=\"left\">Perceptron (1000 iter)</td>\r\n<td align=\"left\">AMD Radeon 7970</td>\r\n<td align=\"left\">85.29%</td>\r\n<td align=\"left\">4.935s</td>\r\n<td align=\"left\">0.0005s</td>\r\n</tr>\r\n</tbody>\r\n</table>\r\n<h3 id=\"conclusion\">Conclusion</h3>\r\n<p>We have shown how simple mathematical expressions can easily translate into ArrayFire code. If you are interested in learning more about how ArrayFire can be used to develop Machine Learning applications, follow this blog!</p>\r\n<p>If are going to GTC 2015, you may also be interested in the following tutorials.</p>\r\n<ul>\r\n<li><a href=\"https://registration.gputechconf.com/form/session-listing&amp;doSearch=true&amp;queryInput=S5803\">S5803</a>: Simplified Machine Learning for CUDA<br /></li>\r\n<li><a href=\"https://registration.gputechconf.com/form/session-listing&amp;doSearch=true&amp;queryInput=S5722\">S5722</a>: Deep Belief Networks using ArrayFire</li>\r\n</ul>','Machine Learning with ArrayFire: Linear Classifiers','','publish','open','open','','machine-learning-with-arrayfire-linear-classifiers','','','2015-03-14 04:13:08','2015-03-14 04:13:08','',0,'http://sandbox.arrayfire.com/?p=8031',0,'post','',0),