Cross Compile to Windows From Linux

Gallagher PryorArrayFire, C/C++ 7 Comments

Why did I not know about this? It’s like I just discovered the screw driver! On Debian and variants (from tinc’s windows cross-compilation page), sudo apt-get install mingw-w64 # C i686-w64-mingw32-gcc hello.c -o hello32.exe # 32-bit x86_64-w64-mingw32-gcc hello.c -o hello64.exe # 64-bit # C++ i686-w64-mingw32-g++ hello.cc -o hello32.exe # 32-bit x86_64-w64-mingw32-g++ hello.cc -o hello64.exe # 64-bit Granted, this isn’t a silver bullet, but rather a quick way to get a Windows build of platform independent code that you might already have running in Linux. I’ve found that this approach makes it easy to get binaries out the door in a hurry when it’s hard to get a project building with Visual Studio or even on the Windows platform itself (due …

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 …

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 …

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, …

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 = …

Getting Started with OpenCL on Android

Pradeep GarigipatiAndroid, Java, OpenCL 11 Comments

Mobile devices are carving their niche into the world of computing with more processing power day by day. GPUs on mobile devices have been around for a while, but using them for accelerating computation is still quite new. Until recently, the only way to access the GPU was through OpenGL. Around december 2008, Khronos released OpenCL, a generic API for accelerating non-graphics tasks. OpenCL enables us to take advantage of acceleration hardware. Since it is an open standard, many hardware vendors provide support on their devices. With the recent release of Adreno and Mali SDKs, you can now run OpenCL code on mobile GPUs. Today’s post is going to be about how to do image processing on camera feed on …

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 for Defense and Intelligence Applications

Aaron TaylorAnnouncements, C/C++, Events, Fortran Leave a Comment

AccelerEyes and NVIDIA invite you to participate in a joint webinar designed to help you learn about ArrayFire, a productive, easy-to-use GPU software library for C, C++, and Fortran. Major defense and intelligence institutions are discovering just how effective GPU computing can be in enabling unique solutions for applications related to video analysis, recognition, and tracking. During this informative webinar, Kyle Spafford, a Senior Software Developer at AccelerEyes, will explain how to accelerate common defense and intelligence algorithms using ArrayFire. The webinar will take place on Tuesday, September 17, 2013 at 10:00 AM PDT. Register for this webinar by clicking here. We hope you will join us as we discuss exciting developments in GPU computing software!