This is an automated email from the ASF dual-hosted git repository.
mboehm7 pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/systemds.git
The following commit(s) were added to refs/heads/main by this push:
new f221d92fef [MINOR] Fix max machine memory checking/reporting on
Linux/OSX
f221d92fef is described below
commit f221d92fefa09d032d51fd3fbf2b4d8504080913
Author: Matthias Boehm <[email protected]>
AuthorDate: Wed Aug 28 15:03:23 2024 +0200
[MINOR] Fix max machine memory checking/reporting on Linux/OSX
---
src/main/java/org/apache/sysds/utils/SettingsChecker.java | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/main/java/org/apache/sysds/utils/SettingsChecker.java
b/src/main/java/org/apache/sysds/utils/SettingsChecker.java
index f842134ab6..62ab608b95 100644
--- a/src/main/java/org/apache/sysds/utils/SettingsChecker.java
+++ b/src/main/java/org/apache/sysds/utils/SettingsChecker.java
@@ -45,7 +45,7 @@ public interface SettingsChecker {
public static void checkMemorySetting() {
long JRE_Mem_Byte = Runtime.getRuntime().maxMemory();
- long Sys_Mem_Byte = maxMemMachine() * 1024;
+ long Sys_Mem_Byte = maxMemMachine();
// Default 500MB
final long DefaultJava_500MB = 1024L * 1024 * 500;
// 10 GB
@@ -65,7 +65,7 @@ public interface SettingsChecker {
public static long maxMemMachine() {
String sys = System.getProperty("os.name");
if("Linux".equals(sys)) {
- return maxMemMachineLinux();
+ return maxMemMachineLinux() * 1024;
}
else if(sys.contains("Mac OS")) {
return maxMemMachineOSX();
@@ -79,6 +79,7 @@ public interface SettingsChecker {
}
private static long maxMemMachineLinux() {
+ //in kilo bytes
try(BufferedReader reader = new BufferedReader(new
FileReader("/proc/meminfo"));) {
String currentLine = reader.readLine();
while(!currentLine.contains("MemTotal:"))
@@ -93,7 +94,7 @@ public interface SettingsChecker {
private static long maxMemMachineOSX() {
try {
- String command = "sysctl hw.memsize";
+ String command = "sysctl hw.memsize"; //in bytes
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(command);
String memStr = new
String(pr.getInputStream().readAllBytes(), StandardCharsets.UTF_8);
@@ -106,7 +107,7 @@ public interface SettingsChecker {
private static long maxMemMachineWin() {
try {
- String command = "wmic memorychip get capacity";
+ String command = "wmic memorychip get capacity"; //in
bytes
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(command);
String[] memStr = new
String(pr.getInputStream().readAllBytes(), StandardCharsets.UTF_8).split("\n");