Using CUDA Kernels - cuda

I'm interested in using CUSP library for CUDA (available here). However, I'm either having trouble getting this library to work with my application linking with CUDA and/or CUBLAS static libraries. I'm assuming from glancing through the header and source files that I either use the kernels by building the related files as a static library file (using nvcc compiler) to be used in my application (which is built using MS Visual Studio compiler), or use the kernels directly in my application (which I don't know how it's going to work out). The CUSP library also uses METIS library as well, which I also have trouble figuring out how to install it in Windows. What would be your suggestions on the best way of using CUSP features in my application? Thanks in advance.

After a quick look through the CUSP source, it seems that CUSP follows the same model as (and even makes use of) Thrust. These are template-based libraries that only make use of header files (with some #included inline code), like most of the STL and boost libraries. Take dia_matrix.h for example. The 'implementation' is in dia_matrix.inl, which is #included at the bottom of dia_matrix.h.
Take a look at the Thrust and CUSP examples for how to use these libraries in your own code. It should be nothing more than a matter of including the correct header files and working with the data types they provide. The CUDA kernels will be generated at compile time for you and you shouldn't need to worry about those details.

Related

Installing CUB in nvidia nsight

I want to use CUB with NVIDIA Nsight. I looked for tutorials on the internet for doing that, but I didn't find anything, even in the official pages pf CUB.
What do I need to do in order to use CUB in code I write using NVIDIA Nsight?
There is no need to do any installation since the CUB library is implemented as C++ headers check it in the section number 6 in this page here. The only thing you need to is to add the path of the library to the includes of the projects as follow:
right click on your project go to properties, after that go to C/C++ general then click on Paths and symbols. in the Includes tab ( the first tab) you add the path of your library that's all.

How do you use existing C libraries with the Chrome Native Client?

I'm new to Chrome Application development and the Native Client/PNaCL pipeline. I'm a bit confused over the process of using existing C code/libraries in a chrome application. The FAQs and NaCL official docs suggest that using existing code is easy, and one of the advantages of developing Chrome applications.
However, there is also mention of nacl-ports, an official list of ported C libraries to be used in Native Client apps.
If I have some random C library I've used, what is the process for actually using it in my Chrome application? This question feels silly, but I'm quite confused over the process. Do I have to recompile the source with a NaCL compiler? Where in the SDK can I find this?
The FAQ also mentions that things like forks, file i/o is not allowed in the library, so I will have to rewrite any code that does these things, is that correct?
Bottomline: I have an existing C library. What is the process for using it correctly, and making calls to it, in a Chrome application?
The short answer is that you'll have to recompile your library with a NaCl C compiler.
You may want to take a look at naclports: this repository contains ports of many common C libraries to Native Client. You can browse the source more easily here.
As for File I/O, we often suggest using the nacl_io library when porting existing code. This provides a POSIX interface (e.g. fopen/fclose/fread, etc.) Many ported libraries require no modifications when using nacl_io.

Should we place C code in Static library or Runtime component?

We're moving to Windows Phone 8. But since many good libraries out there are in pure C. So what is the best way for Windows Phone C# application to consume this C library?
Place C code in WP Static library. Then reference it from WP Runtime
component
Place C code in WP Runtime component
What is the best practice ?
There isn't any real difference between the two approaches. A static library is nothing but a collection of .obj files, the exact same kind of .obj files that you'll get from approach #2. After the linker is done, there won't be any difference in the result.
That's when everything is perfect, an ideal that can be very difficult to achieve when you use open source C code. An advantage of a static .lib is that it improves build time, not having to re-generate the .obj files. But that's also their disadvantage, you'll shoot your foot if you use a .lib that was created by somebody else and he didn't use the same compiler version or compile options. The simplest example of such a trap is building your Debug version and the .lib was built for Release. Or if it uses winapi functions that are verboten in a Phone app, pretty common. So #3 is the best way to avoid problems, build the .lib yourself so you can control all the compile and link settings. Do beware however that it can be very difficult to get open source C code to build, it often comes with a very extensive configuration script, designed to deal with the differences between the many architecture and Unix variants.

Utilizing amazon gpu cluster in web app

Does anyone have any experience plugging into an Amazon gpu cluster in a web app? Is it even possible? I want to make an online interface to a simulator I have written in cuda, but everything I have seen so far involves ssh and the command line.
Yes, this is very possible!
You may want to consider binding your CUDA C code (I'm just assuming C) to your preferred scripting language for better efficiency if you intend to build the front end logic not in a lower level programming language but absolutely this is possible.
Keep in mind, many web developers build their apps strictly from the command line, you simply need to find an effective and efficient way of calling the CUDA code from your Web app and then simply return the results to the client who made the request.

How to generate SWF from FLA using command line on Ubuntu Server?

I have a situation where I need to generate SWF from the FLA that user uploads on to the server. We use python and bash scripts, and work on Ubuntu Server 10.04 (64bit), any help on how to generate the SWF would be a great help.
Thanks.
Flash needs Flash IDE for compilation.
You probably can compile code using flex AS3 compiler on linux, but if there are graphical elements in Flash, you cannot compile them.
However, we had a similar situation, which we fixed by installing Flash in a MAC OS X Snow Leopard(10.6) and then wrote some php, some shell script, some applescript and made a command line compilation mechanism for AS3.
Mac OS X is a unix based os, so the command line is similar to any other unix. it comes with built in php, so you don't have to install anything.
Basically using script we dynamically generate something called .jsfl file. the jsfl contains the details of the .fla that needs to be compiled. these jsfl files can be executed by Flash IDE. so we invoke the flash IDE and pass on the generated .jsfl file. (http://gskinner.com/blog/archives/2004/08/jsfl_fla_batch.html)
This gskinner process works in windows also, but using mac we can make it command line. so that users can just ssh to the mac and execute the command to build the file.
FLA file format has changed significantly in the latest version of Flash. New FLAs are archives containing source files and assets, so you might be able to write a script unpacking a FLA and assembling an SWF from it. Prior versions of FLA contained proprietary format, not documented and there were no tools to process it in an automatic fashion, not on Linux for certain.
Depending on ActionScript version and your requirement to resource handling (by resources I mean images, fonts, sound tracks, videos etc) there are several options available:
Flex SDK, the material found in the blog post #ntidote refers to is somewhat dated, but it's OK / should work. You would need to consult MXMLC usage documentation to find out all available options (and some new required ones, not covered in the blog post). This is what you can do, if your goal is to compile AS3. This does not include video transcoding and you might find it challenging to embed vector graphics. MXMLC is, however, capable of compiling a large subset of SVG. It can also compile FXG - a new interchange graphic format that can describe vector shapes and text.
ActionScript 2 can also be compiled, but Flex doesn't offer a compiler for that. There is a very good, in fact a much better than the one written by Adobe, compiler for AS2: http://tech.motion-twin.com/mtasc.html .
There are other tools that are capable of generating SWFs - all depends on what exactly you need to do. Here's a good collection of different utilities: http://www.swftools.org/
Haxe is a whole other programming language that can compile to SWF. It also has its own linkers and ways of managing resources. http://haxe.org/
There is this project, which allows you to compile complex vector graphics and even animations from XML descriptions: http://code.google.com/p/hxswfml/