From ced2fffbc1b85bed06b160d49e9091768260935a Mon Sep 17 00:00:00 2001 From: chunlin Date: Thu, 29 May 2025 11:21:52 +0800 Subject: [PATCH] update templates to use env.sh --- src/commandBuilder.py | 3 +++ src/dataService.py | 7 +++++++ templates/top50/cp2k/8.2/cp2k.8.2.arm.config | 2 +- templates/top50/gromacs/2023.3/gromacs.2023.3.config | 1 + templates/top50/qe/6.4.1/qe.6.4.1.config | 2 +- 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/commandBuilder.py b/src/commandBuilder.py index 57cb782..7493b0a 100644 --- a/src/commandBuilder.py +++ b/src/commandBuilder.py @@ -77,6 +77,9 @@ class CommandBuilder: def job_run(self, num): job_file_path = self.ds.get_job_run_file() + #generate job env file + job_env_file = self.ds.get_job_env_file() + self.tool_service.write_file(job_env_file, self.ds.env_content) print(f"start job run {self.ds.get_app_name()}") job_cmd = self.ds.get_job_cmd() if num == 1 else self.ds.get_job2_cmd() job_content = f''' diff --git a/src/dataService.py b/src/dataService.py index 08ca9ea..fcfbd3c 100644 --- a/src/dataService.py +++ b/src/dataService.py @@ -256,6 +256,13 @@ class DataService(metaclass=Singleton): else: env_root_path = self.root_path return os.path.join(env_root_path, self.ENV_FILE) + + def get_job_env_file(self): + if self.app_config.case_dir: + env_root_path = self.app_config.case_dir + else: + env_root_path = self.root_path + return os.path.join(env_root_path, self.ENV_FILE) def get_depend_file(self): if self.app_config.build_dir: diff --git a/templates/top50/cp2k/8.2/cp2k.8.2.arm.config b/templates/top50/cp2k/8.2/cp2k.8.2.arm.config index 3774759..a708a7b 100644 --- a/templates/top50/cp2k/8.2/cp2k.8.2.arm.config +++ b/templates/top50/cp2k/8.2/cp2k.8.2.arm.config @@ -142,7 +142,7 @@ mpirun -np 128 -genv OMP_NUM_THREADS=1 -genv CUDA_VISIBLE_DEVICES=0,1 exe/Linux- #DSUB -e cp2k_err_%J.log #DSUB -T '2h' -module load cp2k +source ./env.sh # or module load cp2k export HOSTFILE=hostfile.cp2k rm -f $HOSTFILE touch $HOSTFILE diff --git a/templates/top50/gromacs/2023.3/gromacs.2023.3.config b/templates/top50/gromacs/2023.3/gromacs.2023.3.config index 40abd5f..fe38cc4 100644 --- a/templates/top50/gromacs/2023.3/gromacs.2023.3.config +++ b/templates/top50/gromacs/2023.3/gromacs.2023.3.config @@ -82,6 +82,7 @@ nodes = 1 #DSUB -e gmx_err_%J.log #DSUB -T '2h' +source ./env.sh # or module load gromacs export HOSTFILE=hostfile.gmx rm -f $HOSTFILE touch $HOSTFILE diff --git a/templates/top50/qe/6.4.1/qe.6.4.1.config b/templates/top50/qe/6.4.1/qe.6.4.1.config index a2a79cc..4a11bb7 100644 --- a/templates/top50/qe/6.4.1/qe.6.4.1.config +++ b/templates/top50/qe/6.4.1/qe.6.4.1.config @@ -63,7 +63,7 @@ mpirun --allow-run-as-root -x OMP_NUM_THREADS=1 -np 8 $QE_ROOT/bin/pw.x -input t #DSUB -eo qe.%J.err ##set runtime environment variables -module load QE +source ./env.sh # or module load QE ulimit -s unlimited ulimit -c unlimited echo "----HOSTFILE generated---" -- Gitee