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.