create_hpc_bat.lsf 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. clear;
  2. redrawoff;
  3. status = layoutmode;
  4. slash = "/";
  5. if (operatingsystem == "windows") {slash = "\\";}
  6. curdir = pwd;
  7. if (fileexists("temppath.txt")) {
  8. temppath = read("temppath.txt");
  9. len = length(temppath);
  10. temppath = substring(temppath,1,len-2);
  11. cd(temppath);
  12. if (fileexists("hostname.txt")) {
  13. hostname = read("hostname.txt");
  14. len = length(hostname);
  15. hostname = substring(hostname,1,len-2);
  16. cd(curdir);
  17. } else {
  18. cd(curdir);
  19. break;
  20. }
  21. } else {
  22. break;
  23. }
  24. files = splitstring(dir,endl);
  25. isCreated = false;
  26. fname = curdir+slash+hostname+"exec.bat";
  27. if (fileexists(fname)){rm(fname);}
  28. for(i=1:length(files)) {
  29. if(fileextension(files{i}) == "fsp") {
  30. lockfile = files{i}+".lock";
  31. if (!fileexists(lockfile)){
  32. load(files{i});
  33. status = layoutmode;
  34. if (status == 1) {
  35. write(fname,"IF EXIST \""+lockfile+"\" exit /b 1");
  36. write(fname,"copy /y NUL "+lockfile+" >NUL");
  37. write(fname,"\"C:\Program Files\Lumerical\FDTD\bin\fdtd-engine\" -t 32 "+files{i});
  38. write(fname,"del "+lockfile);
  39. write(fname,"exit /b 1");
  40. break;
  41. }
  42. }
  43. }
  44. }
  45. write(fname,"exit /b 0");
  46. redrawon;