Skip to main content

Hello NEAT!

Minimal Example

This guide uses a minimal example to verify that NEAT is installed and runnable, while introducing the core application development and validation workflow.

NEAT eLxr SDK Prerequisite

To run commands on the DevKit directly from inside the SDK (for example, dk build/sima_neat_hello or dk hello_neat.py), set up DevKit pairing first:

sima-cli sdk setup --devkit <devkit-ip>

If SDK/DevKit pairing is not configured, you can still build inside the NEAT eLxr SDK, but you must manually transfer the built binary or script to the DevKit and run it there.

tip
About dk / devkit-run

dk (alias for devkit-run) is a shell function in the SDK container, defined in ~/devkit-sync.rc and loaded by ~/.bashrc.

Because it is a shell function, commands such as which devkit-run may return nothing in the SDK shell. Use dk <file> to execute a built binary or Python entry-point file on the paired DevKit.

Create a working directory with the following files:

CMakeLists.txt:

cmake_minimum_required(VERSION 3.16)
project(sima_neat_hello LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

# Supports both:
# - DevKit/native installs (system paths)
# - Cross builds with SYSROOT exported (SDK sysroot paths)
if(DEFINED ENV{SYSROOT} AND NOT "$ENV{SYSROOT}" STREQUAL "")
list(APPEND CMAKE_PREFIX_PATH
"$ENV{SYSROOT}/usr"
"$ENV{SYSROOT}/usr/lib"
"$ENV{SYSROOT}/usr/lib/aarch64-linux-gnu"
)
endif()

find_package(SimaNeat REQUIRED CONFIG)

add_executable(sima_neat_hello main.cpp)
target_link_libraries(sima_neat_hello PRIVATE SimaNeat::sima_neat)

main.cpp:

#include <iostream>
#include <pipeline/TensorCore.h>

int main() {
auto storage = simaai::neat::make_cpu_owned_storage(64);
if (!storage) {
std::cerr << "Failed to allocate CPU tensor storage\n";
return 1;
}
std::cout << "Hello from sima-neat\n";
return 0;
}

Build the example:

cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build -j

Run:

DevKit

./build/sima_neat_hello

NEAT eLxr SDK

dk build/sima_neat_hello

hello_neat.py:

from pyneat import DeviceType

def main():
print("Hello from sima-neat")
print("DeviceType.CPU =", DeviceType.CPU)

if __name__ == "__main__":
main()

Run:

DevKit

source ~/pyneat/bin/activate
python3 hello_neat.py

NEAT eLxr SDK

dk hello_neat.py
Python Runtime Location

pyneat is installed on the DevKit runtime side, even if you run the NEAT installer from inside the NEAT eLxr SDK container.

When you run dk hello_neat.py, dk executes the script on the paired DevKit using the DevKit pyneat environment.

Next Steps

Once this minimal example works, continue with broader SiMa NEAT learning resources: