aboutsummaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
authorGian Marco <gianmarco.iodice@arm.com>2018-02-08 16:21:54 +0000
committerAnthony Barbier <anthony.barbier@arm.com>2018-11-02 16:47:18 +0000
commit5ca7409bc02ea1ac8ea34f0779f18221880fa6ac (patch)
tree3018aa85c14bb8f89979b13bca76c60d249e452e /utils
parent284cfe2e3a44e5b20978e561c96c94d2193e93a1 (diff)
downloadComputeLibrary-5ca7409bc02ea1ac8ea34f0779f18221880fa6ac.tar.gz
COMPMID-765 - Used GEMM-based convolution in VGG16
In order to use GEMM-based convolution in VGG16, it has been created a function which allocates 1.8 GB. If the function fails, will be used DIRECT convolution instead Change-Id: Ibec8928ee6fe6684d6dc24b7df380beeb671bf27 Reviewed-on: https://eu-gerrit-1.euhpc.arm.com/119490 Tested-by: Jenkins <bsgcomp@arm.com> Reviewed-by: Michalis Spyrou <michalis.spyrou@arm.com> Reviewed-by: Gian Marco Iodice <gianmarco.iodice@arm.com> Reviewed-by: Anthony Barbier <anthony.barbier@arm.com>
Diffstat (limited to 'utils')
-rw-r--r--utils/Utils.cpp36
-rw-r--r--utils/Utils.h6
2 files changed, 40 insertions, 2 deletions
diff --git a/utils/Utils.cpp b/utils/Utils.cpp
index 32d5e3a6c0..8a2d11814e 100644
--- a/utils/Utils.cpp
+++ b/utils/Utils.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2017, 2018 ARM Limited.
+ * Copyright (c) 2017-2018 ARM Limited.
*
* SPDX-License-Identifier: MIT
*
@@ -191,5 +191,39 @@ std::tuple<std::vector<unsigned long>, bool, std::string> parse_npy_header(std::
return std::make_tuple(shape, fortran_order, typestr);
}
+
+/** This function returns the amount of memory free reading from /proc/meminfo
+ *
+ * @return The free memory in kB
+ */
+uint64_t get_mem_free_from_meminfo()
+{
+ std::string line_attribute;
+ std::ifstream file_meminfo("/proc/meminfo");
+
+ if(file_meminfo.is_open())
+ {
+ while(!(file_meminfo >> line_attribute).fail())
+ {
+ //Test if is the line containing MemFree
+ if(line_attribute == "MemFree:")
+ {
+ uint64_t mem_available;
+ if(!(file_meminfo >> mem_available).fail())
+ {
+ return mem_available;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+ // if it's not MemFree ignore rest of the line
+ file_meminfo.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+ }
+ }
+ // Nothing found or an error during opening the file
+ return 0;
+}
} // namespace utils
} // namespace arm_compute
diff --git a/utils/Utils.h b/utils/Utils.h
index ff4c4c99fd..8822fe7121 100644
--- a/utils/Utils.h
+++ b/utils/Utils.h
@@ -895,7 +895,11 @@ void init_sgemm_output(T &dst, T &src0, T &src1, arm_compute::DataType dt)
{
dst.allocator()->init(TensorInfo(TensorShape(src1.info()->dimension(0), src0.info()->dimension(1)), 1, dt));
}
-
+/** This function returns the amount of memory free reading from /proc/meminfo
+ *
+ * @return The free memory in kB
+ */
+uint64_t get_mem_free_from_meminfo();
} // namespace utils
} // namespace arm_compute
#endif /* __UTILS_UTILS_H__*/