Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ram units #3730

Merged
merged 3 commits into from
Feb 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/changelog.d/3730.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix: ram units
6 changes: 3 additions & 3 deletions src/ansys/mapdl/core/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,8 @@ def generate_mapdl_launch_command(
cpu_sw = "-np %d" % nproc

if ram:
ram_sw = "-m %d" % int(1024 * ram)
LOG.debug(f"Setting RAM: {ram_sw}")
ram_sw = "-m %d" % int(ram)
LOG.debug(f"Setting RAM: {ram_sw} MB")
else:
ram_sw = ""

Expand Down Expand Up @@ -1990,7 +1990,7 @@ def get_value(
ram = SLURM_MEM_PER_NODE

if not units:
args["ram"] = int(ram)
args["ram"] = int(ram) # Assuming in MB
elif units == "T": # tera
args["ram"] = int(ram) * (2**10) ** 2
elif units == "G": # giga
Expand Down
12 changes: 6 additions & 6 deletions tests/test_launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ def test_generate_mapdl_launch_command_windows():
jobname = "myjob"
nproc = 10
port = 1000
ram = 2
ram = 2024
additional_switches = "-my_add=switch"

cmd = generate_mapdl_launch_command(
Expand All @@ -1022,7 +1022,7 @@ def test_generate_mapdl_launch_command_windows():
assert "-port" in cmd
assert f"{port}" in cmd
assert "-m" in cmd
assert f"{ram*1024}" in cmd
assert f"{ram}" in cmd
assert "-np" in cmd
assert f"{nproc}" in cmd
assert "-grpc" in cmd
Expand All @@ -1037,7 +1037,7 @@ def test_generate_mapdl_launch_command_windows():
assert f"{exec_file}" in cmd
assert f" -j {jobname} " in cmd
assert f" -port {port} " in cmd
assert f" -m {ram*1024} " in cmd
assert f" -m {ram} " in cmd
assert f" -np {nproc} " in cmd
assert " -grpc" in cmd
assert f" {additional_switches} " in cmd
Expand All @@ -1053,7 +1053,7 @@ def test_generate_mapdl_launch_command_linux():
jobname = "myjob"
nproc = 10
port = 1000
ram = 2
ram = 2024
additional_switches = "-my_add=switch"

cmd = generate_mapdl_launch_command(
Expand All @@ -1075,7 +1075,7 @@ def test_generate_mapdl_launch_command_linux():
assert "-port" in cmd
assert f"{port}" in cmd
assert "-m" in cmd
assert f"{ram*1024}" in cmd
assert f"{ram}" in cmd
assert "-np" in cmd
assert f"{nproc}" in cmd
assert "-grpc" in cmd
Expand All @@ -1091,7 +1091,7 @@ def test_generate_mapdl_launch_command_linux():
assert f"{exec_file} " in cmd
assert f" -j {jobname} " in cmd
assert f" -port {port} " in cmd
assert f" -m {ram*1024} " in cmd
assert f" -m {ram} " in cmd
assert f" -np {nproc} " in cmd
assert " -grpc" in cmd
assert f" {additional_switches} " in cmd
Expand Down
Loading