summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorIsabella Gottardi <isabella.gottardi@arm.com>2021-04-07 09:27:38 +0100
committerIsabella Gottardi <isabella.gottardi@arm.com>2021-05-07 12:19:19 +0100
commit2181d0ac35f30202985a877950c88325ff665f6b (patch)
treee16c50d41d85945e0c2c864323ac1769b02af64f /scripts
parentd580eee180be219e118152cedabc9637da8574d6 (diff)
downloadml-embedded-evaluation-kit-2181d0ac35f30202985a877950c88325ff665f6b.tar.gz
MLECO-1766: Default build flow helper scripts added
MLECO-1882: Anomaly Detection use-case default model download added and tests updated to run with it. Test data generation cmake logic moved from use-case cmakes to top-level cmake script. Signed-off-by: Isabella Gottardi <isabella.gottardi@arm.com> Change-Id: Ifde469e3585c37b9a53810236a92ce52d4fbb407
Diffstat (limited to 'scripts')
-rw-r--r--scripts/cmake/source_gen_utils.cmake71
-rw-r--r--scripts/cmake/util_functions.cmake17
-rw-r--r--scripts/vela/default_vela.ini (renamed from scripts/vela/vela.ini)34
3 files changed, 63 insertions, 59 deletions
diff --git a/scripts/cmake/source_gen_utils.cmake b/scripts/cmake/source_gen_utils.cmake
index 8653016..92ec53d 100644
--- a/scripts/cmake/source_gen_utils.cmake
+++ b/scripts/cmake/source_gen_utils.cmake
@@ -194,39 +194,62 @@ endfunction()
# placed
# @param[in] DESTINATION_HDR directory in which the output h file must be
# placed
-# @param[in] USECASE name of the sub-usecase
# @param[in] NAMESPACE data name space
# NOTE: Uses python
##############################################################################
function(generate_test_data_code)
- set(multiValueArgs NAMESPACE)
- set(oneValueArgs INPUT_DIR DESTINATION_SRC DESTINATION_HDR USECASE)
+ set(multiValueArgs NAMESPACE INPUT_DIR)
+ set(oneValueArgs DESTINATION_SRC DESTINATION_HDR)
cmake_parse_arguments(PARSED "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} )
- # Absolute paths for passing into python script
- get_filename_component(input_dir_abs ${PARSED_INPUT_DIR} ABSOLUTE)
- get_filename_component(src_out_abs ${PARSED_DESTINATION_SRC} ABSOLUTE)
- get_filename_component(hdr_out_abs ${PARSED_DESTINATION_HDR} ABSOLUTE)
-
- foreach(name ${PARSED_NAMESPACE})
- set(py_arg_exp ${py_arg_exp} --namespaces=${name})
- endforeach()
+ list(LENGTH PARSED_INPUT_DIR input_dir_length)
- message(STATUS "Generating test ifm and ofm files from ${input_dir_abs}")
- execute_process(
- COMMAND ${PYTHON} ${SCRIPTS_DIR}/py/gen_test_data_cpp.py
- --data_folder_path ${input_dir_abs}
- --source_folder_path ${src_out_abs}
- --header_folder_path ${hdr_out_abs}
- --usecase ${PARSED_USECASE}
- ${py_arg_exp}
- RESULT_VARIABLE return_code
- )
- if (NOT return_code EQUAL "0")
- message(FATAL_ERROR "Failed to generate test data files.")
- endif ()
+ if (${input_dir_length} GREATER 1)
+ set(add_extra_namespace TRUE)
+ else()
+ set(add_extra_namespace FALSE)
+ endif()
+ foreach(input_dir ${PARSED_INPUT_DIR})
+ unset(py_arg_exp)
+ file(GLOB_RECURSE input_data_files
+ "${input_dir}/*.npy"
+ )
+ # no input NPY data found => skip code generation.
+ if(NOT input_data_files)
+ message(WARNING "No files were found to generated input data: ${input_dir}")
+ break()
+ endif()
+
+ # Absolute paths for passing into python script
+ get_filename_component(input_dir_abs ${input_dir} ABSOLUTE)
+ get_filename_component(input_dir_name ${input_dir} NAME)
+ get_filename_component(src_out_abs ${PARSED_DESTINATION_SRC} ABSOLUTE)
+ get_filename_component(hdr_out_abs ${PARSED_DESTINATION_HDR} ABSOLUTE)
+
+ foreach(name ${PARSED_NAMESPACE})
+ set(py_arg_exp ${py_arg_exp} --namespaces=${name})
+ endforeach()
+
+ if (${add_extra_namespace})
+ set(py_arg_exp ${py_arg_exp} --namespaces=${input_dir_name})
+ endif()
+
+ message(STATUS "Generating test ifm and ofm files from ${input_dir_abs}")
+ execute_process(
+ COMMAND ${PYTHON} ${SCRIPTS_DIR}/py/gen_test_data_cpp.py
+ --data_folder_path ${input_dir_abs}
+ --source_folder_path ${src_out_abs}
+ --header_folder_path ${hdr_out_abs}
+ --usecase ${input_dir_name}
+ ${py_arg_exp}
+ RESULT_VARIABLE return_code
+ )
+ if (NOT return_code EQUAL "0")
+ message(FATAL_ERROR "Failed to generate test data files.")
+ endif ()
+ endforeach()
endfunction()
diff --git a/scripts/cmake/util_functions.cmake b/scripts/cmake/util_functions.cmake
index e39de2f..ecd9d2a 100644
--- a/scripts/cmake/util_functions.cmake
+++ b/scripts/cmake/util_functions.cmake
@@ -20,6 +20,21 @@
##############################################################################
function(USER_OPTION name description default type)
+ if (${type} STREQUAL PATH_OR_FILE)
+
+ if (DEFINED ${name})
+ get_path_type(${${name}} PATH_TYPE)
+ else()
+ get_path_type(${default} PATH_TYPE)
+ endif()
+
+ # Set the default type if path is not a dir or file path (or undefined)
+ if (NOT ${PATH_TYPE} STREQUAL PATH AND NOT ${PATH_TYPE} STREQUAL FILEPATH)
+ message(FATAL_ERROR "Invalid ${name}. It should be a dir or file path.")
+ endif()
+ set(type ${PATH_TYPE})
+ endif()
+
if (NOT DEFINED ${name})
set(${name} ${default} CACHE ${type} ${description})
endif()
@@ -123,7 +138,7 @@ endfunction()
# download_path: location where this file is to be downloaded (path including filename)
function(download_file_from_modelzoo model_zoo_version file_sub_path download_path)
- set(MODEL_ZOO_REPO "https://github.com/ARM-software/ML-zoo/raw")
+ set(MODEL_ZOO_REPO "https://github.com/ARM-software/ML-zoo/raw")
string(JOIN "/" FILE_URL
${MODEL_ZOO_REPO} ${model_zoo_version} ${file_sub_path})
diff --git a/scripts/vela/vela.ini b/scripts/vela/default_vela.ini
index fcd18be..c49b597 100644
--- a/scripts/vela/vela.ini
+++ b/scripts/vela/default_vela.ini
@@ -21,20 +21,6 @@
; -----------------------------------------------------------------------------
; System Configuration
-; Ethos-U55 Deep Embedded: SRAM (1.6 GB/s) and Flash (0.1 GB/s)
-[System_Config.Ethos_U55_Deep_Embedded]
-core_clock=200e6
-axi0_port=Sram
-axi1_port=OffChipFlash
-Sram_clock_scale=1.0
-Sram_burst_length=32
-Sram_read_latency=32
-Sram_write_latency=32
-OffChipFlash_clock_scale=0.0625
-OffChipFlash_burst_length=128
-OffChipFlash_read_latency=64
-OffChipFlash_write_latency=64
-
; Ethos-U55 High-End Embedded: SRAM (4 GB/s) and Flash (0.5 GB/s)
[System_Config.Ethos_U55_High_End_Embedded]
core_clock=500e6
@@ -52,29 +38,9 @@ OffChipFlash_write_latency=64
; -----------------------------------------------------------------------------
; Memory Mode
-; SRAM Only: only one AXI port is used and the SRAM is used for all storage
-[Memory_Mode.Sram_Only]
-const_mem_area=Axi0
-arena_mem_area=Axi0
-cache_mem_area=Axi0
-
; Shared SRAM: the SRAM is shared between the Ethos-U and the Cortex-M software
; The non-SRAM memory is assumed to be read-only
[Memory_Mode.Shared_Sram]
const_mem_area=Axi1
arena_mem_area=Axi0
cache_mem_area=Axi0
-
-; Dedicated SRAM: the SRAM (384KB) is only for use by the Ethos-U
-; The non-SRAM memory is assumed to be read-writeable
-[Memory_Mode.Dedicated_Sram]
-const_mem_area=Axi1
-arena_mem_area=Axi1
-cache_mem_area=Axi0
-cache_sram_size=393216
-
-; Dedicated SRAM 512KB: the SRAM (512KB) is only for use by the Ethos-U
-; The non-SRAM memory is assumed to be read-writeable
-[Memory_Mode.Dedicated_Sram_512KB]
-inherit=Memory_Mode.Dedicated_Sram
-cache_sram_size=524288