JCuda

Utilities



This page contains utility libraries that are not part of the core JCuda API.


General JCuda utilities
jcudaUtils-0.0.4.jar
This archive contains some utility classes for JCuda, together with the source code and the API documentation.

One of these classes is the "KernelLauncher" class, which simplifies the setup and launching of kernels using the JCuda Driver API. It allows creating PTX files from inlined source code that is given as a String or from existing CUDA source files. PTX- or CUBIN files can be loaded and the kernels can be called more conveniently due to automatic setup of the kernel arguments.

With the KernelLauncher, calling a kernel function is almost as simple as with the CUDA Runtime API: A kernel call like

    kernel<<<gridDim, blockDim>>>(arg0, arg1);

may be executed with the KernelLauncher by calling

    kernelLauncher.setup(gridDim, blockDim).call(arg0, arg1);

The KernelLauncher will automatically set up the configuration parameters and arguments for the kernel call, taking into account the alingment requirements for the given parameters.

Here is an example showing how the KernelLauncher may be used to execute a kernel that was compiled from inlined source code.


Additionally, the archive contains some classes that offer functionalities which are similar to the "CUTIL" functions of the NVIDIA CUDA SDK, such as
  • Parsing command line arguments
  • Comparing arrays
  • Simple file I/O
  • Timer functions

These classes are mainly intended for simplifying the process of porting the existing NVIDIA CUDA code samples to Java. They may also be helpful for debugging or creating unit tests.



JCuda Vector utilities
jcuda-vec-0.0.1.jar
jcuda-vec-0.0.1-sources.jar
jcuda-vec-0.0.1-javadoc.jar
These archives contain utility classes for vector operations with JCuda, including the source code and the API documentation.

This library is now also hosted at GitHub: https://github.com/jcuda/jcuda-vec

The classes in this package offer methods that allow general, low-level operations to be performed on vectors, for example
  • Arithmetic operations between vectors or vectors and scalars
  • Comparison operations between vectors or vectors and scalars
  • The built-in CUDA math functions (e.g. trigonometric functions)

These methods can be used to perform custom operations on vectors of data that may be used together with other runtime libraries like JCublas or JCufft, without having to create own kernels. The kernels for these operations are contained in the JAR file, for single- and double precision computations on 32- or 64bit systems.

This example shows the usage of the JCudaVec library.

Future versions of this library will also include scan- and reduction operations and thus further reduce the necessity to write custom kernels.