Skip to content

Java/Scala

The manager offers a quite simple Java API that enables a user to create tasks to be executed on an FPGA device. The API calls can be grouped into two major categories: Memory and Request.

You can find the complete API documentation here

Memory Calls-

Memory calls are responsible for allocating and freeing memory for buffers. They can be used to allocate and free memory on the FPGA device.

To make things easier we have incorporated SharedAbstractMatrix and SharedAbstractVector classes that are basically backed up by a Java Mapped ByteBuffer. The list of supported types is as follows:

Class Used for elements of type Package
SharedByteMatrix byte com.inaccel.coral.shm
SharedDoubleMatrix double com.inaccel.coral.shm
SharedFloatMatrix float com.inaccel.coral.shm
SharedIntMatrix int com.inaccel.coral.shm
SharedLongMatrix long com.inaccel.coral.shm
SharedShortMatrix short com.inaccel.coral.shm
SharedByteVector byte com.inaccel.coral.shm
SharedDoubleVector double com.inaccel.coral.shm
SharedFloatVector float com.inaccel.coral.shm
SharedIntVector int com.inaccel.coral.shm
SharedLongVector long com.inaccel.coral.shm
SharedShortVector short com.inaccel.coral.shm

Request Calls-

Class Package
InAccel com.inaccel.coral

Compilation-

Coral API Java/Scala artifacts are hosted in InAccel Repository.

<repository>
    <id>inaccel</id>
    <name>InAccel Repository</name>
    <url>http://jfrog.inaccel.com/artifactory/libs-release</url>
</repository>

You can add a Maven dependency with the following coordinates:

<dependency>
    <groupId>com.inaccel</groupId>
    <artifactId>coral-api</artifactId>
    <version>1.3</version>
</dependency>

To compile your applications you need to resolve coral-api dependency. For that reason you should include in the classpath the coral-api.jar

Below you can see an example of compiling the above VaddExample.java application:

$ javac -cp .:/path/to/coral-api.jar VaddExample.java

To run an application using manager's Java API make sure you have first pulled and started InAccel Coral docker.