Skip to content

OpenHardware-Initiative/UPMEM-MLP

Repository files navigation

UPMEM-MLP

UPMEM-MLP implements a multilayer perceptron training application in C and accelerates this application on the UPMEM platform.

Unit Tests Memory Leak Tests

Prerequisites

  • CMake 3.10 or higher
  • GCC
  • Python
  • UPMEM SDK
Installing UPMEM SDK
  1. Download UPMEM SDK tarball for your system from this link

NOTICE: UPMEM SDK is no longer downloadable on UPMEM's official SDK Downloads page.

  1. Extract its content and (preferably) move it to a better place like /usr/local/bin/

  2. Add the shell script upmem_env.sh, which sets necessary environment variables, to be sourced into your .bashrc:

source /usr/local/bin/upmem-sdk/upmem_env.sh simulator > /dev/null
  1. Restart your shell session for the changes to become effective

  2. Test your setup:

which dpu-lldb

Getting Started

  1. Clone this repository and navigate inside it:
git clone https://github.com/OpenHardware-Initiative/UPMEM-MLP.git
cd UPMEM-MLP
  1. (Optional, but recommended) Create a Python virtual environment:
python3 -m venv venv
source venv/bin/activate
  1. Install Python requirements:
pip install -r requirements.txt
  1. Extract training samples & labels:
python3 read_dataset.py
  1. Compile the MLP:
make
  1. Run the MLP:
./build/mlp

With this command, you can use:

  • BATCH_SIZE=... to configure the batch size used during training, which otherwise defaults to 20
  • MAX_EPOCH=... to configure the maximum number of epochs the training can run for, which otherwise defaults to 10
  • NUM_TRAIN_SAMPLES=... to configure from the command line how many samples the model should be trained with, which otherwise defaults to 200
  • UPMEM=0 to turn off matrix multiplication on UPMEM
  • SAN=1 to run the MLP with GCC sanitizer
  • EVAL=1 to run the MLP in evaluation mode, which adds to the printout how many cycles are spent in training

Running the Unit Tests

UPMEM-MLP comes with unit tests, which can be found in tests/. Run these unit tests using:

mkdir build
cd build
cmake ..
make
make test

Status

UPMEM-MLP is completed and being actively maintained as of 2025-11-23.

License

UPMEM-MLP is licensed under the Apache License v2.0. See LICENSE for more details.


About

Multilayer perceptron in pure C enhanced with UPMEM PIM-based training

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published