ArrayFire is Now Open Source

ScottAnnouncements, ArrayFire, Open Source 7 Comments

Yes, you read that right! ArrayFire is open source—it’s all there and it’s all free. This is big, and you and the rest of the parallel computing community are going to love it! You can download our pre-compiled binary installers which are optimized for a wide variety of systems or you can get a copy of the ArrayFire source code from our GitHub page. ArrayFire is being released under the BSD 3-Clause License, which will enable unencumbered deployment and portability of ArrayFire for commercial use. So go check it out! We welcome your feedback and look forward to your future contributions to ArrayFire. The move to open source isn’t our only news—we’ve also made ArrayFire better than ever. Check out our recent …

Accelerating Java using ArrayFire, CUDA and OpenCL

Pavan YalamanchiliArrayFire, Java 3 Comments

We have previously mentioned the ability to use ArrayFire through Java. In this post, we are going to show how you can get the best performance inside Java using ArrayFire for CUDA and OpenCL. Code Here is a sample code to perform Monte Caro Estimation of Pi. import java.util.Random; // Native Java Code public static double hostCalcPi(int size) { Random rand = new Random(); int count = 0; for (int i = 0; i < size; i++) { float x = rand.nextFloat(); float y = rand.nextFloat(); boolean lt1 = (x * x + y * y) < 1; if (lt1) count++; } return 4.0 * ((double)(count)) / size; } The same code can be written using ArrayFire in the following ...

OpenCL SPIR 2.0

Pavan YalamanchiliOpenCL 1 Comment

At SIGGRAPH 2014 The Khronos Group announced, among other things, the SPIR 2.0 provisional specification. This release of SPIR (Standard Portable Intermediate Representation) follows the release of OpenCL 2.0 spec last year. In this post, we would like to offer our take on SPIR 2.0 and what it means to OpenCL developers. Feature Parity With OpenCL 2.0 SPIR 1.2 had feature parity with OpenCL 1.2. With 2.0, SPIR has feature parity with OpenCL 2.0. Here are a few new features that we find interesting. Generic Address Space “Where functions can be written without specifying a named address space for arguments, especially useful for those arguments that are declared to be a pointer to a type, eliminating the need for multiple functions …

Image editing using ArrayFire: Part 3

Pradeep GarigipatiArrayFire, C/C++, CUDA, Image Processing, OpenCL 1 Comment

Today, we will be doing the third post in our series Image editing using ArrayFire. References to old posts are available below. * Part 1 * Part 2 In this post, we will be looking at the following operations. Image Histogram Simple Binary Theshold Otsu Threshold Iterative Threshold Adaptive Binary Threshold Emboss Filter Today’s post will be mostly dominated by different types of threshold operations we can achieve using ArrayFire. Image Histogram We have a built-in function in ArrayFire that creates a histogram. The input image was converted to gray scale before histogram calculation as our histogram implementation works for vector and 2D matrices only. In case, you need histogram for all three channels of a color image, you can …

Quest for the Smallest OpenCL Program

Umar ArshadC/C++, OpenCL 8 Comments

I have heard many complaints about the verbosity of the OpenCL API. This claim is not unwarranted. The verbosity is due to the low-level nature of OpenCL. It is written in the C programming language; the lingua franca of programming languages. While this allows you to run an OpenCL program on virtually any platform, it has some disadvantages. A typical OpenCL program must: Query for the platform Get the device IDs from the platform Create a context from a set of device IDs Create a command queue from the context Create buffer objects for your data Transfer the data to the buffer Create and build a program from source Extract the kernels Launch the kernels Transfer the data to the host …

Image editing using ArrayFire: Part 2

Pradeep GarigipatiArrayFire, Image Processing 10 Comments

A couple of weeks back, we did a post on a few image editing functions using ArrayFire library. Today, we shall be doing the second post in the series Image Editing using ArrayFire. We will be looking at the following operations today. Image distortion Noise addition Noise reduction Edge filters Boundary extraction Difference of gaussians Code and sample input/outputs corresponding to each operation are described below. Image distortion We will be looking at spread and pick filters in this section. Both of these filters are fundamentally the same, they replace each pixel in the original image with one of it’s neighboring pixels. How the neighbor is chosen is essentially the difference between spread and pick. Both of these functions use …

ArrayFire Capability Update – July 2014

Oded GreenAndroid, ArrayFire, C/C++, CUDA, Fortran, Java, OpenCL, R 1 Comment

In response to user requests for additional ArrayFire capabilities, we have decided to extend the library to have CPU fall back when OpenCL drivers for CPUs are not available. This means that ArrayFire code will be portable to both devices that have OpenCL setup and devices without it. This is done through the creation of additional backends. This will allow ArrayFire users to write their code once and have it run on multiple systems. We currently support the following systems and architectures: NVIDIA GPUs (Tesla, Fermi, and Kepler) AMD’s GPUs, CPUs and APUs Intel’s CPUs, GPUs and Xeon Phi Co-Processor Mobile and Embedded devices As part of this update process we are also looking at extending ArrayFire capabilities to low power systems such …

Image editing using ArrayFire

Pradeep GarigipatiArrayFire, Image Processing 2 Comments

In this post, we will be looking at the following simple image editing operations using the ArrayFire library. contrast modification brightness modification translation digital zoom alpha blending unsharp mask Code required to do each operation and the corresponding input/output sample are given below in their corresponding sections. All the operations are built using some existing image manipulation functions and the awesome element-wise operations in ArrayFire. Contrast modification /** * contrast value should be in the range [-1,1] **/ void changeContrast(array &in, const float contrast) { float scale = tan((contrast+1)*Pi/4); in = ((in/255.0f – 0.5f) * scale + 0.5f) * 255.0f; } Brightness modification /** * brightness value should be in the range [0,1] **/ void changeBrightness(array &in, const float brightness, …

OpenCL on Mobile Devices

Pavan YalamanchiliAndroid, OpenCL 6 Comments

While Google has openly displayed its opposition to OpenCL, many hardware manufacturers seem to be putting their weight behind OpenCL. Qualcomm, ARM, Imagination and Vivante support OpenCL on their GPUs. Android Phone manufacturers – Samsung, HTC, Sony and Amazon – ship OpenCL drivers and libraries on their latest generation of devices. Considering the prevalence of OpenCL on shipped devices, it is likely most Renderscript implementations have an OpenCL backend. To consolidate a list of OpenCL supported Android devices, we created a publicly accessable Google document seen below. If you have an Android phone that is not listed, we’d appreciate it if you contributed to the list. To test if OpenCL is supported on your phone, you can use OpenCL Info …

ArrayFire on Tegra K1

Shehzan MohammedArrayFire 2 Comments

We’re pleased to announce the arrival of ArrayFire for NVIDIA Tegra K1! This version of ArrayFire comes with all the capabilities and features of our standard version of ArrayFire. It includes all ArrayFire CUDA functionality—with the exception of linear algebra support—as well as fully operational graphics support. ArrayFire for Tegra currently works with Tegra K1 processors running Linux for Tegra. We invite and encourage you to test it out on your boards and give us feedback; any bug fixes or performance improvements will be promptly resolved, as this is a separate branch of ArrayFire. If you’d like to deploy ArrayFire on Android, feel free to contact us for further support. We are open to partnering with anyone wishing to deploy ArrayFire in other …