Indexing with ArrayFire

Umar ArshadArrayFire Leave a Comment

ArrayFire is a fantastic library when it comes to performance. One of the things that people overlook when looking into ArrayFire is it’s powerful indexing capabilities. The main data structure in the ArrayFire library is the array. The array stores the data in a column major order. This means that the following code: float a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9}; array A(3, 3, a); Will produce the following matrix: Notice how the first three values of the a array make up the first column of A. When you want to perform an operation on every element of the array you can just use the variable name with the operation. The following command adds 5 to …

Computer Vision in ArrayFire – Part 1: Feature Detection

Peter EntschevArrayFire, Computer Vision 6 Comments

A few weeks ago we wrote Writing a Simple Corner Detector with ArrayFire. In that post, we discussed a little bit about the new features that we are working on for ArrayFire. Some of these new computer vision features will be available in the next release of ArrayFire. For the next release, ArrayFire will have a complete set to start with feature tracking, including FAST for feature detection [1], ORB for description [2] and a Hamming distance matcher. We will also include a dedicated version of the Harris corner detector [3], even though it can be written using existing ArrayFire functions. This implementation is straightforward, easy to use and will have better performance. For this post, we will share some …

Image Processing Benchmarks on NVIDIA Jetson TK1

Pradeep GarigipatiArrayFire, Benchmarks, CUDA 7 Comments

In this post we will be looking at benchmarks of the following ArrayFire image processing functions on an ARM device. Erosion/Dilation Median filter Resize Histogram Bilateral filter Convolution We pitted the brand new compute 3.2 GPU on NVIDIA Jetson TK1 against a mobile NVIDIA GPU. The closest match to the GPU (from here on referred as TK1) on the Jetson board we have in our mobile card deck is a NVIDIA GT 650M. The GPU device properties that have critical effect on the function performance are listed below. Property Name / Device Name Jetson TK1 GK20A GT 650M Compute 3.2 3.0 Number of multiprocessors 1 2 Cores 192 384 Base clock rate 852 MHz 950 MHz Total global memory 1746 …

How to write vectorized code

Pavan YalamanchiliArrayFire, C/C++ Leave a Comment

Programmers and Data Scientists want to take advantage of fast and parallel computational devices. Writing vectorized code is becoming a necessity to get the best performance out of the current generation parallel hardware and scientific computing software. However, writing vectorized code may not be intuitive immediately. There are many ways you can vectorize a given code segment. Each method has its own benefits and drawbacks. Hence, writing vectorized code involves analyzing the pros and cons of the available methods and choosing the right one to solve your problem. In this post, I present various ways to vectorize your code using ArrayFire. ArrayFire is chosen because of my familiarity with the software. The same methods can be easily used in numpy, octave, …

Q/A Using ArrayFire

Shehzan MohammedArrayFire Leave a Comment

One of the reasons for ArrayFire’s usefulness is the various performance oriented function from many domains. What many people don’t realize is that ArrayFire also includes many utilities for image loading and visualization. In many cases, setting up a test harness is a ton of work. This is where ArrayFire can come in handy. Recently we worked on a project for one of our customers that involved image processing. As a part of development we wanted to make sure the quality is not compromised. They did not have a sufficient test framework in place. One option was to do this was the old fashioned way by reading two images and comparing them on CPU. Given that we needed to compare hundreds of images and …

Writing a Simple Corner Detector with ArrayFire

Peter EntschevArrayFire, C/C++, Computer Vision 2 Comments

In the upcoming months we’ll be adding a lot of new Computer Vision functionality to ArrayFire, specifically targeting the most commonly used applications in this field. New functions include feature tracking, object classification, scene segmentation, optical flow, and stereo-vision. Feature tracking consists of three basic steps: Detecting good or unique features; normally they are corners or blobs of an object. Extracting a descriptor for each feature—understanding the texture of a small patch around each feature. Descriptor matching—finding out the best match for each pair of descriptors (one from the object being tracked, another from a scene that potentially contains that object), if any. Harris corner detector In this article we will be using ArrayFire to dive deeper into the first step of feature …

Custom Kernels with ArrayFire

Pavan YalamanchiliArrayFire, C/C++, CUDA, OpenCL Leave a Comment

As extensive as ArrayFire is, there are a few cases where you are still working with custom CUDA or OpenCL kernels. For example, you may want to integrate ArrayFire into an existing code base for productivity or you may want to keep it around the old implementation for testing purposes. In this post we are going to talk about how to integrate your custom kernels into ArrayFire in a seamless fashion. In and Out of ArrayFire First let us look at the following code and then break it down bit by bit. int main() { af::array x = af::randu(num, 1); af::array y = af::array(num, 1); float *d_x = x.device(); float *d_y = y.device(); af::sync(); launch_simple_kernel(d_y, d_x, num); x.unlock(); y.unlock(); float err = …

Joint Webinar with AMD: An Introduction to OpenCL Libraries

ScottAnnouncements, ArrayFire, Events, OpenCL Leave a Comment

Back by popular demand! You’re invited to join us for a second webinar held jointly with AMD to discuss productive OpenCL Programming – An Introduction to OpenCL Libraries. We had so many people attend the first one, we decided to hold a second webinar! The webinar will be held on Monday, May 19 at 9 am PT / 11 am CT / 12 pm ET. Join ArrayFire COO Oded Green as he demonstrates best practices to help you quickly get started with OpenCL programming.  Learn how to get the best performance from AMD hardware in various programming languages using the ArrayFire library. Oded will discuss the latest advancements in the OpenCL ecosystem, including cutting edge OpenCL libraries such as clBLAS, clFFT, clMAGMA and ArrayFire. …

Open Source Initiatives from ArrayFire

Pavan YalamanchiliAnnouncements, ArrayFire, CUDA, Fortran, Java, Open Source, OpenCL, OpenGL, R Leave a Comment

At ArrayFire we like to use a lot of Free/Open Source software. We use various Linux distributions, Jenkins, Gitlab, gcc, emacs, vim and numerous other FOSS tools on a daily basis. We also love the idea of developing software collaboratively and openly. Last year we started working with AMD on CL Math Libraries. Internally we’ve had numerous discussions about contributing to the GPGPU community. However, it’s neither simple nor straightforward to take a closed software Open Source. Earlier this year, we decided to take the first step and Open Source all of the ArrayFire library’s  tertiary projects. This includes all of our ArrayFire library’s language wrappers, examples, and source code used for our blog posts. All of our projects are hosted at our …

ArrayFire v2.1 Official Release

Aaron TaylorAnnouncements, ArrayFire, CUDA, OpenCL Leave a Comment

It’s that time again—we’re pleased to announce the release of our newest version of ArrayFire: ArrayFire v2.1. ArrayFire v2.1 is now bigger, faster, and stronger, thanks to some key function additions, API changes, feature improvements, and bug fixes. ArrayFire is a CUDA and OpenCL library designed for maximum speed without the hassle of writing time-consuming CUDA and OpenCL device code.  With ArrayFire’s library functions, developers can maximize productivity and performance. Each of ArrayFire’s functions has been hand-tuned by CUDA and OpenCL experts. Major Updates Support for CUDA 6.0 Support for Mac OS X New language support (available on github)       ArrayFire for Java       ArrayFire for R!       ArrayFire for Fortran* ArrayFire Extras on Github       All language wrappers       …