This commit reconstructs core source directory.
The below is the summary of what's changed.
1. reconstruct src directory (issue #153), like
+-- src/
| +-- host/
| +-- core/
| +-- ne-*.c/ne-*.h
| +-- ip/
| +-- gem/
| +-- npu/
| +-- test/
| +-- unittests/
| +-- apptests/
2. change meson.build scripts to keep the same style.
3. change source file names to have the same prefix.
It resolves #153.
Signed-off-by: Dongju Chae <dongju.chae@samsung.com>
subdir('src')
-comm_opt = get_option('comm_opt')
-
-if comm_opt == 'ip'
- ne_dependencies = [
- npu_engine_dep
- ]
-
- # Build final exported so
- plugin_ip_executable = shared_library('npu-engine',
- dependencies: ne_dependencies,
- install : true,
- install_dir: ne_libdir)
-endif
-
# Set configuration to install .ini
ne_install_conf = configuration_data()
-option('comm_opt', type : 'combo', choices : ['ip', 'fm'], value : 'ip')
+option('comm_opt', type : 'string', value : 'ip')
option('resv_mem_size', type : 'string', value : '512M')
option('working_dir', type : 'string', value : '/tmp/')
option('log_dir', type : 'string', value : '/tmp')
# Perform unit tests
%check
%if 0%{?unit_test}
- pushd build/src/test
+ pushd build/src/test/unittests
find . -maxdepth 1 -type f -perm 0755 -print0 | while IFS= read -r -d $'\0' unittest_exec; do
%if 0%{?use_valgrind}
%ifarch x86_64
%files
%%defattr(-,root,root,-)
%{_libdir}/libnpu-engine.so
+%{_libdir}/libnpu-engine.a
%{_sysconfdir}/npu-engine.ini
%package devel
--- /dev/null
+ne_core_gem_inc = include_directories('.')
+ne_core_gem_src = ['GEMdrvAPI.c']
+ne_core_gem_dep = declare_dependency(
+ sources : ne_core_gem_src,
+ dependencies : [libdrm_dep, ne_core_utils_dep],
+ include_directories : ne_core_gem_inc)
--- /dev/null
+ne_plugin_comm_ip_src = ['plugin-comm-ip.c']
+ne_plugin_comm_dep = declare_dependency(
+ sources : ne_plugin_comm_ip_src,
+ include_directories : [ne_common_inc, ne_host_inc, ne_core_inc])
* Copyright (C) 2019 Parichay Kapoor <pk.kapoor@samsung.com>
*/
/**
- * @file plugin-ip-comm.c
+ * @file plugin-comm-ip.c
* @date 26 Jul 2019
* @brief Implement API to access NPU from Host
* @see http://suprem.sec.samsung.net/confluence/display/ODLC/Software+Stack
+++ /dev/null
-libgem_src = ['GEMdrvAPI.c']
-libgem_inc = include_directories('.')
-libgem_dependencies = [libdrm_dep, libutils_dep]
-
-# Build library (static)
-libgem_build = static_library('gem-core',
- libgem_src,
- dependencies: libgem_dependencies,
- install: false
-)
-
-# Declare dependency for other modules
-libgem_dep = declare_dependency(link_with : libgem_build,
- include_directories : libgem_inc)
+++ /dev/null
-libnpucore_src = ['NPUdrvAPI.c']
-libnpucore_inc = include_directories('.')
-
-# Build library (static)
-libnpucore = static_library('npu-core',
- libnpucore_src,
- include_directories: ne_common_inc,
- dependencies: libutils_dep,
- install : false)
-
-# Declare dependency for other modules
-libnpucore_dep = declare_dependency(link_with : libnpucore,
- include_directories: [ne_common_inc, libnpucore_inc])
+++ /dev/null
-libutils_inc = include_directories('.')
-libutils_src = [
- 'ne-conf.c',
- 'ne-utils.c'
-]
-
-# Build library (static)
-libutils = static_library('libutils',
- libutils_src,
- include_directories: libutils_inc,
- dependencies: iniparser_dep,
- install : false)
-
-# Declare dependency for other modules
-libutils_dep = declare_dependency(link_with : libutils,
- include_directories: libutils_inc)
-subdir('libutils-core')
-subdir('libgem-core')
-subdir('libnpu-core')
-subdir('npu-engine')
+# Headers
+ne_core_inc = include_directories('.')
+
+# Dependencies
+ne_core_dependencies = [
+ libm_dep,
+ thread_dep
+]
+
+# Sources
+ne_core_sources = [
+ 'ne-host-input-service.c',
+ 'ne-handler.c',
+ 'ne-scheduler.c',
+ 'ne-inf.c',
+ 'ne-mem.c'
+]
+
+ne_core_utils_sources = [
+ 'ne-conf.c',
+ 'ne-utils.c',
+]
+
+# Dependency for utils
+ne_core_utils_dep = declare_dependency(
+ sources : ne_core_utils_sources,
+ dependencies : iniparser_dep,
+ include_directories : ne_core_inc
+)
+ne_core_dependencies += [ne_core_utils_dep]
+
+# Dependency for driver APIs
+subdir('npu')
+subdir('gem')
+
+ne_core_dependencies += [ne_core_npu_dep, ne_core_gem_dep]
+
+# Dependency for plugin comm.
+comm_opt = get_option('comm_opt')
+subdir(comm_opt)
+
+ne_core_dependencies += [ne_plugin_comm_dep]
+
+# Declare dependency for npu engine core
+ne_core_dep = declare_dependency(
+ sources : ne_core_sources,
+ dependencies : ne_core_dependencies
+)
+++ /dev/null
-plugin_fm_inc = include_directories('.')
-plugin_fm_sources = ['plugin-fastmodel.c']
-plugin_fm_dep = declare_dependency(
- sources : plugin_fm_sources,
- include_directories : plugin_fm_inc)
+++ /dev/null
-/**
- * Proprietary
- * Copyright (C) 2019 Samsung Electronics
- * Copyright (C) 2019 Dongju Chae <dongju.chae@samsung.com>
- */
-/**
- * @file plugin-fastmodel.c
- * @date 29 Jul 2019
- * @brief NPU Engine's communication plugin for FastModel (N12)
- * @see http://suprem.sec.samsung.net/confluence/display/ODLC/Software+Stack
- * @see http://suprem.sec.samsung.net/confluence/pages/viewpage.action?pageId=128465352
- * @author Dongju Chae <dongju.chae@samsung.com>
- * @bug No known bugs except for NYI items
- */
-
-#include <ne-comm.h>
-#include <ne-mem.h>
-#include <ne-utils.h>
-#include <npubinfmt.h>
-
-#include <pthread.h>
-#include <errno.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <string.h>
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-
-/** @todo change this */
-#define SERVER_FM_ADDR "127.0.0.1"
-#define SERVER_FM_INPUT_PORT 5515
-#define SERVER_FM_OUTPUT_PORT 5516
-
-/** @brief recv/send macros for TCP/IP */
-#define RECV(fd, buf, size) (read(fd, buf, size) == size)
-#define SEND(fd, buf, size) (write(fd, buf, size) == size)
-
-/**
- * @note This retrieves model files and input frames from the host server via a TCP/IP comm.
- * But, actual USB communications will work in the opposite way.
- */
-
-/** @brief command enum */
-typedef enum {
- COMM_NONE = 0,
- COMM_REGISTER,
- COMM_UNREGISTER,
- COMM_NEW_INPUT,
- COMM_SET_OPMODE,
-} n12_command;
-
-/** @brief n12's private data structure */
-typedef struct {
- const hostHandlerInfo *handler;
- int running;
- int sockfd;
- pthread_t comm_thread, output_thread;
- pthread_mutex_t mutex;
-} n12_private;
-
-static n12_private priv;
-
-/** @brief internal thread for sending output data via TCP/IP */
-static void*
-run_output (void *data)
-{
- pthread_mutex_lock (&priv.mutex);
-
- while (priv.running) {
- struct sockaddr_in server_addr;
- int sockfd, err = 0;
- buffer *output_buffer;
- hwmem *output_hwmem;
- void *ptr;
-
- pthread_mutex_unlock (&priv.mutex);
-
- output_buffer = priv.handler->getCurrentOutputBuffer (&err);
- if (err != 0) {
- fprintf (stderr, "Fail to get output buffer (errno: %d)\n", err);
- break;
- }
-
- err = buffer_get_hwmem (output_buffer, &output_hwmem);
- if (err != 0) {
- GET_MEM()->return_buffer (output_buffer);
- fprintf (stderr, "Fail to get hwmem (errno: %d)\n", err);
- break;
- }
-
- err = hwmem_get_data (output_hwmem, &ptr);
- if (err != 0) {
- GET_MEM()->return_buffer (output_buffer);
- fprintf (stderr, "Fail to get data pointer (errno: %d)\n", err);
- break;
- }
-
- if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- GET_MEM()->return_buffer (output_buffer);
- fprintf (stderr, "Fail to create a socket\n");
- break;
- }
-
- memset (&server_addr, '\x00', sizeof (server_addr));
-
- server_addr.sin_family = AF_INET;
- server_addr.sin_port = htons(SERVER_FM_OUTPUT_PORT);
- server_addr.sin_addr.s_addr = inet_addr(SERVER_FM_ADDR);
-
- if (connect (sockfd, (struct sockaddr *) &server_addr, sizeof (server_addr)) < 0) {
- fprintf (stderr, "Fail to connect the server (%s:%d)\n",
- SERVER_FM_ADDR, SERVER_FM_OUTPUT_PORT);
- GET_MEM()->return_buffer (output_buffer);
- close (sockfd);
- break;
- }
-
- if (!SEND (sockfd, ptr, output_hwmem->size)) {
- fprintf (stderr, "Fail to send output data %lu\n", output_hwmem->size);
- GET_MEM()->return_buffer (output_buffer);
- close (sockfd);
- break;
- }
-
- GET_MEM()->return_buffer (output_buffer);
- close (sockfd);
-
- pthread_mutex_lock (&priv.mutex);
- }
- pthread_mutex_unlock (&priv.mutex);
-
- return NULL;
-}
-
-static int
-handle_register (void)
-{
- uint64_t data_size;
- hwmem *hwmem;
- void *ptr;
- int err = 0;
-
- /* recv meta data */
- if (!RECV (priv.sockfd, &data_size, sizeof (data_size))) {
- fprintf (stderr, "Fail to receive data size\n");
- err = -errno;
- goto out;
- }
-
- if (priv.handler->getAvailableModelMemory() < data_size) {
- fprintf (stderr, "No availabl memory size\n");
- err = -ENOMEM;
- goto out;
- }
-
- if ((err = GET_MEM()->alloc (data_size, &hwmem)) != 0) {
- fprintf (stderr, "Fail to allocate memory with size %lu\n", data_size);
- goto out;
- }
-
- if ((err = hwmem_activate (hwmem)) != 0) {
- fprintf (stderr, "Fail to activate hwmem\n");
- goto out_free;
- }
-
- if ((err = hwmem_get_data (hwmem, &ptr)) != 0) {
- fprintf (stderr, "Fail to get data pointer\n");
- goto out_deactivate;
- }
-
- if (!RECV (priv.sockfd, ptr, data_size)) {
- fprintf (stderr, "Fail to receive data\n");
- err = -errno;
- goto out_deactivate;
- }
-
- if ((err = priv.handler->registerModel (hwmem)) != 0) {
- fprintf (stderr, "Fail to registermodel\n");
- goto out_deactivate;
- }
-
- return 0;
-
-out_deactivate:
- hwmem_deactivate (hwmem);
-out_free:
- GET_MEM()->dealloc (hwmem);
-out:
- return err;
-}
-
-static int
-handle_unregister (void)
-{
- uint64_t model_id, model_version;
-
- if (!RECV (priv.sockfd, &model_id, sizeof (model_id))) {
- fprintf (stderr, "Fail to receive model id\n");
- return -errno;
- }
-
- if (!RECV (priv.sockfd, &model_version, sizeof (model_version))) {
- fprintf (stderr, "Fail to receive model version\n");
- return -errno;
- }
-
- return priv.handler->unregisterModel (model_id, model_version);
-}
-
-static int
-handle_new_input (void)
-{
- uint64_t data_size;
- buffer *buffer;
- hwmem *hwmem;
- void *ptr;
- int err = 0;
-
- buffer = priv.handler->getCurrentInputBuffer (&err);
- if (err != 0) {
- fprintf (stderr, "Fail to get input buffer (errno: %d)\n", err);
- goto out;
- }
-
- if ((err = buffer_get_hwmem (buffer, &hwmem)) != 0) {
- GET_MEM()->return_buffer (buffer);
- fprintf (stderr, "Fail to get hwmem (errno: %d)\n", err);
- goto out;
- }
-
- if ((err = hwmem_get_data (hwmem, &ptr)) != 0) {
- GET_MEM()->return_buffer (buffer);
- fprintf (stderr, "Fail to get data pointer (errno: %d)\n", err);
- goto out;
- }
-
- /* recv meta data */
- if (!RECV (priv.sockfd, &data_size, sizeof (data_size))) {
- fprintf (stderr, "Fail to receive data size\n");
- err = -errno;
- goto out;
- }
-
- if (!RECV (priv.sockfd, ptr, data_size)) {
- fprintf (stderr, "Fail to receive input data\n");
- err = -errno;
- goto out;
- }
-
- if ((err = priv.handler->validateBuffer (buffer)) != 0) {
- fprintf (stderr, "Fail to validate buffer\n");
- goto out;
- }
-
- return 0;
-out:
- return err;
-}
-
-static void
-n1_cb (buffer *buf, uint64_t offset, uint64_t size, void *data)
-{
- /** @todo */
-}
-
-static int
-handle_set_opmode (void)
-{
- npu_input_opmode op;
- int force;
- uint64_t model_id, model_version;
-
- if (!RECV (priv.sockfd, &op, sizeof (op))) {
- fprintf (stderr, "Fail to receive npu input opmode\n");
- return -errno;
- }
-
- if (!RECV (priv.sockfd, &force, sizeof (force))) {
- fprintf (stderr, "Fail to receive force variable\n");
- return -errno;
- }
-
- if (!RECV (priv.sockfd, &model_id, sizeof (model_id))) {
- fprintf (stderr, "Fail to receive model id\n");
- return -errno;
- }
-
- if (!RECV (priv.sockfd, &model_version, sizeof (model_version))) {
- fprintf (stderr, "Fail to receive model version\n");
- return -errno;
- }
-
- return priv.handler->setOpMode (op, force, model_id, model_version, n1_cb, NULL /* TBD */);
-}
-
-static void
-raise_error (void)
-{
- pthread_mutex_lock (&priv.mutex);
- priv.running = 0;
- pthread_mutex_unlock (&priv.mutex);
-}
-
-/** @brief internal thread for reading command/input data via TCP/IP */
-static void*
-run_comm (void *data)
-{
- n12_command command;
- int status;
-
- if (pthread_create (&priv.output_thread, NULL, run_output, (void*) NULL) < 0) {
- fprintf (stderr, "Fail to create the internal output thread\n");
- goto out;
- }
-
- pthread_mutex_lock (&priv.mutex);
- while (priv.running) {
- pthread_mutex_unlock (&priv.mutex);
-
- if (!RECV (priv.sockfd, &command, sizeof (n12_command))) {
- fprintf (stderr, "Fail to receive command\n");
- raise_error ();
- break;
- }
-
- switch (command) {
- case COMM_REGISTER:
- if (handle_register () != 0)
- raise_error ();
- break;
- case COMM_UNREGISTER:
- if (handle_unregister () != 0)
- raise_error ();
- break;
- case COMM_NEW_INPUT:
- if (handle_new_input () != 0)
- raise_error ();
- break;
- case COMM_SET_OPMODE:
- if (handle_set_opmode () != 0)
- raise_error ();
- default:
- raise_error ();
- }
-
- pthread_mutex_lock (&priv.mutex);
- }
- pthread_mutex_unlock (&priv.mutex);
-
- pthread_join (priv.output_thread, (void **)&status);
-out:
- close (priv.sockfd);
-
- return NULL;
-}
-
-/** @brief init function for fastmodel plugin */
-int
-initNEcomm (const hostHandlerInfo *hh)
-{
- struct sockaddr_in server_addr;
- int sockfd;
-
- if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
- fprintf (stderr, "Fail to create a socket\n");
- return -errno;
- }
-
- memset (&server_addr, '\x00', sizeof (server_addr));
-
- server_addr.sin_family = AF_INET;
- server_addr.sin_port = htons(SERVER_FM_INPUT_PORT);
- server_addr.sin_addr.s_addr = inet_addr(SERVER_FM_ADDR);
-
- if (connect (sockfd, (struct sockaddr *)&server_addr, sizeof (server_addr)) < 0) {
- fprintf (stderr, "Fail to connect the server (%s:%d)\n",
- SERVER_FM_ADDR, SERVER_FM_INPUT_PORT);
- return -errno;
- }
-
- priv.sockfd = sockfd;
- priv.handler = hh;
- priv.running = 1;
-
- pthread_mutex_init (&priv.mutex, NULL);
-
- if (pthread_create (&priv.comm_thread, NULL, run_comm, (void*) NULL) < 0) {
- fprintf (stderr, "Fail to create the internal thread\n");
- close (sockfd);
- priv.running = 0;
- pthread_mutex_destroy (&priv.mutex);
- return -errno;
- }
-
- return 0;
-}
-
-/** @brief exit function for fastmodel plugin */
-int
-exitNEcomm (void)
-{
- if (priv.running == 1) {
- int status;
-
- pthread_mutex_lock (&priv.mutex);
- priv.running = 0;
- pthread_mutex_unlock (&priv.mutex);
-
- pthread_join (priv.comm_thread, (void*)&status);
- pthread_mutex_destroy (&priv.mutex);;
- }
-
- return 0;
-}
+++ /dev/null
-plugin_ip_sources = []
-plugin_ip_common_sources = ['plugin-ip-comm.c']
-
-foreach s : plugin_ip_common_sources
- plugin_ip_sources += join_paths(meson.current_source_dir(), s)
-endforeach
-
-# Declare dependency
-plugin_ip_src_dep = declare_dependency(
- sources : plugin_ip_sources,
- include_directories: [ne_common_inc, ne_host_inc, npu_engine_inc]
-)
+++ /dev/null
-npu_engine_sources = []
-
-# Dependencies
-npu_engine_dependencies = [
- libm_dep,
- thread_dep,
- libutils_dep,
- libnpucore_dep,
- libgem_dep
-]
-
-# Sources
-npu_engine_common_sources = [
- 'ne-host-input-service.c',
- 'ne-handler.c',
- 'ne-scheduler.c',
- 'ne-inf.c',
- 'ne-mem.c',
-]
-
-# Headers
-npu_engine_inc = include_directories('.')
-
-foreach s : npu_engine_common_sources
- npu_engine_sources += join_paths(meson.current_source_dir(), s)
-endforeach
-
-comm_opt = get_option('comm_opt')
-
-# Build executable
-if comm_opt == 'fm'
- subdir('fm')
- npu_engine_dependencies += [plugin_fm_dep]
- # Declare dependency
- npu_engine_dep = declare_dependency(
- sources : npu_engine_common_sources,
- include_directories : ne_common_inc,
- dependencies : npu_engine_dependencies
- )
-
- npu_engine_executable = executable('npu-engine-test',
- sources : join_paths(meson.current_source_dir(), 'main.c'),
- include_directories : ne_common_inc,
- dependencies : npu_engine_dependencies)
-
-else # ip comm
- subdir('ip')
- npu_engine_dependencies += [plugin_ip_src_dep]
-
- npu_engine_build = static_library('npu-engine-common',
- npu_engine_sources,
- include_directories : ne_common_inc,
- dependencies: npu_engine_dependencies,
- install : false)
-
- # Declare dependency for other modules
- npu_engine_dep = declare_dependency(link_with : npu_engine_build,
- include_directories : [ne_common_inc, npu_engine_inc],
- dependencies : npu_engine_dependencies)
-endif
+++ /dev/null
-# DO NOTHING, YET
--- /dev/null
+ne_core_npu_inc = include_directories('.')
+ne_core_npu_src = ['NPUdrvAPI.c']
+ne_core_npu_dep = declare_dependency(
+ sources : ne_core_npu_src,
+ dependencies : ne_core_utils_dep,
+ include_directories : [ne_common_inc, ne_core_npu_inc])
+## This is not used in the current design (i.e., NPU-IP).
+## The function in libnpuhost are implemented in /src/core/ip/plugin-comm-ip.c
+
libnpuhost_inc = include_directories('.')
libnpuhost_dep = declare_dependency(include_directories: libnpuhost_inc)
subdir('libnpuhost')
+
+ne_host_dep = [libnpuhost_dep]
subdir('core')
subdir('host')
+
+# Final dependencies
+ne_dependencies = [
+ ne_core_dep,
+ ne_host_dep # not used yet
+]
+
+# Build library
+ne_library_static = static_library('npu-engine',
+ include_directories : ne_common_inc,
+ dependencies: ne_dependencies,
+ install : true,
+ install_dir : ne_libdir)
+ne_library_shared = shared_library('npu-engine',
+ include_directories : ne_common_inc,
+ dependencies: ne_dependencies,
+ install : true,
+ install_dir : ne_libdir)
+
+# Build tests
subdir('test')
--- /dev/null
+## For app tests, make build executables which links with 'ne_library_shared'
-# C++ may be enabled inside test because this is not supposed to be installed in NPU-Core machine for deployment.
-# However, try not to contaminate other parts of core with C++ dependencies.
-
-add_languages('cpp')
-
-gtest_dep = dependency('gtest', required: false)
-if gtest_dep.found()
- libgem_unittest_deps = [
- libgem_dep,
- gtest_dep
- ]
-
- unittest_libgem = executable('unittest_libgem',
- ['libgem_test.cpp'],
- dependencies: [libgem_unittest_deps],
- cpp_args : '-std=c++11',
- install : true,
- install_dir : join_paths(ne_bindir, 'unittests')
- )
-
- test('unittest_libgem', unittest_libgem)
-
- libnpu_unittest_deps = [
- libnpucore_dep,
- gtest_dep
- ]
-
- unittest_libnpu = executable('unittest_libnpu',
- ['npu_api_test.cpp'],
- dependencies: [libnpu_unittest_deps],
- cpp_args : '-std=c++11',
- install : true,
- install_dir : join_paths(ne_bindir, 'unittests')
- )
-
- test('unittest_libnpu', unittest_libnpu)
-
- npu_engine_unittest_deps = [
- npu_engine_dep,
- gtest_dep
- ]
-
- unittest_ne_mem = executable('unittest_ne_mem',
- ['ne_mem_test.cpp'],
- dependencies: [npu_engine_unittest_deps],
- cpp_args : '-std=c++11',
- install : true,
- install_dir : join_paths(ne_bindir, 'unittests')
- )
-
- test('unittest_ne_mem', unittest_ne_mem)
-
- unittest_ne_utils = executable('unittest_ne_utils',
- ['ne_utils_test.cpp'],
- dependencies: [npu_engine_unittest_deps],
- cpp_args : '-std=c++11',
- install : true,
- install_dir : join_paths(ne_bindir, 'unittests')
- )
-
- test('unittest_ne_utils', unittest_ne_utils)
-endif
+subdir('unittests')
+subdir('apptests')
--- /dev/null
+# C++ may be enabled inside test because this is not supposed to be installed in NPU-Core machine for deployment.
+# However, try not to contaminate other parts of core with C++ dependencies.
+
+add_languages('cpp')
+
+gtest_dep = dependency('gtest', required: false)
+if gtest_dep.found()
+ ne_core_gem_unittest_deps = [
+ ne_core_gem_dep,
+ gtest_dep
+ ]
+
+ unittest_ne_core_gem = executable('unittest_ne_core_gem',
+ ['ne_core_gem_test.cpp'],
+ dependencies: [ne_core_gem_unittest_deps],
+ cpp_args : '-std=c++11',
+ install : true,
+ install_dir : join_paths(ne_bindir, 'unittests')
+ )
+
+ test('unittest_ne_core_gem', unittest_ne_core_gem)
+
+ ne_core_npu_unittest_deps = [
+ ne_core_npu_dep,
+ gtest_dep
+ ]
+
+ unittest_ne_core_npu = executable('unittest_ne_core_npu',
+ ['ne_core_npu_test.cpp'],
+ dependencies: [ne_core_npu_unittest_deps],
+ cpp_args : '-std=c++11',
+ install : true,
+ install_dir : join_paths(ne_bindir, 'unittests')
+ )
+
+ test('unittest_ne_core_npu', unittest_ne_core_npu)
+
+ ne_core_utils_unittest_deps = [
+ ne_core_utils_dep,
+ gtest_dep
+ ]
+
+ unittest_ne_core_utils = executable('unittest_ne_core_utils',
+ ['ne_core_utils_test.cpp'],
+ dependencies: [ne_core_utils_unittest_deps],
+ cpp_args : '-std=c++11',
+ install : true,
+ install_dir : join_paths(ne_bindir, 'unittests')
+ )
+
+ test('unittest_ne_core_utils', unittest_ne_core_utils)
+
+ ne_core_unittest_deps = [
+ ne_core_dep,
+ gtest_dep
+ ]
+
+ unittest_ne_core_mem = executable('unittest_ne_core_mem',
+ ['ne_core_mem_test.cpp'],
+ dependencies: [ne_core_unittest_deps],
+ cpp_args : '-std=c++11',
+ install : true,
+ install_dir : join_paths(ne_bindir, 'unittests')
+ )
+
+ test('unittest_ne_core_mem', unittest_ne_core_mem)
+endif
* Copyright (C) 2019 Dongju Chae <dongju.chae@samsung.com>
*/
/**
- * @file libgem_test.cpp
+ * @file ne_core_gem_test.cpp
* @date 30 Jun 2019
* @brief UnitTests to test functions in libgem-core
* @author Dongju Chae <dongju.chae@samsung.com>
/**
* @brief subtest function testing 'gem_open'
*/
-TEST (test_gem, open)
+TEST (ne_core_gem_test, open)
{
int fd = gem_open(GEM_NAME);
/**
* @brief subtest function testing 'gem_create/destroy'
*/
-TEST (test_gem, create)
+TEST (ne_core_gem_test, create)
{
int fd = gem_open(GEM_NAME);
uint32_t size;
/**
* @brief subtest function testing 'gem_mmap'
*/
-TEST (test_gem, mmap)
+TEST (ne_core_gem_test, mmap)
{
uint32_t handle, size, page;
uint32_t *ptr;
/**
* @brief subtest function testing to export a gem buffer and mmap for dmabuf
*/
-TEST (test_gem, export_dmabuf)
+TEST (ne_core_gem_test, export_dmabuf)
{
uint32_t handle, size, page;
uint32_t *ptr;
* Copyright (C) 2019 Dongju Chae <dongju.chae@samsung.com>
*/
/**
- * @file ne_mem_tests.cpp
+ * @file ne_core_mem_test.cpp
* @date 30 Jun 2019
* @brief UnitTests to test functions in memory allocator for NPU Engine
* @author Dongju Chae <dongju.chae@samsung.com>
* @brief register NPU model
* @detail The memory size of model and I/O buffer will be provided as arguments
*/
-TEST (test_mem, register_model)
+TEST (ne_core_mem_test, register_model)
{
mem *mem = GET_MEM ();
hwmem *hwmem;
/**
* @brief prepare input buffer
*/
-TEST (test_mem, prepare_input)
+TEST (ne_core_mem_test, prepare_input)
{
mem *mem = GET_MEM ();
buffer *buffer;
/**
* @brief when output is ready (in a syncronized manner)
*/
-TEST (test_mem, output_ready)
+TEST (ne_core_mem_test, output_ready)
{
mem *mem = GET_MEM ();
buffer *buffer;
/**
* @brief running in parallel with fork()
*/
-TEST (test_mem, running_parallel)
+TEST (ne_core_mem_test, running_parallel)
{
mem *mem = GET_MEM ();
uint64_t size_out, size_in = 1 * M;
/**
* @brief test for memory compaction
*/
-TEST (test_mem, memory_compaction)
+TEST (ne_core_mem_test, memory_compaction)
{
mem *mem = GET_MEM ();
hwmem *hwmem[6];
/**
* @brief test handling input priorities and synchronization for memory
*/
-TEST (test_mem, get_next_buffer_modes)
+TEST (ne_core_mem_test, get_next_buffer_modes)
{
mem *mem = GET_MEM ();
buffer *buffer1, *buffer2;
* Copyright (C) 2019 Parichay Kapoor <pk.kapoor@samsung.com>
*/
/**
- * @file npu_api_test.cpp
+ * @file ne_core_npu_test.cpp
* @date 24 Jul 2019
* @brief Test npu driver api
* @author Parichay Kapoor <pk.kapoor@samsung.com>
/**
* @brief base open and close a device
*/
-TEST (npu_api, dev_open_close)
+TEST (ne_core_npu_test, dev_open_close)
{
int fd;
int ret;
/**
* @brief set data in the device
*/
-TEST (npu_api, set_dev_data)
+TEST (ne_core_npu_test, set_dev_data)
{
int fd = 1;
int ret;
/**
* @brief check device statuses
*/
-TEST (npu_api, check_dev_status)
+TEST (ne_core_npu_test, check_dev_status)
{
int fd = 1;
int ret;
* Copyright (C) 2019 Dongju Chae <dongju.chae@samsung.com>
*/
/**
- * @file ne_utils_tests.cpp
+ * @file ne_core_utils_test.cpp
* @date 30 Jun 2019
* @brief UnitTests to test functions in utility for NPU Engine
* @author Dongju Chae <dongju.chae@samsung.com>
/**
* @brief It tests the functionality of a linked list
*/
-TEST (test_ne_utils, linked_list)
+TEST (ne_core_utils_test, linked_list)
{
test_elem *elem, *tmp;
list test_list;
/**
* @brief test functionality of a hash table
*/
-TEST (test_ne_utils, hash_table)
+TEST (ne_core_utils_test, hash_table)
{
test_elem *elem, *tmp;
hash_table test_ht;