Skip to content

Commit

Permalink
modified: ../edgerun.py
Browse files Browse the repository at this point in the history
	new file:   queue_template.script
	modified:   ../tests/test_edgerun.py
	modified:   ../tests/test_edgerun_mpi.py
  • Loading branch information
mengmengzhang2019 committed Jan 11, 2024
1 parent 727bcf3 commit 7ef00af
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 36 deletions.
34 changes: 5 additions & 29 deletions ceasiompy/EdgeRun/edgerun.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from ceasiompy.utils.ceasiompyutils import (
get_reasonable_nb_cpu,
get_results_directory,
run_software,
# run_software,
)

# from ceasiompy.utils.commonnames import AINP_CFD_NAME, SU2_FORCES_BREAKDOWN_NAME
Expand Down Expand Up @@ -50,7 +50,7 @@
# =================================================================================================
input_que_script_path = get_edge_queScript_template()

def run_edge_multi(wkdir, nb_proc=2):
def run_edge_multi(wkdir, input_que_script_path , nb_proc=2):
"""Function to run a multiple Edge calculation.
Function 'run_edge_multi' will run in the given working directory Edge calculations.
Expand All @@ -76,35 +76,11 @@ def run_edge_multi(wkdir, nb_proc=2):

if len(config_cfd) > 1:
raise ValueError(f"More than one '{AINP_CFD_NAME}' file in this directory!")
edge_scripts_instance = EdgeScripts(config_cfd[0], input_que_script_path, AINP_CFD_NAME)

# run / submit edge commands
edge_scripts_instance = EdgeScripts(config_dir, input_que_script_path, AINP_CFD_NAME)
edge_scripts_instance.submit_preprocessor_script()
#edge_scripts_instance.submit_solver_script(nb_proc)
"""
run_software(
software_name="edge_mpi_run",
arguments=[config_cfd[0], str(nb_proc)],
wkdir=config_dir,
<<<<<<< HEAD
with_mpi=True,
# nb_proc
)
"""

#forces_breakdown_file = Path(config_dir, SU2_FORCES_BREAKDOWN_NAME)
#if not forces_breakdown_file.exists():
=======
with_mpi=False,
# nb_proc
)

# forces_breakdown_file = Path(config_dir, SU2_FORCES_BREAKDOWN_NAME)
# if not forces_breakdown_file.exists():
>>>>>>> 11ccb81e114b69bf4ab99efd08c252c4ab3ecd0f
# raise ValueError(
# "The SU2_CFD calculation has not ended correctly,"
# f"{SU2_FORCES_BREAKDOWN_NAME} is missing!"
# )


# =================================================================================================
# MAIN
Expand Down
15 changes: 15 additions & 0 deletions ceasiompy/EdgeRun/files/queue_template.script
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
#SBATCH -t 1:0:0
#SBATCH -n 1
#SBATCH -p main
#SBATCH -A naiss2023-22-818
#SBATCH -c 1
#SBATCH -J jobname
#
# slurm file submitted to cluster
# -t - time limit for jobs
# -N - number of nodes (not cores, use -n for cores)
# -A - project name/number
# -C - specific node required
# -J - name of job for identification in queue
#
3 changes: 2 additions & 1 deletion ceasiompy/EdgeRun/tests/test_edgerun.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ class TestEdgeConfig(unittest.TestCase):

def test_generate_edge_cfd_ainp(self):
"""Test function for 'ceasiompy.EdgeRun.func.edgeconfig.py'."""
cpacs_in_path = Path(MODULE_DIR / "ToolInput" / "ToolInput.xml")
# cpacs_in_path = Path(MODULE_DIR / "ToolInput" / "ToolInput.xml")
cpacs_in_path = Path('/home/mengmeng/Documents/CEASIOMpy23/CEASIOMpy/WKDIR/labARstraight_toolInput.xml')
cpacs_out_path = MODULE_DIR / "ToolOutput.xml"
wkdir = MODULE_DIR / "Results/Edge"

Expand Down
15 changes: 9 additions & 6 deletions ceasiompy/EdgeRun/tests/test_edgerun_mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@
import os
from ceasiompy.EdgeRun.edgerun import run_edge_multi
from ceasiompy.utils.commonxpath import EDGE_NB_CPU_XPATH

from ceasiompy.EdgeRun.func.edgeutils import get_edge_queScript_template
# from ceasiompy.utils.create_ainpfile import CreateAinp

MODULE_DIR = Path(__file__).parent
input_que_script_path = get_edge_queScript_template()
nb_proc = 32
# =================================================================================================
# CLASSES
Expand All @@ -45,16 +46,18 @@
class TestEdgeConfig(unittest.TestCase):
"""Test class for 'ceasiompy/EdgeRun/func/edgerun.py'"""

def test_generate_edge_cfd_ainp(self):
"""Test function for 'ceasiompy.EdgeRun.func.edgeconfig.py'."""
# cpacs_in_path = Path(MODULE_DIR / "ToolInput" / "ToolInput.xml")
# cpacs_out_path = MODULE_DIR / "ToolOutput.xml"
def test_run_edge_cfd(self):
# cpacs_in_path = Path(MODULE_DIR / "ToolInput" / "ToolInput.xml")
cpacs_in_path = Path('/home/mengmeng/Documents/CEASIOMpy23/CEASIOMpy/WKDIR/labARstraight_toolInput.xml')
cpacs_out_path = MODULE_DIR / "ToolOutput.xml"
wkdir = MODULE_DIR / "Results/Edge"


if not os.path.exists(wkdir):
os.makedirs(wkdir)

run_edge_multi(wkdir)
generate_edge_cfd_ainp(cpacs_in_path, cpacs_out_path, wkdir)
run_edge_multi(wkdir,input_que_script_path )


# =================================================================================================
Expand Down

0 comments on commit 7ef00af

Please sign in to comment.