This guide will walk you through the complete process of installing the Brane SDK and setting up your first project. By following these steps, you’ll create a properly configured development environment for heterogeneous computing applications that can target CPUs, GPUs, FPGAs, and specialized accelerators.
Prerequisites #
The Brane SDK requires several foundational components to function properly. Let’s install each of these prerequisites systematically. Begin by installing these essential components:
Dependency | Description | Installation Guide |
---|---|---|
Java (17+) | Required for running the SDK | Install Java |
Groovy | Scripting language used by Gradle | Install Groovy |
Gradle | Build automation tool that powers the Brane-Builder | Install Gradle |
Depending on which hardware targets you’ll be developing for, install the appropriate drivers and SDKs:
Dependency | Description | Installation Guide |
---|---|---|
C/C++ Compiler | Required for compiling applications | Install GCC or Clang via your system’s package manager |
OpenCL Runtime | GPU and accelerator computing | Provided by GPU vendors |
NVIDIA Drivers & CUDA | NVIDIA GPU acceleration | Install NVIDIA drivers |
AMD Drivers & ROCm | AMD GPU acceleration | Install AMD ROCm |
Kalray Drivers & Runtime | Kalray accelerator support | Contact Kalray for installation details |
Run clinfo
, nvidia-smi
, rocminfo
, etc. to verify OpenCL installation. The Brane SDK includes built-in dependency validation that will automatically report any missing or misconfigured components during initialization, helping you troubleshoot your setup.
Setting Up Your Development Environment #
The Brane SDK works with various development environments, but we recommend IntelliJ IDEA Ultimate for the best experience.
Installing IntelliJ IDEA #
- Download IntelliJ IDEA Ultimate from JetBrains’ website
- Install the IDE following the official installation guide for your operating system
- Verify Gradle plugin activation by navigating to:
- Windows/Linux: File > Settings > Plugins
- macOS: IntelliJ IDEA > Preferences > Plugins
Alternative Development Environments #
If you prefer not to use IntelliJ IDEA, the Brane SDK works with any of these alternatives:
- Other IDEs with Gradle support:
- Eclipse with Buildship plugin
- Visual Studio Code with Gradle extensions
- CLion with Gradle integration
- Command-line development:
- Use any text editor combined with Gradle commands in a terminal
- All Brane SDK functionality is accessible through Gradle tasks
Creating Your First Brane SDK Project #
Let’s create a basic project structure that follows Brane SDK conventions.
Basic Project Layout #
A typical Brane SDK project follows this hierarchical structure:
MyProject/
├── build.gradle # Root build file
├── settings.gradle # Project settings
├── gradle.properties # Gradle and AWS credentials
├── gradlew # Gradle wrapper script
├── gradlew.bat # Gradle wrapper for Windows
└── modules/
└── hello-world/ # Sample application module
├── build.gradle # Module configuration
└── src/
└── main/
├── c/ # C source files
└── cpp/ # C++ source files
This organization allows for clean separation of concerns while enabling unified building across the entire project.
Configuration Files #
Three key configuration files control your Brane SDK project:
1. Root build.gradle
The root build.gradle
file configures access to the Brane plugin repository and establishes project-wide settings. Here’s a comprehensive example with annotations:
// Configure build script repositories and dependencies
buildscript {
repositories {
// Brane plugin repository (requires AWS credentials)
maven {
url "s3://com.brane.repository.maven/release/"
credentials(AwsCredentials) {
// AWS credentials can be provided as environment variables or in gradle.properties
accessKey = System.getenv('AWS_ACCESS_KEY_ID') ?: findProperty('aws_access_key_id')
secretKey = System.getenv('AWS_SECRET_ACCESS_KEY') ?: findProperty('aws_secret_access_key')
}
}
// Public repositories for additional dependencies
mavenCentral()
jcenter()
}
// Required dependencies for the build process
dependencies {
// Brane-Builder plugin - core of the SDK
classpath 'com.brane.plugins:brane-builder:2.0.1'
// Apache Velocity for template processing
classpath 'org.apache.velocity:velocity:1.7'
// Add any additional build-time dependencies here
}
}
// Common configurations that apply to all projects
allprojects {
repositories {
mavenCentral()
}
}
2. Root settings.gradle
The settings.gradle
file defines your project’s name and the modules to include in the build. This file controls which parts of your project are compiled:
// Set the root project name - this will be displayed in IDEs
rootProject.name = 'DevToolkit'
// Include application modules to be built
// Format: 'Parent:Category:Platform:ModuleName'
include 'DevToolkit:demo:arria10:BitcoinMiner' // FPGA Bitcoin mining example
include 'DevToolkit:demo:coolidge:CLDeviceTester' // Kalray Coolidge platform example
include 'DevToolkit:examples:generic:HelloWorld' // Cross-platform example
The include paths follow a hierarchical structure that helps organize modules logically. This structure is especially useful for large projects with many modules targeting different platforms.
3. Module-specific build.gradle
Each application module needs its own build.gradle
file specifying target platforms, dependencies, and compilation options. Here’s an annotated example:
// Apply the appropriate Brane plugins based on target platform
plugins {
id 'com.brane.coolidge.cpp' // Kalray Coolidge platform plugin
}
// Configure the application build settings
application {
// Define target architectures for this module
targetMachines = [
machines.linux.x86_64, // Standard x86_64 Linux host
coolidgeMachines.clusterOS.architecture("MPPA_v2") // Kalray Coolidge Accelerator
]
// Optional: Configure C/C++ compiler options
cppCompiler {
// Enable specific optimizations
optimizationLevel = 3 // -O3 optimization
// Define preprocessor macros
define('DEBUG_LEVEL', '2')
define('ENABLE_FEATURE_X')
}
}
AWS Credentials for Brane Plugin Repository #
The Brane SDK plugin repository is hosted on AWS S3 and requires authentication. You have two options for providing AWS credentials:
- Environment Variables:
- Set
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
in your environment
- Set
- Gradle Properties:
- Create a
gradle.properties
file in your project root or in~/.gradle/
with: propertiesCopyaws_access_key_id=YOUR_ACCESS_KEY aws_secret_access_key=YOUR_SECRET_KEY
- Create a
For security reasons, the gradle.properties
file should not be committed to version control if it contains sensitive information.
Verifying Your Setup #
After configuring your environment and project structure, verify that everything is working correctly:
- Navigate to your project directory in a terminal
- Check for project recognition in IntelliJ (if using):
- Open the project in IntelliJ IDEA
- Verify that Gradle sync completes successfully
- Confirm that modules are recognized in the Project view
If any issues occur, the Brane SDK provides detailed error messages to help diagnose and resolve configuration problems.
Next Steps #
With the Brane SDK installed and your project structure established, you’re ready to develop heterogeneous computing applications. From here, you can:
- Create your first application following the examples in the next section
- Explore platform-specific optimizations for your target hardware
- Learn about advanced build configurations for complex projects
- Integrate existing code into the Brane SDK structure
The following sections of this documentation will guide you through these processes with practical examples and detailed explanations.