summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6bc3626)
raw | patch | inline | side by side (parent: 6bc3626)
author | Ajay Jayaraj <ajayj@ti.com> | |
Tue, 17 Apr 2018 21:12:19 +0000 (16:12 -0500) | ||
committer | Ajay Jayaraj <ajayj@ti.com> | |
Tue, 17 Apr 2018 21:12:19 +0000 (16:12 -0500) |
* Added version information in tinn_api/Makefile
* Added Executor::GetAPIVersion()
(MCT-962)
* Added Executor::GetAPIVersion()
(MCT-962)
examples/test/main.cpp | patch | blob | history | |
tinn_api/Makefile | patch | blob | history | |
tinn_api/inc/executor.h | patch | blob | history | |
tinn_api/src/executor.cpp | patch | blob | history |
diff --git a/examples/test/main.cpp b/examples/test/main.cpp
index 852cfe0549ec97f7c0554e1f07b496d7625eba78..5805620a5f094dd65c4993b18f3009b37c09c5d4 100644 (file)
--- a/examples/test/main.cpp
+++ b/examples/test/main.cpp
std::cout << "TI DL not supported on this SoC." << std::endl;
return EXIT_SUCCESS;
}
+ std::cout << "API Version: " << Executor::GetAPIVersion() << std::endl;
// Process arguments
std::string config_file;
void DisplayHelp()
{
- std::cout << "Usage: tidl\n"
- " Will run all available networks if tidl is invoked without"
+ std::cout << "Usage: test_tinn\n"
+ " Will run all available networks if invoked without"
" any arguments.\n Use -c to run a single network.\n"
"Optional arguments:\n"
" -c Path to the configuration file\n"
diff --git a/tinn_api/Makefile b/tinn_api/Makefile
index beadf250410ca8b525ae415a0072b895b712f2f8..82e4871d184d378f78e647c98d745be70b079e01 100644 (file)
--- a/tinn_api/Makefile
+++ b/tinn_api/Makefile
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
+MAJOR_VER=0
+MINOR_VER=1
+PATCH_VER=0
+
+ifeq ($(shell git rev-parse --short HEAD 2>&1 1>/dev/null; echo $$?),0)
+BUILD_SHA?=$(shell git rev-parse --short HEAD)
+endif
+
LIB_NAME = tinn_api.a
DSP_OUTFILE = dsp/ocl_wrapper.out
HEADERS = src/ocl_device.h src/trace.h src/common_defines.h src/util.h
HEADERS += src/executor_impl.h inc/executor.h inc/configuration.h
+.PHONY: $(BUILD_ID)
+BUILD_ID := -D_BUILD_VER=$(shell echo "" | \
+ awk '{ printf ("%02d.%02d.%02d", $(MAJOR_VER), \
+ $(MINOR_VER), $(PATCH_VER)); }') \
+ -D_BUILD_SHA=$(BUILD_SHA)
+
+
ifeq ($(BUILD), debug)
CXXFLAGS += -Og -g -ggdb
else
CXXFLAGS += -I$(TI_OCL_INSTALL)/usr/share/ti/opencl
CXXFLAGS += -I$(TARGET_ROOTDIR)/usr/share/ti/opencl
CXXFLAGS += -Isrc -Iinc
+CXXFLAGS += $(BUILD_ID)
obj/%.o: src/%.cpp $(HEADERS)
@echo Compiling $< ...
$(DSP_OUTFILE):
$(MAKE) -C dsp
-
clean::
- $(RM) -f $(LIB_NAME) $(HOST_OBJ_FILES)
+ $(RM) -f $(LIB_NAME) $(HOST_OBJ_FILES) $(DSP_OUTFILE)
index d8d9f388db543b6e396c04e6b35afed003b43151..118794d857c932a9753fff00b7cefad086fce124 100644 (file)
--- a/tinn_api/inc/executor.h
+++ b/tinn_api/inc/executor.h
//! @return number of devices available
static uint32_t GetNumDevicesSupportingTIDL(DeviceType device_type);
+ //! @brief Returns a string corresponding to the API version
+ //!
+ //! @return <major_ver>.<minor_ver>.<patch_ver>.<git_sha>
+ static std::string GetAPIVersion();
+
Executor(const Executor&) = delete;
Executor& operator= (const Executor&) = delete;
index fcba2e4ea52838cfc0d509f0324e46c7a32fe64e..f7022cada8b11b145e15862bc0339544ab825457 100644 (file)
return Device::GetNumDevicesSupportingTIDL(device_type);
}
+#define STRING(S) XSTRING(S)
+#define XSTRING(S) #S
+std::string Executor::GetAPIVersion()
+{
+ static std::string version = STRING(_BUILD_VER);
+ version += ".";
+ version += STRING(_BUILD_SHA);
+ return version;
+}
+
+
ExecutorImpl::ExecutorImpl(DeviceType core_type, const DeviceIds& ids):
configuration_m(),
shared_networkparam_heap_m(nullptr, &__free_ddr),
name = STRING(SETUP_KERNEL) ";" STRING(INIT_KERNEL) ";" STRING(PROCESS_KERNEL) ";" STRING(CLEANUP_KERNEL);
device_m = Device::Create(core_type_m, ids, name);
-
}