From 448e9504fbd7f93346c1f56b70d4851dd8dfa10a Mon Sep 17 00:00:00 2001 From: Manu Seth Date: Fri, 12 Jul 2019 16:17:05 -0700 Subject: [PATCH] adding example to test accelerator loading --- example/accel_api/Makefile | 5 +++++ example/accel_api/myacc.cpp | 6 ++++++ example/accel_api/test.py | 6 ++++++ 3 files changed, 17 insertions(+) create mode 100644 example/accel_api/Makefile create mode 100644 example/accel_api/myacc.cpp create mode 100644 example/accel_api/test.py diff --git a/example/accel_api/Makefile b/example/accel_api/Makefile new file mode 100644 index 000000000000..1a265f482f92 --- /dev/null +++ b/example/accel_api/Makefile @@ -0,0 +1,5 @@ +all: + g++ -shared -fPIC myacc.cpp -o libmyacc.so -I ../../include/mxnet + +clean: + rm -rf libmyacc.so diff --git a/example/accel_api/myacc.cpp b/example/accel_api/myacc.cpp new file mode 100644 index 000000000000..ef373dfa348e --- /dev/null +++ b/example/accel_api/myacc.cpp @@ -0,0 +1,6 @@ +#include + +std::string getAccName() { + return std::string("myacc"); +} + diff --git a/example/accel_api/test.py b/example/accel_api/test.py new file mode 100644 index 000000000000..155ee26dee53 --- /dev/null +++ b/example/accel_api/test.py @@ -0,0 +1,6 @@ +import mxnet as mx + +ctx = mx.context.load_acc('libmyacc.so') +print(ctx) + +mx.nd.empty(4,ctx=ctx)