rtrm_create_init_managers_full_false.py 955 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/env python
  2. import sys, os, stat, random
  3. X_max = 6
  4. Y_max = 8
  5. num_of_apps = int(sys.argv[1])
  6. idag_conf_filename = sys.argv[2]
  7. out_filename = idag_conf_filename + '_rand_full_false_areas'
  8. #regural grids only
  9. fd_idags = open(idag_conf_filename, 'r')
  10. num_idags = int(fd_idags.readline())
  11. list_of_clusters = []
  12. idags = []
  13. avail_cores = X_max * Y_max - num_idags
  14. print 'available cores = ' + str(avail_cores)
  15. print 'out_filename = ' + out_filename
  16. for i in range(0,num_idags):
  17. idags.append(int(fd_idags.readline()))
  18. cores = []
  19. for i in range (0,X_max*Y_max):
  20. if i not in idags:
  21. cores.append(i)
  22. fd_w = open(out_filename, 'w')
  23. print cores
  24. pos = 0
  25. for i in range(0,num_of_apps):
  26. core_id = cores.pop(0)
  27. #print core_id
  28. write_line = str(core_id) + '\n'
  29. fd_w.write(write_line)
  30. if cores == []:
  31. for i in range (0,X_max*Y_max):
  32. if i not in idags:
  33. cores.append(i)
  34. #fd_r.close()
  35. fd_idags.close()
  36. fd_w.close()