hpc.bat 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. @echo off
  2. REM run on hpc
  3. setlocal EnableDelayedExpansion
  4. set "startTime=%time: =0%"
  5. REM path %path%;
  6. REM"C:\Program Files\Lumerical\FDTD\bin\fdtd-engine" -t 32 template-dipole-on-sphere-on-surf-z.fsp
  7. echo Write hostname to temp folder file
  8. set host=%COMPUTERNAME%
  9. echo %host% > %TEMP%\hostname.txt
  10. echo Preinit exec.bat
  11. echo exit /b 1 > %host%exec.bat
  12. echo Before loop
  13. :loop
  14. REM random timeout 10 seconds
  15. echo random wait
  16. set /a timeout=%RANDOM% * 11 / 32768
  17. start /wait timeout %timeout%
  18. echo %TEMP% > temppath.txt
  19. echo execute Lumerical script
  20. "C:\Program Files\Lumerical\FDTD\bin\fdtd-solutions" -nw -run create_hpc_bat.lsf
  21. echo Run local exec.bat
  22. call %host%exec.bat
  23. if !errorlevel! gtr 0 goto loop
  24. echo after loop
  25. REM mpiexec -n 16 python Si_cylinder_on_Al2O3_substrate.py
  26. REM python Si_cylinder_on_Al2O3_substrate.py
  27. set "endTime=%time: =0%"
  28. rem Get elapsed time:
  29. set "end=!endTime:%time:~8,1%=%%100)*100+1!" & set "start=!startTime:%time:~8,1%=%%100)*100+1!"
  30. set /A "elap=((((10!end:%time:~2,1%=%%100)*60+1!%%100)-((((10!start:%time:~2,1%=%%100)*60+1!%%100)"
  31. rem Convert elapsed time to HH:MM:SS:CC format:
  32. set /A "cc=elap%%100+100,elap/=100,ss=elap%%60+100,elap/=60,mm=elap%%60+100,hh=elap/60+100"
  33. echo Start: %startTime%
  34. echo End: %endTime%
  35. echo Elapsed: %hh:~1%%time:~2,1%%mm:~1%%time:~2,1%%ss:~1%%time:~8,1%%cc:~1%