alpaka
alpaka copied to clipboard
replace reading from `/proc/meminfo` with call to `sysconf()`
On Linux, getFreeGlobalMemSizeBytes()
is implemented parsing /proc/meminfo
: https://github.com/alpaka-group/alpaka/blob/f27d78c23c22f4eb5044a39cbfa60360ad1cd129/include/alpaka/dev/cpu/SysInfo.hpp#L220-L245
I would suggest replacing it with reading the number of free pages from sysconf()
, for example:
# if defined(_SC_AVPHYS_PAGES)
return static_cast<std::size_t>(sysconf(_SC_AVPHYS_PAGES)) * getPageSize();
# else
// this is legacy and only used as fallback
return static_cast<std::size_t>(get_avphys_pages()) * getPageSize();
# endif
To clarify: if people tell me it's OK to make this change, I'm happy to provide the pull request.
See #1776.