diff --git a/ceasiompy/EdgeRun/edgerun.py b/ceasiompy/EdgeRun/edgerun.py index 046fbed38..5f1a8f681 100644 --- a/ceasiompy/EdgeRun/edgerun.py +++ b/ceasiompy/EdgeRun/edgerun.py @@ -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 @@ -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. @@ -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 diff --git a/ceasiompy/EdgeRun/files/queue_template.script b/ceasiompy/EdgeRun/files/queue_template.script new file mode 100755 index 000000000..c61c2935b --- /dev/null +++ b/ceasiompy/EdgeRun/files/queue_template.script @@ -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 +# diff --git a/ceasiompy/EdgeRun/tests/test_edgerun.py b/ceasiompy/EdgeRun/tests/test_edgerun.py index 52c23f457..4ff714be3 100644 --- a/ceasiompy/EdgeRun/tests/test_edgerun.py +++ b/ceasiompy/EdgeRun/tests/test_edgerun.py @@ -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" diff --git a/ceasiompy/EdgeRun/tests/test_edgerun_mpi.py b/ceasiompy/EdgeRun/tests/test_edgerun_mpi.py index 62cc9d814..27f02d719 100644 --- a/ceasiompy/EdgeRun/tests/test_edgerun_mpi.py +++ b/ceasiompy/EdgeRun/tests/test_edgerun_mpi.py @@ -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 @@ -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 ) # =================================================================================================