#ai #machine-learning #federated-learning #artificial-intelligence #fl

xaynet-mobile

The Xayn Network project is building a privacy layer for machine learning so that AI projects can meet compliance such as GDPR and CCPA. The approach relies on Federated Learning as enabling technology that allows production AI applications to be fully privacy compliant.

1 unstable release

0.1.0 Jan 18, 2021

#7 in #federated-learning


Used in xaynet

Custom license

470KB
8K SLoC

Xaynet FFI

Generate C-Header File

ffi-support provides some helpful macros to reduce boilerplate code. However the feature (--pretty=expanded) to expand these macros during the generation of the C-header file is still unstable. Therefore we need to use the rust nightly.

To generate the header files, install cbindgen and run:

cargo build
RUSTUP_TOOLCHAIN=nightly cbindgen \
    --config cbindgen.toml \
    --crate xaynet-mobile \
    --output xaynet_ffi.h

Run tests

macOS

cc -o tests/ffi_test.o -Wl,-dead_strip -I. tests/ffi_test.c ../target/debug/libxaynet_mobile.a -framework Security -framework Foundation
./tests/ffi_test.o

Linux

gcc \
    tests/ffi_test.c
    -Wall \
    -I. \
    -lpthread -lm -ldl \
    ../target/debug/libxaynet_mobile.a \
    -o tests/ffi_test.o
./tests/ffi_test.o

To check for memory leaks, you can use Valgrind:

valgrind --tool=memcheck  --leak-check=full --show-leak-kinds=all -s ./tests/ffi_test.o

Dependencies

~31MB
~339K SLoC