Changeset 1390
- Timestamp:
- 05/02/17 10:20:35 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh
r1385 r1390 1111 1111 1112 1112 elif [ ${executionType} -eq 2 ] ; then 1113 # MPMD + MPI + OMP 1114 sed -e "/::openMPthreads::/d" \ 1115 -e "s/::JobNumProcTot::/${coreNumber}/" \ 1116 ${file} > ${file}.tmp 1117 1113 # MPMD + MPI + OMP : mpirun/ccc_mprun/error 1114 if ( [ "X${config_UserChoices_ExecutionModeOnCurie}" = "X" ] || [ "X${config_UserChoices_ExecutionModeOnCurie}" = "Xmpirun" ] ) ; then 1115 sed -e "/::openMPthreads::/d" \ 1116 -e "s/::JobNumProcTot::/${coreNumber}/" \ 1117 ${file} > ${file}.tmp 1118 elif ( [ "X${config_UserChoices_ExecutionModeOnCurie}" = "Xccc_mprun" ] ) ; then 1119 sed -e "/::openMPthreads::/d" \ 1120 -e "s/::JobNumProcTot::/${coreNumber}/" \ 1121 -e "/--cpu_bind=none/d" \ 1122 ${file} > ${file}.tmp 1123 else 1124 IGCM_debug_Print 1 "You have to set ExecutionModeOnCurie=ccc_mprun or mpirun in config.card" 1125 IGCM_debug_Exit "IGCM_sys_updateHeaders" 1126 fi 1118 1127 elif [ ${executionType} -eq 3 ] ; then 1119 1128 # SPMD + MPI/OMP … … 1184 1193 EXECUTION=${HOST_MPIRUN_COMMAND} 1185 1194 1186 # MPMD mode1187 1195 if ( ${OK_PARA_MPMD} ) ; then 1196 1197 # MPMD mode 1198 # 1 MPI only 1199 # 2 MPI/OpenMP mpirun method 1200 # 3 MPI/OpenMP ccc_mprun method 1188 1201 1189 1202 if [ -f run_file ] ; then … … 1192 1205 touch run_file 1193 1206 1194 # Only MPI (MPMD)1207 # case 1 : Only MPI (MPMD) 1195 1208 if ( ! ${OK_PARA_OMP} ) ; then 1196 1209 … … 1228 1241 done 1229 1242 1243 EXECUTION="${HOST_MPIRUN_COMMAND} -f ./run_file" 1244 1245 IGCM_sys_Chmod u+x run_file 1246 if ( $DEBUG_sys ) ; then 1247 echo "run_file contains : " 1248 cat run_file 1249 fi 1250 1251 elif ( [ "X${config_UserChoices_ExecutionModeOnCurie}" = "X" ] || [ "X${config_UserChoices_ExecutionModeOnCurie}" = "Xmpirun" ] ) ; then 1252 1253 # 2 MPI/OpenMP mpirun method 1254 1255 # Use of mpirun instead of ccc_mprun 1256 EXECUTION="time mpirun" 1257 1258 # Hosts treatment 1259 ${EXECUTION} hostname | sort | uniq > hosts.tmp 1260 1261 i=0 1262 rm -f hosts rankfile 1263 IGCM_debug_Print 1 "sys Curie, Hosts available :" 1264 for nodes in `cat hosts.tmp` 1265 do 1266 host[$i]=$nodes 1267 echo "${host[$i]}" >> hosts 1268 IGCM_debug_Print 1 ${host[$i]} 1269 i=$((i+1)) 1270 done 1271 rm -f hosts.tmp 1272 1273 listnodes=${host[*]} 1274 1275 EXECUTION="${EXECUTION} -hostfile hosts -rankfile rankfile" 1276 1277 # Initialisation 1278 rank=0 1279 current_core=0 1280 core_per_node=16 1281 init_exec=n 1282 1283 # Loop on the components 1284 for comp in ${config_ListOfComponents[*]} ; do 1285 1286 eval ExeNameIn=\${config_Executable_${comp}[0]} 1287 eval ExeNameOut=\${config_Executable_${comp}[1]} 1288 1289 # Not possible if oasis has an executable (i.e old version of oasis3) 1290 if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" = "XCPL" ] ) ; then 1291 IGCM_debug_Exit "ERROR MPMD with hybrid MPI-OpenMP is not available with oasis3 version" 1292 IGCM_debug_Print 2 "Only available with oasis3-MCT version coupler" 1293 IGCM_debug_Verif_Exit 1294 fi 1295 1296 # Only if we really have an executable for the component : 1297 if [ "X${ExeNameOut}" != X\"\" ] ; then 1298 1299 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 1300 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 1301 1302 echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 1303 echo "" >> script_${ExeNameOut}.ksh 1304 if [ ${comp_proc_omp_loc} -gt 1 ] ; then 1305 1306 # Check if the number of threads is correct 1307 case ${comp_proc_omp_loc} in 1308 2|4|8|16) 1309 IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads" 1310 ;; 1311 *) 1312 IGCM_debug_Exit "ERROR with OMP parameters !" 1313 IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads" 1314 IGCM_debug_Print 2 "Only 2,4,8,16 as number of OMP threads are possible " 1315 IGCM_debug_Verif_Exit 1316 ;; 1317 esac 1318 echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh 1319 echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh 1320 echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh 1321 echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh 1322 fi 1323 1324 #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh 1325 echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK )) " >> script_${ExeNameOut}.ksh 1326 echo "MYMPIRANK=\$(printf '%3.3d\n' \${MYMPIRANK})" >> script_${ExeNameOut}.ksh 1327 echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}" >> script_${ExeNameOut}.ksh 1328 IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 1329 1330 if [ ${init_exec} = y ] ; then 1331 EXECUTION="${EXECUTION} : -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" 1332 else 1333 EXECUTION="${EXECUTION} -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh" 1334 init_exec=y 1335 fi 1336 1337 # Build rankfile : method used to assign cores and nodes for the MPI process 1338 # Ex : 1339 #rank 0=curie5296 slot=0,1,2,3 1340 #rank 1=curie5296 slot=4,5,6,7 1341 # Example of final command : 1342 # mpirun -hostfile hosts -rankfile rankfile -np 27 ./script_lmdz.x.ksh : -np 5 ./script_opa.xx.ksh 1343 # with script_lmdz.x.ksh : 1344 # #!/bin/ksh 1345 #export KMP_STACKSIZE=3g 1346 #export KMP_LIBRARY=turnaround 1347 #export MKL_SERIAL=YES 1348 #OMP_NUM_THREADS=4 1349 #./lmdz.x 1350 1351 for nb_proc_mpi in `seq 0 $(($comp_proc_mpi_loc-1))`; do 1352 (( index_host = current_core / core_per_node )) 1353 host_value=${host[${index_host}]} 1354 (( slot = current_core % core_per_node )) 1355 virg="," 1356 string_final="" 1357 for index in `seq $slot $(($slot+$comp_proc_omp_loc-1))`; do 1358 string=$index$virg 1359 string_final=$string_final$string 1360 done 1361 string_final=$( echo $string_final | sed "s/.$//" ) 1362 echo "rank $rank=$host_value slot=$string_final" >> rankfile 1363 (( rank = rank + 1 )) 1364 (( current_core = current_core + comp_proc_omp_loc )) 1365 done 1366 fi 1367 done 1368 1369 elif ( [ "X${config_UserChoices_ExecutionModeOnCurie}" = "Xccc_mprun" ] ) ; then 1370 1371 # 3 MPI/OpenMP ccc_mprun method 1372 1230 1373 # MPI-OpenMP (MPMD) 1231 1374 # example of run_file … … 1233 1376 # 480-1 env OMP_NUM_THREADS=1 ./script_opa.xx.ksh 1234 1377 # 1-1 env OMP_NUM_THREADS=1 ./script_xios.x.ksh 1235 1236 else1237 1378 1238 1379 # Loop on the components … … 1301 1442 module load feature/bridge/heterogenous_mpmd 1302 1443 1303 fi 1304 1305 # for both MPMD/MPI and MPMD/MPI/OpenMP mode 1306 1307 EXECUTION="${HOST_MPIRUN_COMMAND} -f ./run_file" 1308 1309 IGCM_sys_Chmod u+x run_file 1310 if ( $DEBUG_sys ) ; then 1311 echo "run_file contains : " 1312 cat run_file 1313 fi 1314 1444 # set EXECUTION for ccc_mprun case (similar to #1 : MPI only MPMD method) 1445 1446 EXECUTION="${HOST_MPIRUN_COMMAND} -f ./run_file" 1447 1448 IGCM_sys_Chmod u+x run_file 1449 if ( $DEBUG_sys ) ; then 1450 echo "run_file contains : " 1451 cat run_file 1452 fi 1453 1454 else 1455 1456 IGCM_debug_Print 1 "sys Curie : choose mpirun or ccc_mprun in config.card for ExecutionModeOnCurie" 1457 1458 fi # 1 2 or 3 if ${OK_PARA_MPMD} 1459 1460 else 1315 1461 # Only one executable (SPMD mode). 1316 else1317 1462 1318 1463 for comp in ${config_ListOfComponents[*]} ; do … … 1359 1504 done 1360 1505 1361 fi 1506 fi # ${OK_PARA_MPMD} 1362 1507 1363 1508 IGCM_debug_Print 1 "sys Curie : execution command is "
Note: See TracChangeset
for help on using the changeset viewer.