Changeset 1078
- Timestamp:
- 10/01/14 12:23:37 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh
r1063 r1078 2143 2143 EXECUTION=${HOST_MPIRUN_COMMAND} 2144 2144 2145 # MPMD mode 2146 2145 # MPMD mode 2147 2146 if ( ${OK_PARA_MPMD} ) ; then 2148 2147 2149 # Only MPI (MPMD) 2150 if ( ! ${OK_PARA_OMP} ) ; then 2151 2152 if [ -f run_file ] ; then 2153 IGCM_sys_Rm -f run_file 2154 fi 2155 touch run_file 2156 2157 # Build run_file 2158 2159 # First loop on the components for the coupler ie oasis (only if oasis3) 2160 2161 ## the coupler ie oasis3 must be the first one 2162 for comp in ${config_ListOfComponents[*]} ; do 2163 2164 eval ExeNameIn=\${config_Executable_${comp}[0]} 2165 eval ExeNameOut=\${config_Executable_${comp}[1]} 2166 2167 # for CPL component only 2168 if [ "X${comp}" = "XCPL" ] && [ "X${ExeNameOut}" != X\"\" ] ; then 2169 2170 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 2171 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 2172 echo "${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file 2173 fi 2174 done 2175 2176 # Then second loop on the components 2177 2178 for comp in ${config_ListOfComponents[*]} ; do 2179 2180 eval ExeNameIn=\${config_Executable_${comp}[0]} 2181 eval ExeNameOut=\${config_Executable_${comp}[1]} 2182 2183 # Only if we really have an executable for the component and not the coupler ie oasis: 2184 if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 2185 2186 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 2187 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 2188 echo "${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file 2189 fi 2190 done 2191 2192 EXECUTION="${HOST_MPIRUN_COMMAND} -f ./run_file" 2193 2194 IGCM_sys_Chmod u+x run_file 2195 if ( $DEBUG_sys ) ; then 2196 echo "run_file contains : " 2197 cat run_file 2198 fi 2199 2200 # MPI-OpenMP (MPMD) 2201 else 2202 2203 # Use of mpirun instead of ccc_mprun 2204 EXECUTION="time mpirun" 2205 2206 # Hosts treatment 2207 ${EXECUTION} hostname | sort | uniq > hosts.tmp 2208 2209 i=0 2210 rm -f hosts rankfile 2211 IGCM_debug_Print 1 "sys Curie, Hosts available :" 2212 for nodes in `cat hosts.tmp` 2213 do 2214 host[$i]=$nodes 2215 echo "${host[$i]}" >> hosts 2216 IGCM_debug_Print 1 ${host[$i]} 2217 i=$((i+1)) 2218 done 2219 rm -f hosts.tmp 2220 2221 listnodes=${host[*]} 2222 2223 EXECUTION="${EXECUTION} -hostfile hosts -rankfile rankfile" 2224 2225 # Initialisation 2226 rank=0 2227 current_core=0 2228 core_per_node=16 2229 init_exec=n 2230 2231 # Loop on the components 2232 for comp in ${config_ListOfComponents[*]} ; do 2233 2234 eval ExeNameIn=\${config_Executable_${comp}[0]} 2235 eval ExeNameOut=\${config_Executable_${comp}[1]} 2236 2237 # Not possible if oasis has an executable (i.e old version of oasis3) 2238 if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" = "XCPL" ] ) ; then 2239 IGCM_debug_Exit "ERROR MPMD with hybrid MPI-OpenMP is not available with oasis3 version" 2240 IGCM_debug_Print 2 "Only available with oasis3-MCT version coupler" 2241 IGCM_debug_Verif_Exit 2242 fi 2243 2244 # Only if we really have an executable for the component : 2245 if [ "X${ExeNameOut}" != X\"\" ] ; then 2246 2247 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 2248 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 2249 2250 echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 2251 echo "" >> script_${ExeNameOut}.ksh 2252 if [ ${comp_proc_omp_loc} -gt 1 ] ; then 2253 2254 # Check if the number of threads is correct 2255 case ${comp_proc_omp_loc} in 2256 2|4|8|16) 2257 IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads" 2258 ;; 2259 *) 2260 IGCM_debug_Exit "ERROR with OMP parameters !" 2261 IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads" 2262 IGCM_debug_Print 2 "Only 2,4,8,16 as number of OMP threads are possible " 2263 IGCM_debug_Verif_Exit 2264 ;; 2265 esac 2266 echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh 2267 echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh 2268 echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh 2269 echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh 2270 fi 2271 # echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK - ${start_num})) " >> script_${ExeNameOut}.ksh 2272 # echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}" >> script_${ExeNameOut}.ksh 2273 echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh 2274 IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 2275 2276 if [ ${init_exec} = y ] ; then 2277 EXECUTION="${EXECUTION} : -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" 2278 else 2279 EXECUTION="${EXECUTION} -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" 2280 init_exec=y 2281 fi 2148 # Only MPI (MPMD) 2149 if ( ! ${OK_PARA_OMP} ) ; then 2150 2151 if [ -f run_file ] ; then 2152 IGCM_sys_Rm -f run_file 2153 fi 2154 touch run_file 2155 2156 # Build run_file 2157 2158 # First loop on the components for the coupler ie oasis (only if oasis3) 2159 # the coupler ie oasis3 must be the first one 2160 for comp in ${config_ListOfComponents[*]} ; do 2161 2162 eval ExeNameIn=\${config_Executable_${comp}[0]} 2163 eval ExeNameOut=\${config_Executable_${comp}[1]} 2164 2165 # for CPL component only 2166 if [ "X${comp}" = "XCPL" ] && [ "X${ExeNameOut}" != X\"\" ] ; then 2167 2168 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 2169 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 2170 echo "${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file 2171 fi 2172 done 2173 2174 # Then second loop on the components 2175 for comp in ${config_ListOfComponents[*]} ; do 2176 2177 eval ExeNameIn=\${config_Executable_${comp}[0]} 2178 eval ExeNameOut=\${config_Executable_${comp}[1]} 2179 2180 # Only if we really have an executable for the component and not the coupler ie oasis: 2181 if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 2182 2183 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 2184 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 2185 echo "${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file 2186 fi 2187 done 2188 2189 EXECUTION="${HOST_MPIRUN_COMMAND} -f ./run_file" 2190 2191 IGCM_sys_Chmod u+x run_file 2192 if ( $DEBUG_sys ) ; then 2193 echo "run_file contains : " 2194 cat run_file 2195 fi 2196 2197 # MPI-OpenMP (MPMD) 2198 else 2199 2200 # Use of mpirun instead of ccc_mprun 2201 EXECUTION="time mpirun" 2202 2203 # Hosts treatment 2204 ${EXECUTION} hostname | sort | uniq > hosts.tmp 2205 2206 i=0 2207 rm -f hosts rankfile 2208 IGCM_debug_Print 1 "sys Curie, Hosts available :" 2209 for nodes in `cat hosts.tmp` 2210 do 2211 host[$i]=$nodes 2212 echo "${host[$i]}" >> hosts 2213 IGCM_debug_Print 1 ${host[$i]} 2214 i=$((i+1)) 2215 done 2216 rm -f hosts.tmp 2217 2218 listnodes=${host[*]} 2219 2220 EXECUTION="${EXECUTION} -hostfile hosts -rankfile rankfile" 2221 2222 # Initialisation 2223 rank=0 2224 current_core=0 2225 core_per_node=16 2226 init_exec=n 2227 2228 # Loop on the components 2229 for comp in ${config_ListOfComponents[*]} ; do 2230 2231 eval ExeNameIn=\${config_Executable_${comp}[0]} 2232 eval ExeNameOut=\${config_Executable_${comp}[1]} 2233 2234 # Not possible if oasis has an executable (i.e old version of oasis3) 2235 if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" = "XCPL" ] ) ; then 2236 IGCM_debug_Exit "ERROR MPMD with hybrid MPI-OpenMP is not available with oasis3 version" 2237 IGCM_debug_Print 2 "Only available with oasis3-MCT version coupler" 2238 IGCM_debug_Verif_Exit 2239 fi 2240 2241 # Only if we really have an executable for the component : 2242 if [ "X${ExeNameOut}" != X\"\" ] ; then 2243 2244 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 2245 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 2246 2247 echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 2248 echo "" >> script_${ExeNameOut}.ksh 2249 if [ ${comp_proc_omp_loc} -gt 1 ] ; then 2250 2251 # Check if the number of threads is correct 2252 case ${comp_proc_omp_loc} in 2253 2|4|8|16) 2254 IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads" 2255 ;; 2256 *) 2257 IGCM_debug_Exit "ERROR with OMP parameters !" 2258 IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads" 2259 IGCM_debug_Print 2 "Only 2,4,8,16 as number of OMP threads are possible " 2260 IGCM_debug_Verif_Exit 2261 ;; 2262 esac 2263 echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh 2264 echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh 2265 echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh 2266 echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh 2267 fi 2268 #echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK - ${start_num})) " >> script_${ExeNameOut}.ksh 2269 #echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}" >> script_${ExeNameOut}.ksh 2270 echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh 2271 IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 2272 2273 if [ ${init_exec} = y ] ; then 2274 EXECUTION="${EXECUTION} : -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" 2275 else 2276 EXECUTION="${EXECUTION} -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" 2277 init_exec=y 2278 fi 2282 2279 2283 2280 # Build rankfile : method used to assign cores and nodes for the MPI process 2284 # Ex : 2285 #rank 0=curie5296 slot=0,1,2,3 2281 # Ex : 2282 #rank 0=curie5296 slot=0,1,2,3 2286 2283 #rank 1=curie5296 slot=4,5,6,7 2287 2284 # Example of final command : … … 2296 2293 # 2297 2294 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 # Only one executable (SPMD mode).2319 else 2295 for nb_proc_mpi in `seq 0 $(($comp_proc_mpi_loc-1))`; do 2296 (( index_host = current_core / core_per_node )) 2297 host_value=${host[${index_host}]} 2298 (( slot = current_core % core_per_node )) 2299 virg="," 2300 string_final="" 2301 for index in `seq $slot $(($slot+$comp_proc_omp_loc-1))`; do 2302 string=$index$virg 2303 string_final=$string_final$string 2304 done 2305 string_final=$( echo $string_final | sed "s/.$//" ) 2306 echo "rank $rank=$host_value slot=$string_final" >> rankfile 2307 (( rank = rank + 1 )) 2308 (( current_core = current_core + comp_proc_omp_loc )) 2309 done 2310 fi 2311 2312 done 2313 fi 2314 2315 # Only one executable (SPMD mode). 2316 else 2320 2317 2321 2318 for comp in ${config_ListOfComponents[*]} ; do
Note: See TracChangeset
for help on using the changeset viewer.