ctuning / ck-armnn

Collective Knowledge workflows for ArmNN
BSD 3-Clause "New" or "Revised" License
7 stars 10 forks source link

Implement ArmNN MNIST example #2

Closed psyhtest closed 5 years ago

psyhtest commented 5 years ago

Once we can configure ArmNN with TensorFlow and have a basic test, we should implement a more comprehensive test following the tutorial.

psyhtest commented 5 years ago

Suppose we call this test ck-armnn:program:mnist-armnn-tensorflow. It will have a dependency on ArmNN with tags lib,armnn,tensorflow. Then:

$ ck compile program:mnist-armnn-tensorflow

should do the equivalent of:

$ g++ -std=c++11 -I$(ARMNN_INC) mnist.cpp -o mnist -L$(ARMNN_LIB) -larmnn -larmnnTfParser
psyhtest commented 5 years ago

Furthermore, we enable execution via:

$ ck run program:mnist-armnn-tensorflow --env.CK_ARMNN_BACKEND=<backend>

where <backend> is one of:

The choice of <backend> should be propagated to the call to armnn::Optimize:

    // Optimize the network for a specific runtime compute device, e.g. CpuAcc, GpuAcc
    armnn::IRuntime::CreationOptions options;
    armnn::IRuntimePtr runtime = armnn::IRuntime::Create(options);
    armnn::IOptimizedNetworkPtr optNet = armnn::Optimize(*network, {armnn::Compute::CpuRef}, runtime->GetDeviceSpec());

The program can be linked against ArmNN configured with different backend support: reference, Neon, OpenCL, Neon + OpenCL.

If an invalid backend is given (e.g. backend=GpuAcc and ArmNN was built without OpenCL support), either an error should happen or at least a warning given.

psyhtest commented 5 years ago

@bellycat77 Many thanks for creating the program. Please also copy LICENSE and create a simple README.me in the program's directory describing how to compile and run it (including the environment variables).

psyhtest commented 5 years ago

@ens-lg4 To create automated Travis tests, do we need to move this repository to github.com/ctuning first (and make it public then)?

bellycat77 commented 5 years ago

Files LICENSE and README.md were added

ens-lg4 commented 5 years ago

@psyhtest Not necessarily, but Travis seems to provide free testing only for open-source. So there is still an option to auto-test private repositories, but at cost.

ens-lg4 commented 5 years ago

The interface has changed to --env.USE_NEON and --env.USE_OPENCL , otherwise it works fine.