Skip to content

Commit

Permalink
[ GPU ] Update android_test.sh to enable unittests for GPU
Browse files Browse the repository at this point in the history
- This commit updates android_test.sh to enable unittests for GPU
- This commit updates `how-to-use-testcases.md` file, including guide
for running test cases for OpenCL on Android.
- This commit remove add kernel from Android.mk in order to make it
enabled (commented out)
- unittest_layers.tar.gz is updated to add nnlayer golden data  for GPU layers.

**Self evaluation**:

1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Eunju Yang <ej.yang@samsung.com>
  • Loading branch information
EunjuYang committed Oct 25, 2024
1 parent 9813029 commit e00d205
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
16 changes: 16 additions & 0 deletions docs/how-to-use-testcases.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,19 @@ $ cd build
$ ninja test
...
```

### run test cases on Android

- In order to run unittest on android, please set the environment following [[docs] how-to-run-example-android.md](how-to-run-example-android.md).
- Then, you can run the unittest on Android as follows:

```
(nntrainer) $ ./tools/android_test.sh
(nntrainer) $ adb shell
(adb) $ cd /data/local/tmp/nntr_android_test
(adb) $ export LD_LIBRARY_PATH=.
(adb) $ ./unittest_layers
```

- For more information, please refer to [tools](../tools/README.md)
- [**Note**] Android unittest script builds NNTrainer to support GPU by default.
Binary file modified packaging/unittest_layers.tar.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion test/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ LOCAL_SRC_FILES := \
../unittest/layers/unittest_layers_flatten.cpp \
../unittest/layers/unittest_layers_activation.cpp \
../unittest/layers/unittest_layers_addition.cpp \
../unittest/layers/unittest_layers_addition_cl.cpp \
../unittest/layers/unittest_layers_multiout.cpp \
../unittest/layers/unittest_layers_rnn.cpp \
../unittest/layers/unittest_layers_rnncell.cpp \
Expand All @@ -476,6 +475,7 @@ LOCAL_SRC_FILES := \
../unittest/layers/unittest_layers_reshape.cpp \
../unittest/layers/unittest_layers_multi_head_attention.cpp \
../unittest/layers/unittest_layers_positional_encoding.cpp \
# ../unittest/layers/unittest_layers_addition_cl.cpp \
LOCAL_C_INCLUDES += $(NNTRAINER_INCLUDES)

Expand Down
8 changes: 6 additions & 2 deletions tools/android_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ if [ $? != 0 ]; then
fi

adb shell mkdir -p /data/local/tmp/nntr_android_test/res
adb shell mkdir -p /data/local/tmp/nntr_android_test/nntrainer_opencl_kernels

adb push . /data/local/tmp/nntr_android_test

Expand All @@ -42,5 +43,8 @@ fi
# The steps are as follows.

# $ meson build [flags...]
# $ cd build
# $ adb push res/ /data/local/tmp/nntr_android_test
# meson build will unzip golden data for the unit tests
cd ../../../
meson build
cd build
adb push res/ /data/local/tmp/nntr_android_test

0 comments on commit e00d205

Please sign in to comment.