How can I use GPU with Java programming - cuda

I am using CUDAC all these days to access the GPU. But now my guide asked me to work with Java and GPU. So I searched in Internet and found Rootbeer is the best option for it but I am not able to understand how to run a program using 'Rootbeer'. Can some one tell me steps for using Rootbeer.

Mark Harris from Nvidia gave nice talk about the future of CUDA at SC14. You can watch it here.
The main thing that may be of interest for you is the part where he talks about programming languages and especially Java. IBM is working on CUDA4J and there are some nice plans about Java 8 features especially lambdas to be used for GPU programming. However, I am not a Java user and I can't answer your question regarding Rootbeer (besides the taste) but maybe CUDA4J will be something that suits you. Especially, if you know how to write CUDA C and need a solution backed up by a company like IBM.

Related

Understanding Caffe code for open source development

I am trying to understand caffe code code (both the C++ and the GPU part) as I want to start contributing to it but I am having a hard time since I could not find a documentation and I do not know what modules to read first. It would be very helpful if someone can give me some directions as to how to proceed and what tools should I use for development.

Cuda Program to Solve Pi

I would like to know if there are any examples of solving for Pi using the trapezoidal rule in cuda. I am trying to learn the language and I feel this would be a great way to gain knowledge on the subject.
Thanks!
PDF paper with source-code and explanation.
(found via google)

What I need to read/analyze in order to understand how QEMU emulates supported network devices?

I would like to analyze how QEMU emulates the supported network devices reading the source code. Also I would like to share with me your opinions about what background is needed to understand QEMU's source code. Please suggest to me some good books or online sources for the surrounding topics that one has to learn in order to achieve that(I suppose Device Driver, Processor Specification etc are needed?). Also if you could tell me about the programming level that one should have in C (as the source code is written in C) that would be nice.
I have already looked at the QEMU's web site and what offers mostly refers on how to use QEMU and configure it.
For basic introduction to qemu and its networking functionalities:
What's a good source to learn about QEMU?
To get started with source code
original qemu paper
qemu-internals
http://www.ecs.syr.edu/faculty/yin/Teaching/TC2010/Proj4.pdf
https://wiki.aalto.fi/download/attachments/41747647/qemu.pdf

Image processing libraries [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I recently came back to image processing. Most of what I used previously was Matlab. I'd like to switch to a more convenient and open language.
After having used Python library PIL and bitterly understood it had, built-in, only 3x3 and 5x5 filter kernels, I decided to ask here if someone knows of good image processing libraries.
What are the existing image processing libraries (any language) ?
Are they fast / mature / still in early phase ?
OpenCV is a very fast and mature one in C. The bad side is it is not object oriented, which is not one of your criterias I presume. Lots of functionality like connected component analysis are included.
JAI (Java Advanced Imaging) is fast and very mature and it is also object oriented. It may take a little bit to warm up with this library. But powerful and manageable.
If you are planning to make some academic research or prototyping go for OpenCV, if your aim is to develop a commercial or a large scale software, I recommend JAI.
UPDATE
OpenCV now has C++ and Python APIs. I have been using OpenCV C++ for 3 weeks now, the API is way better than C API. OpenCV is more stable, and community has grown. And there are lots of ready to use advanced algorithms in OpenCV. It is worth considering.
I'm surprised no one mentioned ImageMagick. It is a very popular open source image processing library and they have bindings for practically any language.
Check out the python Scipy library. It's an open source fast n-dimensional array manipulation library in python. It has all the basic image processing tools:
linear and rank filters
FFT, convolution
morphological operation
It doesn't have all the more advanced functions of Matlab's Image Processing Toolbox. However, as Vereb suggested, a lot of those can be found in ITK (also available in python flavor).
Like you I wanted to get away from matlab to a dynamic language like python. And like you, I was disappointed by PIL, when I realized it was just an ImageMagick in python. You'll still need to use PIL for reading/writing images.
To get a Matlab-like image processing experience with python get Numpy/Scipy, Matplotlib and Spyder. All of which and more is conveniently packaged in Python(X,Y) for windows only.
Intel Performance Primitives is very fast and very mature. Most of the functionality is low-level, ranging from linear filters, arithmetic operations, FFT, wavelets, geometric transforms (...), but it also contains a few high-level algorithms e.g. for inpainting or segmentation. It's extremely fast, and well documented. I would definitely recommend it for commercial development (not sure if there are open-source licenses).
As far as I know ITK is used for medical imaging:
http://www.itk.org
OpenCV has python bindings http://opencv.willowgarage.com - like Vereb mentioned, ITK is also top notch.
As somebody has mentioned, you could use ITK, which could be used with VTK as a visualization toolkit. The only problem you will find is they are not very easy to build if you are going to use their python wrappers (and even more difficult if you try to build the third-party open source project wrapITK).
But you could use python(x,y), which comes with all these tools (and a lot more) running out-of-the-box and in python:
http://www.pythonxy.com
Hope it helps.
Fastest and most professional image processing library (and complete SDK) is HALCON. (www.mvtec.com) It is not open source but fully supports C#, C++, C, VB.Net etc...
GDAL serves as a mature proxy for different image formats. Bindings for several languages, including Python

How to design extensible software (plugin architecture)? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I need some resources that talk about how to design your software to be extensible, i.e. so that other people can write add-ons/plug-ins that adds functionality to it.
What do you recommend? Any books out there that discuss the subject?
I would prefer something that's short and to the point; a bit of theory and a bunch of concrete examples.
I'm not targeting a specific language, I want to be able to understand the core idea so that I can implement it in any language.
And for the same reason, I prefer not to do it using a framework that someone else built (unless the framework is not very high-level, i.e. doesn't hide too much), at the moment I only want to educate myself on the subject and experiment with various ways to implement it. Plus, a framework usually assumes user's knowledge about the subject.
UPDATE
I'm not asking about OOP or allowing my classes to be inherited. I'm talking about designing an application that will be deployed on a system, such that it can be extended by third-party add-ons AFTER its been deployed.
For example, Notepad++ has a plug-in architecture where you can place a .dll file in the plugins folder, and it adds functionality to the application that wasn't there, such as color-picking, or snippet insertion, or many other things (a wide range of functionality).
IF we're talking .NET, try Scripting .NET applications with VBScript over on CodeProject. Lots of concrete examples there.
Below are sites implementing various application extension techniques
ClearScript - Makes V8, VBScript and JScript available to .NET apps
CS-Script - The C# Script Engine
Plugin Architecture using C#
Opinio plugin architecture
Notes on the Eclipse Plug-in Architecture
Plug-in Architecture Framework for Beginners
Gecko plugin architecture
Fungimol plugin architecture
OSGI is a good practical example of a technical framework allowing to do what you are after.
The theory is here.
The (free!) book is there.
Extensibility and the ability to write plugin must deal with service lifecycle
adding / removing service/plugin on the spot
managing dependencies between services
managing states of services (declared, installed, started, stopped,...)
What is OSGI for ?
One of the main functions of a module is as a unit of deployment… something that we can either build or download and install to extend the functionality of our application.
You will find a good introduction here, on the central notion of service (which is related to your question, and which explain some problems around services, key component for extensibility).
Extract:
Why are services then so important if so many applications can be built without them? Well, services are the best known way to decouple software components from each other.
One of the most important aspects of services is that they significantly minimize class loading problems because they work with instances of objects, not with class names. Instances that are created by the provider, not the consumer. The reduction of the complexity is quite surprising
Not only do services minimize configuration, they also significantly reduce the number of shared packages.
Implement SOLID principles in your application.
1. Single responsibility principle: A class should have only a single responsibility (i.e. only one potential change in the software's specification should be able to affect the specification of the class
2.Open/closed principle: Software entities … should be open for extension, but closed for modification
3. Liskov substitution principle: Objects in a program should be replaceable with instances of their subtypes without altering the correctness of that program
4. Interface segregation principle: Many client-specific interfaces are better than one general-purpose interface
5. Dependency inversion principle: One should Depend upon Abstractions. Do not depend upon concretions
Stackoverflow questions:
Example of Single Responsibility Principle
Is the Open/Closed Principle a good idea?
What is the Liskov Substitution Principle?
Interface Segregation Principle- Program to an interface
What is the Dependency Inversion Principle and why is it important?
You try to reach two competing goals:
The components of your software must expose a lot of themselves, so they can be reused
The components of your software must expose very little of themselves, so they can be reused
Explanation: To encourage code reuse, you should be able to extend existing classes and call their methods. This isn't possible when the methods are declared "private" and the classes are "final" (and can't be extended). So to meet this goal, everything should be public and accessible. No private data or methods.
When you release the second version of your software, you will find that many of the ideas of version 1 were plain wrong. You need to change many interfaces or your code, method names, delete methods, break the API. If you do this, many people will turn away. So in order to be able to evolve your software, the components must not expose anything that is not absolutely necessary - at the cost of code reuse.
Example: I wanted to observe the position of the cursor (caret) in an SWT StyledText. The caret is not meant to be extended. If you do it, you'll find that the code contains checks like "is this class in the package org.eclipse.swt" and a lot of methods are private and final and whatnot. I had to copy about 28 classes out of SWT into my project just to implement this feature because everything is locked down.
SWT is a nice framework to use and hell to extend.
Of course there is the famous Open Closed Principle - http://en.wikipedia.org/wiki/Open/closed_principle
Well it depends on the language.
In C/C++ I'm pretty sure there is a loadlibrary function that allows you to open a library at runtime and invoke it's exported functions. This is typically how it's done in C/C++.
In .NET, there is Reflection, which is offers similar (but more broad) to loadlibrary. There is also entire libraries built on Reflection like Managed Extension Framework, or Mono.Addins that does most of the heavy lifting for you already.
In Java, there is also Reflection. And there is the JPF (Java Plugin Framework) which is used in stuff like Eclipse IIRC.
Depending on what language you use I could recommend some tutorial/books. I hope this was helpful.
Plugin architecture is becoming very popular for its extensibility and thus flexibility.
For c++, Apache httpd server is actually plugin based, but a concept of module is used instead. Most of apache features are implemented as modules, like cache, rewrite, load balancing, and even threading model. It is a very modular software I ever saw.
And for java, Eclipse is definitely plugin based. The core of Eclipse is an OSGI module system which manage bundles, another concept for plugin. Bundle can provide extension points on which we can build modules with less efforts. The most intricate thing in OSGI is its dynamic characteristic, which means bundles can be installed or uninstalled at runtime. No stop-the-world syndrome any more!
Since I dont have enough rep points to leave a comment, I am posting this as an answer. SharpDevelop is an IDE for developing applications in C#/VB.NET/Boo. It has a pretty impressive architecture that allows itself to be extended in a number of ways - right from new menu items to development support for whole new languages.
It uses a bit of XML configuration to act as a glue layer between a core of the IDE and the plugin implementation. It handles locating, loading and versioning of plugins out of the box. Deploying new plugins is matter of simply copying in the new xml configuration file and the required assemblies (DLLs) and restarting the application. You can read more on this in the book "Dissecting a csharp application" by the original author(s) - Christian Holm, Mike Krüger, Bernhard Spuida of the application from here. The book doesnt seem to be available on that site, but i found a copy that might still be around here
Also found a related question here
Checkout "CAB" - Microsoft's Composition Application Building blocks Framework. I think they've got a "web version" of that too...
I have just started to develop a smart client application. These are two options I am considering.
Using Microsoft's System.AddIn namespace. Looks very promising, however it may be a little complex for our end solution.
Or the Smart Client - Composite UI Application Block from Microsoft
Recently, i have looked at taking components both the Composite UI Application Block and the System.AddIn namespace to build my own. Since source code is available for the CAB it is easy to extend. I think our end solution will be a light weight version of the CAB, definatly using the Unity Application Block
If you work with .Net, our research yielded two approaches: scripting and composition.
Scripting
You extend the functionality of what your classes can do by orchestrating them using scripts. That means exposing what is compiled in your favorite .Net language in a dynamic language.
Some options we found worth exploring:
IronPython
IronRuby
JavaScript: Jint, Jurassic and JavaScript .Net are good starting points.
Script.Net -> this one was the first one to call our attention.
Composition
If you start a project with .Net 4 or above, you must take a good look at the Managed Extensibility Framework (MEF). It allows you to extend the functionality of your apps in a plugin way.
The Managed Extensibility Framework (MEF) is a composition layer for
.NET that improves the flexibility, maintainability and testability of
large applications. MEF can be used for third-party plugin
extensibility, or it can bring the benefits of a loosely-coupled
plugin-like architecture to regular applications.
Managed Add-in Framework is also a good read.
MSDN: http://msdn.microsoft.com/en-us/library/dd460648.aspx
Codeplex: http://mef.codeplex.com/
Rather than re-inventing the wheel, use the frameworks in hand. Eclipse and Netbeans both support plugin based extensions. You have to work in Java though.