-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
modified: edgeconfig.py modified: ../tests/test_edgerun_mpi.py new file: ../tests/test_edgerun_submit.py
- Loading branch information
1 parent
7ef00af
commit 2a9941b
Showing
5 changed files
with
139 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
""" | ||
CEASIOMpy: Conceptual Aircraft Design Software | ||
Developed for Airinnova AB, Stockholm, Sweden | ||
Functions to generate queuing script for Edge: queue_preprocessor.script and queue_edgesolver.script | ||
Python version: >=3.8 | ||
| Author : Mengmeng Zhang | ||
| Creation: 2024-01-05 | ||
""" | ||
|
||
# ================================================================================================= | ||
# IMPORTS | ||
# ================================================================================================= | ||
|
||
import os | ||
from pathlib import Path | ||
|
||
from pathlib import Path | ||
|
||
|
||
|
||
class EdgeScripts: | ||
def __init__(self, dir_path, jobname, input_que_script_path, edge_input_file): | ||
self.jobname = jobname | ||
self.dir_path = dir_path | ||
self.input_que_script_path = input_que_script_path | ||
self.Edge_dir = '/pdc/software/22.06/other/m-edge/3.2/gnu/bin/' | ||
self.EdgeInputFile = edge_input_file | ||
#self.GridDir = 'grid' | ||
#os.chdir(os.path.join(caseDir, self.GridDir)) | ||
|
||
def submit_preprocessor_script(self,dir_path): | ||
preprocessor = os.path.join(self.Edge_dir, 'preprocessor') | ||
QueScript = f'queue_preprocessor.script' | ||
Submitcommand = 'sbatch' | ||
os.chdir(dir_path) | ||
with open(self.input_que_script_path, 'r') as template_file, open(QueScript, 'w') as que_script: | ||
for line in template_file: | ||
if '-J jobname' in line: | ||
line = line.replace('-J jobname', f'-J {self.jobname}prepro') | ||
que_script.write(line) | ||
que_script.write(f'{preprocessor} {self.EdgeInputFile} > edge_preprocessor.log 2>&1\n') | ||
print(f'{preprocessor} {self.EdgeInputFile} > edge_preprocessor.log 2>&1\n') | ||
os.system(f'{Submitcommand} {que_script}') | ||
|
||
def submit_solver_script(self, dir_path, nb_proc): | ||
run_solver = os.path.join(self.Edge_dir, 'edge_mpi_run') | ||
QueScript = f'queue_edgesolver.script' | ||
Submitcommand = 'sbatch' | ||
os.chdir(dir_path) | ||
with open(self.input_que_script_path, 'r') as template_file, open(QueScript, 'w') as que_script: | ||
for line in template_file: | ||
if '-J jobname' in line: | ||
line = line.replace('-J jobname', f'-J {self.jobname}solver') | ||
que_script.write(line) | ||
que_script.write(f'{run_solver} {self.EdgeInputFile} {nb_proc} > edge_run.log 2>&1\n') | ||
os.system(f'{Submitcommand} {que_script}') | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
""" | ||
CEASIOMpy: Conceptual Aircraft Design Software | ||
Developed by Airinnova AB, Stockholm, Sweden | ||
Test functions of 'ceasiompy/EdgeRun/func/edgeconfig.py' | ||
Python version: >=3.8 | ||
| Author : Mengmeng Zhang | ||
| Creation: 2024-01-05 | ||
""" | ||
|
||
# ================================================================================================= | ||
# IMPORTS | ||
# ================================================================================================= | ||
|
||
import unittest | ||
|
||
import sys | ||
from pathlib import Path | ||
|
||
# Add the ceasiompy module to the PYTHONPATH | ||
# ceasiompy_path = Path("/home/mengmeng/Documents/CEASIOMpy23/CEASIOMpy/ceasiompy") | ||
# sys.path.append(str(ceasiompy_path)) | ||
|
||
# Now you can import and use the ceasiompy module | ||
# import ceasiompy | ||
from ceasiompy.EdgeRun.func.edgeconfig import generate_edge_cfd_ainp | ||
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() | ||
|
||
# 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) | ||
|
||
generate_edge_cfd_ainp(cpacs_in_path, cpacs_out_path, wkdir) |