source: CPL/oasis3-mct/branches/OASIS3-MCT_2.0_branch/util/oasisgui/library/DATA/pluginscripts/cerfacs_neptune_local.py @ 4775

Last change on this file since 4775 was 4775, checked in by aclsce, 5 years ago
  • Imported oasis3-mct from Cerfacs svn server (not suppotred anymore).

The version has been extracted from https://oasis3mct.cerfacs.fr/svn/branches/OASIS3-MCT_2.0_branch/oasis3-mct@1818

File size: 7.3 KB
Line 
1import os,XDR
2
3from plugin_avbp import plugin_avbp
4
5class cerfacs_neptune_local(XDR.Plugin):
6   
7    def __init__(self,typePlugin):
8        XDR.Plugin.__init__(self, typePlugin)
9   
10   
11    def sendDirectory(self,directory):
12       
13        if os.path.exists(directory):
14            return 1
15        else:
16            raise Exception("Error : "+directory+" doesn't exist")
17       
18    def executeDistantCommand(self,command,execDirectory,appli,flags=[]):
19         ########
20        # INITS
21        ########
22        command_exe = command
23        supported_applis = []
24        local_directory = os.getcwd()
25        project_name = XDR.getValue("name","project","meta")
26       
27 #####################
28        # SECTION DEPENDING ON APPLICATIONS
29        ####################
30        supported_applis.append("avbp621") 
31        supported_applis.append("tool_avsp52") 
32        supported_applis.append("tool_avbp621") 
33        supported_applis.append("tool_avtp2") 
34        supported_applis.append("hip_script")
35        supported_applis.append("hip_current")
36        supported_applis.append("dummy")
37       
38        if appli not in supported_applis:
39            XDR.error("this application requires the application tag "+ appli+ ", which is not supported by the plugin cerfacs_neptune_local.")
40
41        ########
42        # AVBP #
43        ########
44        if appli == "tool_avbp621":
45#               avbp_home = "/home/rolex/AVBP_V6.X/AVBP_D6.2.1"
46               avbp_home = "/scratch/cfd/hannebiq/AVBP_D6.2.1"
47               hostname = "NEPTUNE"
48               hip_cur_version = " /home/cfd/avbp/HIP/1.40.1/hip-1.40.1-NEPTUNE"
49               pythonexec = "python"
50               avbptool = plugin_avbp(avbp_home,hostname,hip_cur_version,pythonexec,execDirectory)
51               command_exe = avbptool.switch_avbp_tools(appli,command)   
52               
53               # Creating batch file
54               batchContent =  """#!/bin/bash
55               #PBS -N C3Sm_tools
56               #PBS -l walltime=00:30:00
57               #PBS -j oe
58               #PBS -l select=1:ncpus=1:mpiprocs=1 -l place=scatter
59               #PBS -m ae
60               #PBS -q debug
61               
62               cat \$PBS_NODEFILE
63               nb_cpu=\$(wc -l < \$PBS_NODEFILE)
64               
65                       
66               """                   
67               batchContent +="""export LD_LIBRARY_PATH=/home/cfd/avbp/LIBSUPPORT:$LD_LIBRARY_PATH"""+"\n"
68               batchContent+="mpirun "+command_exe+"\n" 
69       
70        if appli == "avbp621":
71               avbp_home = "/home/rolex/AVBP_V6.X/AVBP_D6.2.1"
72               command_exe = "/home/rolex/AVBP_V6.X/AVBP_D6.2.1/AVBP_V6.2.1_beta.NEPTUNE > avbp_log.txt" 
73               
74               # Creating batch file
75               batchContent =  """#!/bin/bash
76               #PBS -N C3Smjob
77               #PBS -l walltime=06:00:00
78               #PBS -j oe
79               #PBS -l select="""+self.getPluginParam("nbnodes")+"""
80               #PBS -m ae
81               
82               cat \$PBS_NODEFILE
83               nb_cpu=\$(wc -l < \$PBS_NODEFILE)
84               
85                       
86               cd """+execDir_abspath+"""
87               """                   
88               batchContent +="""export LD_LIBRARY_PATH=/home/cfd/avbp/LIBSUPPORT:$LD_LIBRARY_PATH"""+"\n"
89               batchContent+="mpirun "+command_exe+"\n" 
90        #######
91        # HIP #
92        #######
93        if appli == "hip_current":
94            if command.startswith("-c3sm_auto_hip-"):
95                command_exe = command.replace("-c3sm_auto_hip-",hip_cur_version)
96            elif command == "-c3s_auto_hip_scripttxt-":
97                command_exe= hip_cur_version+" < ./script.txt"
98
99        if appli == "hip_script":
100            command_exe = hip_cur_version+" < " + command
101
102           
103         ########
104        # AVSP #
105        ########
106        if appli == "tool_avsp52":
107            hip_cur_version =  "/home/rolex/HIP/1.40.1/hip-1.40.1-KALI"
108            if command == "-c3sm_auto_preproc_mlpf_exec-":
109                command_exe = "/home/rolex/QUIET_5.3/AVSP_HOME/HOST/KALI/TOOLEXEC/preproc_mlpf_KALI.exe"
110            if command == "-c3sm_auto_avspinitsol_exec-":
111                command_exe = "/home/rolex/QUIET_5.3/AVSP_HOME/HOST/KALI/TOOLEXEC/avspinitsol_KALI.exe"
112            if command == "-c3sm_auto_zinn_exec-":
113                command_exe = "/home/rolex/QUIET_5.3/AVSP_HOME/HOST/KALI/TOOLEXEC/Zinn_nozzle_KALI.exe"
114            if command == "-c3sm_auto_add_activflame-":
115                global2avsp_cmd = "/home/rolex/QUIET_5.3/AVSP_HOME/HOST/KALI/TOOLEXEC/global2avsp_KALI.exe"
116                hipscript_cmd = hip_cur_version + " < script_hip"
117                XDR.replace_pattern_in_file(os.path.join(execDirectory,"script_active_flame.py"),"-c3sm_auto_global2avsp_exec-",global2avsp_cmd)
118                XDR.replace_pattern_in_file(os.path.join(execDirectory,"script_active_flame.py"),"-c3sm_auto_hipscript-",hipscript_cmd)
119                command_exe = "/usr/bin/python ./script_active_flame.py"
120            if command == "-c3sm_auto_avbp2avsp_exec-":
121                command_exe = "/home/rolex/QUIET_5.3/AVSP_HOME/HOST/KALI/TOOLEXEC/avbp2avsp_KALI.exe"
122
123        ########
124        # AVTP #
125        ########
126        if appli == "tool_avtp2":
127            hip_cur_version =  "/home/rolex/HIP/1.39.3/hip-1.39.3-KALI"
128            avtp_tag =  "/home/rolex/rolex_avtp_20"
129            avtp_home = "/home/rolex/AVTP/AVTP_V2.X"
130            avtp_scripts = os.path.join(avtp_home,"TOOLS","BIN","SCRIPTS")
131
132            if command.startswith("-c3sm_auto"):
133
134                command_exe="source "+avtp_tag+";"
135
136                if command.startswith("-c3sm_auto_loadmesh-"):
137                    XDR.replace_pattern_in_file(os.path.join(execDirectory,"script_mesh.py"),"-c3sm_auto_meshinfo-",os.path.join(avtp_scripts,"meshinfo "))
138                    XDR.replace_pattern_in_file(os.path.join(execDirectory,"script_mesh.py"),"-c3sm_auto_get_patch_surf-",os.path.join(avtp_scripts,"get_patch_surf "))
139                    command_exe = "/usr/bin/python ./script_mesh.py"
140
141                if command.startswith("-c3sm_auto_track-"):
142                    command_exe = command.replace("-c3sm_auto_track-",os.path.join(avtp_scripts,"track "))
143
144                if command == "-c3sm_auto_prepare_boundary-":
145                    XDR.replace_pattern_in_file(os.path.join(execDirectory,"script_boundaries.py"),"-c3sm_auto_hip-",hip_cur_version)
146                    XDR.replace_pattern_in_file(os.path.join(execDirectory,"script_boundaries.py"),"-c3sm_auto_makesolutbound-",os.path.join(avtp_scripts,"makesolutbound "))
147                    command_exe = "/usr/bin/python ./script_boundaries.py"
148
149                if command == "-c3sm_auto_initsol-":
150                    XDR.replace_pattern_in_file(os.path.join(execDirectory,"script_init.py"),"-c3sm_auto_solinfo-",os.path.join(avtp_scripts,"solinfo "))
151                    XDR.replace_pattern_in_file(os.path.join(execDirectory,"script_init.py"),"-c3sm_auto_makesolution-",os.path.join(avtp_scripts,"makesolution "))
152                    command_exe = "/usr/bin/python ./script_init.py"
153        os.chdir(execDirectory)
154        output = XDR.execute(command_exe)
155        os.chdir(local_directory)
156        return output
157       
158    def retrieveDirectory(self,directory):
159        # Do nothing as we are local
160        pass
161   
162    def removeDirectory(self,directory):
163        pass
164   
Note: See TracBrowser for help on using the repository browser.